summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--subr/ex_pkg_dispatch.subr91
-rw-r--r--vars/build.vars5
-rw-r--r--vars/env.vars5
-rw-r--r--vars/midipix.vars2
4 files changed, 61 insertions, 42 deletions
diff --git a/subr/ex_pkg_dispatch.subr b/subr/ex_pkg_dispatch.subr
index 7a8a95d2..4fbc2b17 100644
--- a/subr/ex_pkg_dispatch.subr
+++ b/subr/ex_pkg_dispatch.subr
@@ -9,7 +9,7 @@
ex_pkg_dispatch() {
local _tgt_name="${1}" _restart="${2}" _restart_at="${3}" \
_dispatch_fn="${4}" _tgt_name_uc \
- _pkg_names _pkg_name _pkg_name_uc \
+ _pkg_names _njob _njobs _njobs_max _pkg_name _pkg_name_uc \
_pipe_path _stderrout_path _pipe_msg _script_rc;
ex_rtl_fileop mkdir "${BUILD_WORKDIR}";
_pipe_path="${BUILD_WORKDIR}/build.fifo";
@@ -20,47 +20,60 @@ ex_pkg_dispatch() {
&& [ "${_restart}" != ALL ]; then
_pkg_names="$(ex_rtl_lfilter "${_pkg_names}" "${_restart}")";
fi;
- for _pkg_name in ${_pkg_names}; do
- _pkg_name_uc="$(ex_rtl_toupper "${_pkg_name}")";
- if [ -n "$(ex_rtl_get_var_unsafe PKG_${_pkg_name_uc}_DISABLED)" ]; then
- "${_dispatch_fn}" disabled_pkg "${_pkg_name}" "${_tgt_name}";
- continue;
- elif ex_pkg_state_test "${_pkg_name}" finish\
- && [ -z "${_restart_at}" ]; then
- "${_dispatch_fn}" skipped_pkg "${_pkg_name}" "${_tgt_name}";
- continue;
+ set -- ${_pkg_names};
+ while [ ${#} -gt 0 ]; do
+ _script_rc=0; _njobs=0;
+ if [ "$(ex_rtl_get_var_unsafe ${_tgt_name_uc}_PARALLELISE)" = 1 ]; then
+ _njobs_max="${DEFAULT_BUILD_CPUS}";
else
- ex_rtl_fileop mkfifo "${_pipe_path}";
- _stderrout_path="${BUILD_WORKDIR}/${_pkg_name}_stderrout.log";
- _script_rc=1;
- "${_dispatch_fn}" start_pkg "${_pkg_name}" "${_tgt_name}";
+ _njobs_max=1;
fi;
- (set -o errexit -o noglob;
- ex_pkg_env "${_pkg_name}" "${_tgt_name}" "${_restart_at}";
- trap "if [ \${?} -eq 0 ]; then \
- echo \"done ${PKG_NAME}\" >&3; \
- else \
- echo \"fail ${PKG_NAME}\" >&3; \
- fi;" EXIT HUP INT TERM USR1 USR2;
- ex_pkg_exec "${_pkg_name}" "${_tgt_name}" "${_restart_at}" \
- "${_dispatch_fn}";) 1>"${_stderrout_path}" 2>&1 3>"${_pipe_path}" &
- while read _pipe_msg; do
- case "${_pipe_msg%% *}" in
- done) _script_rc=0;
- "${_dispatch_fn}" finish_pkg "${_pkg_name}" "${_tgt_name}";
- break; ;;
- fail) _script_rc=1;
- "${_dispatch_fn}" fail_pkg "${_pkg_name}" "${_tgt_name}";
- break; ;;
- step) "${_dispatch_fn}" step_pkg ${_pipe_msg#step }; ;;
- *) _script_rc=1;
- "${_dispatch_fn}" fail_pkg "${_pkg_name}" "${_tgt_name}";
- break; ;;
- esac; done <"${_pipe_path}";
- ex_rtl_fileop rm "${_pipe_path}";
- if [ "${_script_rc:-1}" -eq 1 ]; then
- return 1;
+ ex_rtl_fileop mkfifo "${_pipe_path}";
+ for _njob in $(seq 1 ${_njobs_max}); do
+ if [ ${#} -eq 0 ]; then
+ break;
+ else
+ _pkg_name="${1}"; shift;
+ _pkg_name_uc="$(ex_rtl_toupper "${_pkg_name}")";
+ fi;
+ if [ -n "$(ex_rtl_get_var_unsafe PKG_${_pkg_name_uc}_DISABLED)" ]; then
+ "${_dispatch_fn}" disabled_pkg "${_pkg_name}" "${_tgt_name}";
+ continue;
+ elif ex_pkg_state_test "${_pkg_name}" finish\
+ && [ -z "${_restart_at}" ]; then
+ "${_dispatch_fn}" skipped_pkg "${_pkg_name}" "${_tgt_name}";
+ continue;
+ else
+ _stderrout_path="${BUILD_WORKDIR}/${_pkg_name}_stderrout.log";
+ "${_dispatch_fn}" start_pkg "${_pkg_name}" "${_tgt_name}";
+ fi;
+ (set -o errexit -o noglob;
+ ex_pkg_env "${_pkg_name}" "${_tgt_name}" "${_restart_at}";
+ trap "if [ \${?} -eq 0 ]; then \
+ echo \"done ${_pkg_name} ${_tgt_name}\" >&3; \
+ else \
+ echo \"fail ${_pkg_name} ${_tgt_name}\" >&3; \
+ fi;" EXIT HUP INT TERM USR1 USR2;
+ ex_pkg_exec "${_pkg_name}" "${_tgt_name}" "${_restart_at}" \
+ "${_dispatch_fn}";) 1>"${_stderrout_path}" 2>&1 3>"${_pipe_path}" &
+ : $((_njobs+=1));
+ done;
+ if [ "${_njobs:-0}" -gt 0 ]; then
+ while read _pipe_msg; do
+ case "${_pipe_msg%% *}" in
+ done) "${_dispatch_fn}" finish_pkg ${_pipe_msg#done };
+ [ $((_njobs-=1)) -eq 0 ] && break; ;;
+ fail) _script_rc=1;
+ "${_dispatch_fn}" fail_pkg ${_pipe_msg#fail };
+ [ $((_njobs-=1)) -eq 0 ] && break; ;;
+ step) "${_dispatch_fn}" step_pkg ${_pipe_msg#step };
+ esac; done <"${_pipe_path}";
+ if [ "${_script_rc:-1}" -eq 1 ]; then
+ ex_rtl_fileop rm "${_pipe_path}";
+ return 1;
+ fi;
fi;
+ ex_rtl_fileop rm "${_pipe_path}";
done;
"${_dispatch_fn}" finish_target "" "${_tgt_name}";
};
diff --git a/vars/build.vars b/vars/build.vars
index ba3a9148..f4e2fe23 100644
--- a/vars/build.vars
+++ b/vars/build.vars
@@ -646,6 +646,7 @@ NATIVE_PACKAGES_CMDLINE_MAKEFLAGS_INSTALL="PREFIX= prefix=";
NATIVE_PACKAGES_CMDLINE_PACKAGES="
bash bc coreutils dash datamash dos2unix ed figlet file findutils gawk grep
mksh sbase sed tar tcsh the_silver_searcher toilet ubase util_linux which zsh";
+NATIVE_PACKAGES_CMDLINE_PARALLELISE=1;
NATIVE_PACKAGES_CMDLINE_PREFIX="${PREFIX_NATIVE}";
: ${PKG_BASH_SHA256SUM:=d86b3392c1202e8ff5a423b302e6284db7f8f435ea9f39b5b1b20fd3ac36dfcb};
: ${PKG_BASH_VERSION:=4.4};
@@ -743,6 +744,7 @@ NATIVE_PACKAGES_DEV_LDFLAGS_CONFIGURE="--sysroot=${PREFIX_NATIVE}";
NATIVE_PACKAGES_DEV_MAKEFLAGS_INSTALL="PREFIX= prefix=";
NATIVE_PACKAGES_DEV_PACKAGES="
bdwgc bison chicken cparser diffutils flex lunix m4 make man_db patch patchutils perl python3 ruby smallbasic";
+NATIVE_PACKAGES_DEV_PARALLELISE=1;
NATIVE_PACKAGES_DEV_PREFIX="${PREFIX_NATIVE}";
: ${PKG_BDWGC_URLS_GIT:="bdwgc=https://github.com/ivmai/bdwgc@master"};
: ${PKG_BISON_SHA256SUM:=a72428c7917bdf9fa93cb8181c971b6e22834125848cf1d03ce10b1bb0716fe1};
@@ -825,6 +827,7 @@ NATIVE_PACKAGES_ETC_MAKEFLAGS_INSTALL="PREFIX= prefix=";
NATIVE_PACKAGES_ETC_PACKAGES="
cron hexcurse htop infounzip infozip john less mc mintty nano ncdu
p7zip procps_ng qpdf rxvt_unicode st tmux vim xeyes xwd";
+NATIVE_PACKAGES_ETC_PARALLELISE=1;
NATIVE_PACKAGES_ETC_PREFIX="${PREFIX_NATIVE}";
: ${PKG_CRON_URLS_GIT:="pkg-cron.git=git://anonscm.debian.org/pkg-cron/pkg-cron.git@debian/3.0pl1-128"};
: ${PKG_CRON_ENV_VARS_EXTRA:="CC=${DEFAULT_TARGET}-gcc:CFLAGS=${NATIVE_PACKAGES_ETC_CFLAGS_CONFIGURE} -D__GNU__"};
@@ -921,6 +924,7 @@ NATIVE_PACKAGES_INET_MAKEFLAGS_INSTALL="PREFIX= prefix=";
NATIVE_PACKAGES_INET_PACKAGES="
apk_tools aria2 bind dropbear git gnupg httpd inetutils irssi ldns lighttpd lynx
mtr nginx openlitespeed openssh pacman rsync socat thttpd weechat wget whois";
+NATIVE_PACKAGES_INET_PARALLELISE=1;
NATIVE_PACKAGES_INET_PREFIX="${PREFIX_NATIVE}";
: ${PKG_APK_TOOLS_SHA256SUM:=def2b2c23cd12fd2a9c19be49653b0d1bf9d81a26dac5a0ee79a1351d674f93b};
: ${PKG_APK_TOOLS_VERSION:=2.6.8};
@@ -1042,6 +1046,7 @@ DIST_MINIPIX_MAKEFLAGS_INSTALL="PREFIX= prefix=";
DIST_MINIPIX_PACKAGES="
bzip2_minipix gzip_minipix xz_minipix bash_minipix coreutils_minipix
nano_minipix tar_minipix mintty_minipix ntctty_minipix ptycon_minipix";
+DIST_MINIPIX_PARALLELISE=1;
DIST_MINIPIX_PREFIX="${PREFIX}/minipix_dist";
: ${PKG_BZIP2_MINIPIX_INHERIT_FROM:=bzip2};
: ${PKG_BZIP2_MINIPIX_BASE_DIR:=${BUILD_WORKDIR}/bzip2-build-minipix};
diff --git a/vars/env.vars b/vars/env.vars
index 15a02751..5d2206df 100644
--- a/vars/env.vars
+++ b/vars/env.vars
@@ -14,8 +14,9 @@ DEFAULT_BUILD_VARS="
INSTALL_TARGET_EXTRA IN_TREE LDFLAGS_BUILD_EXTRA LDFLAGS_CONFIGURE \
LDFLAGS_CONFIGURE_EXTRA LDFLAGS_INSTALL_EXTRA LIBTOOL MAKE MAKE_INSTALL_VNAME \
MAKEFLAGS_BUILD MAKEFLAGS_BUILD_EXTRA MAKEFLAGS_INSTALL MAKEFLAGS_INSTALL_EXTRA \
- NO_CLEAN_BASE_DIR NO_LOG_VARS PATCHES_EXTRA PKG_CONFIG PKG_CONFIG_LIBDIR \
- PKGCONFIG PREFIX RANLIB SHA256SUM SUBDIR TARGET URL URL_TYPE URLS_GIT VERSION";
+ NO_CLEAN_BASE_DIR NO_LOG_VARS PARALLELISE PATCHES_EXTRA PKG_CONFIG \
+ PKG_CONFIG_LIBDIR PKGCONFIG PREFIX RANLIB SHA256SUM SUBDIR TARGET URL
+ URL_TYPE URLS_GIT VERSION";
DEFAULT_LOG_MSG_FAIL_COLOUR=91;
DEFAULT_LOG_MSG_INFO_COLOUR=93;
DEFAULT_LOG_MSG_INF2_COLOUR=33;
diff --git a/vars/midipix.vars b/vars/midipix.vars
index 62cff680..249a42ee 100644
--- a/vars/midipix.vars
+++ b/vars/midipix.vars
@@ -34,7 +34,7 @@
@.=usr"};
# Default flags & variables
-: ${DEFAULT_BUILD_CPUS:=1};
+: ${DEFAULT_BUILD_CPUS:=};
: ${DEFAULT_BUILD_TYPE:=native};
: ${DEFAULT_CFLAGS_DEBUG:="-g2 -O0"};
: ${DEFAULT_CFLAGS_DEBUG_HOST:="-g0 -O2"};