summaryrefslogtreecommitdiffhomepage
path: root/subr/build_init.subr
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-02-14 17:15:07 +0000
committerLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-02-14 17:15:07 +0000
commite30e0aedb36bdb048b8feff7738c20e265fbac8d (patch)
treefda6cf2478de284fe64187c96e7465db7f9e3d4f /subr/build_init.subr
parent0f39ce29b8e5756692be0a5f8293d22299c6128a (diff)
downloadmidipix_build-e30e0aedb36bdb048b8feff7738c20e265fbac8d.tar.bz2
midipix_build-e30e0aedb36bdb048b8feff7738c20e265fbac8d.tar.xz
subr/build_init.subr:buildp_init_env(): default to -P jobs count to ${DEFAULT_BUILD_CPUS}/2 or 1.
subr/build_init.subr:buildp_init_env(): reject invalid -P job counts. etc/build.usage: updated.
Diffstat (limited to 'subr/build_init.subr')
-rw-r--r--subr/build_init.subr29
1 files changed, 19 insertions, 10 deletions
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; ;;