diff options
-rw-r--r-- | etc/build.usage | 10 | ||||
-rw-r--r-- | subr/build_init.subr | 43 |
2 files changed, 28 insertions, 25 deletions
diff --git a/etc/build.usage b/etc/build.usage index 226c66da..2150db1d 100644 --- a/etc/build.usage +++ b/etc/build.usage @@ -1,6 +1,6 @@ -usage: ./build.sh [-a nt32|nt64] [-b debug|release] [-C dir[,..]] [-D kind[,..]] - [-F ipv4|ipv6|offline] [-h] [-P[jobs]] [-r [*[*]]ALL|LAST|name[,..][:step,..]] - [-R] [-v[v[v[v]]]] [--as-needed] [--debug-minipix] [<group>[ ..]] +usage: ./build.sh [-a nt32|nt64] [-b debug|release] [-C dir[,..]] [-D kind[,..]] [-F ipv4|ipv6|offline] + [-h] [-p jobs] [-P] [-r [*[*]]ALL|LAST|name[,..][:step,..]] [-R] [-v[v[v[v]]]] + [--as-needed] [--debug-minipix] [<group>[ ..]] -a nt32|nt64 Selects 32-bit or 64-bit architecture; defaults to nt64. -b debug|release Selects debug or release build; defaults to debug. -C dir[,..] Clean build directory (build,) ${PREFIX} before processing build @@ -15,8 +15,8 @@ usage: ./build.sh [-a nt32|nt64] [-b debug|release] [-C dir[,..]] [-D kind[,..]] Force IPv4 (ipv4) or IPv6 (ipv6) when downloading package archives and/or Git repositories or don't download either at all (offline.) -h Show this screen. - -P[jobs] Enables parallelisation at group-level, whenever applicable. - The maximum count of jobs defaults to the number of logical + -p jobs Enables parallelisation at group-level, whenever applicable. + -P The maximum count of jobs defaults to the number of logical processors on the host system. If -R is not specified and at least one (1) package fails to build, all remaining package builds will be forcibly aborted for convenience. diff --git a/subr/build_init.subr b/subr/build_init.subr index dc5ef1b2..1932c49d 100644 --- a/subr/build_init.subr +++ b/subr/build_init.subr @@ -75,14 +75,14 @@ buildp_init_env() { ARG_PARALLEL="${DEFAULT_BUILD_CPUS}"; fi; ;; *[^0-9]*) - _rc=9; _status="Error: invalid jobs count \`${ARG_PARALLEL}'."; ;; + _rc=10; _status="Error: invalid jobs count \`${ARG_PARALLEL}'."; ;; esac; if [ "${_rc}" -eq 0 ]; then ex_rtl_clean_env "${DEFAULT_CLEAR_ENV_VARS_EXCEPT}"; if ex_rtl_check_path_vars "${DEFAULT_CHECK_PATH_VARS}"; then export PATH="${PREFIX}/bin${PATH:+:${PATH}}"; else - : $((_rc+=(10-1))); + : $((_rc+=(11-1))); fi; fi; return "${_rc}"; @@ -101,7 +101,7 @@ buildp_init_files() { ex_rtl_fileop mkdir "${PREFIX_RPM}"; fi; if [ -e "${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}" ]; then - _rc=12; _status="Error: another build targeting this architecture and build type is currently in progress."; + _rc=13; _status="Error: another build targeting this architecture and build type is currently in progress."; else touch "${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}"; if [ -e "${DEFAULT_BUILD_LOG_FNAME}" ]; then @@ -129,7 +129,7 @@ buildp_init_getopts() { esac; if [ "${_shiftfl}" -gt 0 ]; then shift "${_shiftfl}"; continue; - elif getopts a:b:C:D:FhPr:R _opt; then + elif getopts a:b:C:D:Fhp:Pr:R _opt; then case "${_opt}" in a) ARCH="${OPTARG}"; ;; b) BUILD="${OPTARG}"; ;; @@ -137,22 +137,25 @@ buildp_init_getopts() { D) ARG_DIST="${OPTARG}"; ;; F) ARG_FETCH_FORCE=1; ;; h) cat etc/build.usage; exit 0; ;; - P) ARG_PARALLEL="${1#-P}"; ARG_PARALLEL="${ARG_PARALLEL:-auto}"; ;; + p) ARG_PARALLEL="${OPTARG}"; ;; + P) ARG_PARALLEL="auto"; ;; r) ARG_RESTART="${OPTARG}"; ;; R) ARG_RELAXED=1; ;; *) cat etc/build.usage; exit 1; ;; - esac; shift $((${OPTIND}-1)); + esac; shift $((${OPTIND}-1)); OPTIND=1; else - break; + _rc=1; _status="Error: invalid argument \`${1}'."; break; fi; done; - while [ ${#} -gt 0 ]; do - case "${1}" in - *=*) ex_rtl_set_var_unsafe "${1%%=*}" "${1#*=}"; ;; - [^a-zA-Z]*) _rc=1; _status="Error: build group names must start with [a-zA-Z]."; ;; - *[^_a-zA-Z]*) _rc=2; _status="Error: build group names must not contain [^_a-zA-Z]."; ;; - *) BUILD_GROUPS="${BUILD_GROUPS:+${BUILD_GROUPS} }${1}"; ;; - esac; shift; done; + if [ "${_rc}" -eq 0 ]; then + while [ ${#} -gt 0 ]; do + case "${1}" in + *=*) ex_rtl_set_var_unsafe "${1%%=*}" "${1#*=}"; ;; + [^a-zA-Z]*) _rc=2; _status="Error: build group names must start with [a-zA-Z]."; ;; + *[^_a-zA-Z]*) _rc=3; _status="Error: build group names must not contain [^_a-zA-Z]."; ;; + *) BUILD_GROUPS="${BUILD_GROUPS:+${BUILD_GROUPS} }${1}"; ;; + esac; shift; done; + fi; return "${_rc}"; }; @@ -164,11 +167,11 @@ buildp_init_prereqs() { mkdir mkfifo mv openssl paste patch pgrep pkill \ printf readlink rm sed seq shuf sort stat tail \ tar test touch tr wget xz >/dev/null; then - _rc=3; _status="Error: missing prerequisite package(s)."; + _rc=4; _status="Error: missing prerequisite package(s)."; elif ! awk -V 2>/dev/null | grep -q "^GNU Awk "; then - _rc=4; _status="Error: awk(1) in \$PATH must be GNU Awk."; + _rc=5; _status="Error: awk(1) in \$PATH must be GNU Awk."; elif ! sed --version 2>/dev/null | grep -q "^GNU sed "; then - _rc=5; _status="Error: sed(1) in \$PATH must be GNU sed."; + _rc=6; _status="Error: sed(1) in \$PATH must be GNU sed."; fi; return "${_rc}"; }; @@ -183,9 +186,9 @@ buildp_init_type() { else if [ "${BUILD}" != debug ]\ && [ "${BUILD}" != release ]; then - _rc=6; _status="Error: unknown build type \`${BUILD}'."; + _rc=7; _status="Error: unknown build type \`${BUILD}'."; fi; - _rc=7; _status="Error: invalid architecture \`${ARCH}'."; + _rc=8; _status="Error: invalid architecture \`${ARCH}'."; fi; return "${_rc}"; }; @@ -215,7 +218,7 @@ buildp_init_vars() { fi; done; if [ -z "${PREFIX}" ]; then - _rc=8; _status="Error: \${PREFIX} empty or unset."; + _rc=9; _status="Error: \${PREFIX} empty or unset."; fi; return "${_rc}"; }; |