|
125 | 125 | } |
126 | 126 |
|
127 | 127 | # Parse arguments |
| 128 | +__CMD="$0 $@" |
128 | 129 | while (( "$#" )); do |
129 | 130 | case "$1" in |
130 | 131 | -h|--help) |
@@ -217,33 +218,35 @@ LSORACLE_ARGS+=" \ |
217 | 218 | -D CMAKE_INSTALL_PREFIX=${INSTALL_PATH}/LSOracle \ |
218 | 219 | " |
219 | 220 |
|
220 | | -if [ ! -z "${DOCKER_OVERWIRTE_ARGS+x}" ]; then |
221 | | - echo "[INFO FLW-0015] Overwriting Docker build flags." |
222 | | - DOCKER_ARGS="${DOCKER_USER_ARGS}" |
223 | | -else |
224 | | - DOCKER_ARGS+=" ${DOCKER_USER_ARGS}" |
225 | | -fi |
| 221 | +__args_setup() { |
| 222 | + if [ ! -z "${DOCKER_OVERWIRTE_ARGS+x}" ]; then |
| 223 | + echo "[INFO FLW-0013] Overwriting Docker build flags." |
| 224 | + DOCKER_ARGS="${DOCKER_USER_ARGS}" |
| 225 | + else |
| 226 | + DOCKER_ARGS+=" ${DOCKER_USER_ARGS}" |
| 227 | + fi |
226 | 228 |
|
227 | | -if [ ! -z "${YOSYS_OVERWIRTE_ARGS+x}" ]; then |
228 | | - echo "[INFO FLW-0013] Overwriting Yosys compilation flags." |
229 | | - YOSYS_ARGS="${YOSYS_USER_ARGS}" |
230 | | -else |
231 | | - YOSYS_ARGS+=" ${YOSYS_USER_ARGS}" |
232 | | -fi |
| 229 | + if [ ! -z "${YOSYS_OVERWIRTE_ARGS+x}" ]; then |
| 230 | + echo "[INFO FLW-0014] Overwriting Yosys compilation flags." |
| 231 | + YOSYS_ARGS="${YOSYS_USER_ARGS}" |
| 232 | + else |
| 233 | + YOSYS_ARGS+=" ${YOSYS_USER_ARGS}" |
| 234 | + fi |
233 | 235 |
|
234 | | -if [ ! -z "${OPENROAD_APP_OVERWIRTE_ARGS+x}" ]; then |
235 | | - echo "[INFO FLW-0014] Overwriting OpenROAD app compilation flags." |
236 | | - OPENROAD_APP_ARGS="${OPENROAD_APP_USER_ARGS}" |
237 | | -else |
238 | | - OPENROAD_APP_ARGS+=" ${OPENROAD_APP_USER_ARGS}" |
239 | | -fi |
| 236 | + if [ ! -z "${OPENROAD_APP_OVERWIRTE_ARGS+x}" ]; then |
| 237 | + echo "[INFO FLW-0015] Overwriting OpenROAD app compilation flags." |
| 238 | + OPENROAD_APP_ARGS="${OPENROAD_APP_USER_ARGS}" |
| 239 | + else |
| 240 | + OPENROAD_APP_ARGS+=" ${OPENROAD_APP_USER_ARGS}" |
| 241 | + fi |
240 | 242 |
|
241 | | -if [ ! -z "${LSORACLE_OVERWIRTE_ARGS+x}" ]; then |
242 | | - echo "[INFO FLW-0013] Overwriting LSOracle compilation flags." |
243 | | - LSORACLE_ARGS="${LSORACLE_USER_ARGS}" |
244 | | -else |
245 | | - LSORACLE_ARGS+=" ${LSORACLE_USER_ARGS}" |
246 | | -fi |
| 243 | + if [ ! -z "${LSORACLE_OVERWIRTE_ARGS+x}" ]; then |
| 244 | + echo "[INFO FLW-0016] Overwriting LSOracle compilation flags." |
| 245 | + LSORACLE_ARGS="${LSORACLE_USER_ARGS}" |
| 246 | + else |
| 247 | + LSORACLE_ARGS+=" ${LSORACLE_USER_ARGS}" |
| 248 | + fi |
| 249 | +} |
247 | 250 |
|
248 | 251 | __docker_build() |
249 | 252 | { |
@@ -358,18 +361,31 @@ __common_setup() |
358 | 361 | fi |
359 | 362 | } |
360 | 363 |
|
361 | | -__common_setup |
| 364 | +__logging() |
| 365 | +{ |
| 366 | + local log_file="build_openroad.log" |
| 367 | + echo "[INFO FLW-0027] Saving logs to ${log_file}" |
| 368 | + echo "[INFO FLW-0028] $__CMD" |
| 369 | + exec > >(tee -i "${log_file}") |
| 370 | + exec 2>&1 |
| 371 | +} |
362 | 372 |
|
363 | | -if [ ! -z "${CLEAN_FORCE+x}" ]; then |
364 | | - CLEAN_CMD="-x -d --force" |
365 | | -else |
366 | | - CLEAN_CMD="-x -d --interactive" |
367 | | -fi |
368 | | -if [ ! -z "${CLEAN_BEFORE+x}" ]; then |
369 | | - echo "[INFO FLW-0016] Cleaning up previous binaries and build files." |
| 373 | +__cleanup() |
| 374 | +{ |
| 375 | + if [ ! -z "${CLEAN_FORCE+x}" ]; then |
| 376 | + CLEAN_CMD="-x -d --force" |
| 377 | + else |
| 378 | + CLEAN_CMD="-x -d --interactive" |
| 379 | + fi |
| 380 | + echo "[INFO FLW-0026] Cleaning up previous binaries and build files." |
370 | 381 | git clean ${CLEAN_CMD} tools |
371 | 382 | git submodule foreach --recursive git clean ${CLEAN_CMD} |
372 | | -fi |
| 383 | +} |
| 384 | + |
| 385 | +__cleanup |
| 386 | +__logging |
| 387 | +__args_setup |
| 388 | +__common_setup |
373 | 389 |
|
374 | 390 | # Choose install method |
375 | 391 | if [ -z "${LOCAL_BUILD+x}" ] && command -v docker &> /dev/null; then |
|
0 commit comments