summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--etc/build.usage4
-rw-r--r--subr/build_init.subr29
2 files changed, 21 insertions, 12 deletions
diff --git a/etc/build.usage b/etc/build.usage
index 7401608b..226c66da 100644
--- a/etc/build.usage
+++ b/etc/build.usage
@@ -1,5 +1,5 @@
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,..]]
+ [-F ipv4|ipv6|offline] [-h] [-P[jobs]] [-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.
@@ -15,7 +15,7 @@ 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.
+ -P[jobs] Enables parallelisation at group-level, whenever applicable.
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,
diff --git a/subr/build_init.subr b/subr/build_init.subr
index c204c9b6..97db31eb 100644
--- a/subr/build_init.subr
+++ b/subr/build_init.subr
@@ -74,14 +74,23 @@ buildp_init_env() {
DEFAULT_BUILD_CPUS=1;
fi;
fi;
- if [ "${ARG_PARALLEL}" = auto ]; then
- ARG_PARALLEL="${DEFAULT_BUILD_CPUS}";
- fi;
- 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+=(9-1)));
+ case "${ARG_PARALLEL}" in
+ auto)
+ if [ "${DEFAULT_BUILD_CPUS}" -gt 1 ]; then
+ ARG_PARALLEL=$((${DEFAULT_BUILD_CPUS}/2));
+ else
+ ARG_PARALLEL="${DEFAULT_BUILD_CPUS}";
+ fi; ;;
+ *[^0-9]*)
+ _rc=9; _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)));
+ fi;
fi;
return "${_rc}";
};
@@ -99,7 +108,7 @@ buildp_init_files() {
ex_rtl_fileop mkdir "${PREFIX_RPM}";
fi;
if [ -e "${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}" ]; then
- _rc=11; _status="Error: another build targeting this architecture and build type is currently in progress.";
+ _rc=12; _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
@@ -135,7 +144,7 @@ buildp_init_getopts() {
D) ARG_DIST="${OPTARG}"; ;;
F) ARG_FETCH_FORCE=1; ;;
h) cat etc/build.usage; exit 0; ;;
- P) ARG_PARALLEL="${OPTARG:-auto}"; ;;
+ P) ARG_PARALLEL="${1#-P}"; ARG_PARALLEL="${ARG_PARALLEL:-auto}"; ;;
r) ARG_RESTART="${OPTARG}"; ;;
R) ARG_RELAXED=1; ;;
*) cat etc/build.usage; exit 1; ;;