summaryrefslogtreecommitdiffhomepage
path: root/subr
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-02-13 11:54:02 +0000
committerLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-02-13 11:54:02 +0000
commit8c791c79aef693feaa435016ec3f94ed808f5dd5 (patch)
treec299e5ca2196770a9f787aa27c87971765baf111 /subr
parentc3ef792f5258fbcb7313367f3ea5f9dc4613714d (diff)
downloadmidipix_build-8c791c79aef693feaa435016ec3f94ed808f5dd5.tar.bz2
midipix_build-8c791c79aef693feaa435016ec3f94ed808f5dd5.tar.xz
build.sh: change working directory to "$(dirname "${0}")" at startup.
etc/build.usage: updated. groups/2*.native_packages_*.group: adds dependencies. vars/env.vars, groups/{010.host_deps,120.native_runtime}.group: removes ${PKG_SRC_TARBALL_DISABLE}. groups/999.invariants.group b, vars/{env,invariants_tarballs}.vars: removes tarball generation. subr/build_args.subr: reimplemented using getopts(1). subr/{build_args,ex_pkg_dispatch}.subr: don't inhibit dependency processing if ${ARG_RESTART_RECURSIVE} is set.
Diffstat (limited to 'subr')
-rw-r--r--subr/build_args.subr87
-rw-r--r--subr/ex_pkg_dispatch.subr7
2 files changed, 27 insertions, 67 deletions
diff --git a/subr/build_args.subr b/subr/build_args.subr
index 6a95b520..35761819 100644
--- a/subr/build_args.subr
+++ b/subr/build_args.subr
@@ -2,64 +2,31 @@
# set -o noglob is assumed.
#
-BUILD_ARGS_SPEC="
- ARCH:arg:-a:
- ARG_AS_NEEDED:--as-needed:
- ARG_CLEAN_BUILDS:arg:-C:
- ARG_DEBUG_MINIPIX:--debug-minipix:
- ARG_DIST:arg:-D:
- ARG_FETCH_FORCE:-F:
- ARG_PARALLEL:optarg:-P:auto
- ARG_RELAXED:-R:
- ARG_RESTART:arg:-r:
- ARG_VERBOSE:selfarg:-v:
- ARG_VERBOSE:selfarg:-vv:
- ARG_VERBOSE:selfarg:-vvv:
- ARG_VERBOSE:selfarg:-vvvv:
- BUILD:arg:-b:";
-
build_args() {
- local _spec="${BUILD_ARGS_SPEC}" _spec_arg="" _found="";
- while [ ${#} -gt 0 ]; do
- if [ "${1#-}" = "${1}" ]; then
- break;
- fi;
- for _spec_arg in ${_spec}; do
- case "${_spec_arg}" in
- *:${1}:*)
- case "${_spec_arg#*:}" in
- arg:*)
- ex_rtl_set_var_unsafe "${_spec_arg%%:*}" "${2}"; shift; ;;
- optarg:*)
- if [ -n "${2}" ]\
- && [ "x${2#-}" = "x${2}" ]; then
- ex_rtl_set_var_unsafe "${_spec_arg%%:*}" "${2}";
- shift;
- else
- ex_rtl_set_var_unsafe "${_spec_arg%%:*}" \
- "${_spec_arg##*:}";
- fi; ;;
- selfarg:*)
- ex_rtl_set_var_unsafe "${_spec_arg%%:*}" "${1}"; ;;
- *)
- ex_rtl_set_var_unsafe "${_spec_arg%%:*}" 1; ;;
- esac; _found=1; break; ;;
- *) _found=0; ;;
- esac;
- done;
- if [ "${_found:-0}" -eq 0 ]; then
- exec cat etc/build.usage;
- else
- shift;
- fi;
- done;
- if ex_rtl_lmatch "${ARG_DIST}" , tbz2 \
- || ex_rtl_lmatch "${ARG_DIST}" , tgz \
- || ex_rtl_lmatch "${ARG_DIST}" , txz \
- || ex_rtl_lmatch "${ARG_DIST}" , zipdist; then
- if ! ex_rtl_lmatch "${ARG_DIST}" , minipix; then
- ARG_DIST="${ARG_DIST:+${ARG_DIST},}minipix";
- fi;
+ local _opt="";
+ while getopts a:Ab:C:dD:FhPr:Rv _opt; do
+ case "${_opt}" in
+ a) ARCH="${OPTARG}"; ;;
+ A) ARG_AS_NEEDED=1; ;;
+ b) BUILD="${OPTARG}"; ;;
+ C) ARG_CLEAN_BUILDS="${OPTARG}"; ;;
+ d) ARG_DEBUG_MINIPIX=1; ;;
+ D) ARG_DIST="${OPTARG}"; ;;
+ F) ARG_FETCH_FORCE=1; ;;
+ h) cat etc/build.usage; exit 0; ;;
+ P) ARG_PARALLEL="${OPTARG:-auto}"; ;;
+ r) ARG_RESTART="${OPTARG}"; ;;
+ R) ARG_RELAXED=1; ;;
+ v) : $((ARG_VERBOSE+=1)); ;;
+ *) cat etc/build.usage; exit 1; ;;
+ esac; done; shift $((${OPTIND}-1));
+ if ex_rtl_lmatch "${ARG_DIST}" , zipdist\
+ && ! ex_rtl_lmatch "${ARG_DIST}" , minipix; then
+ ARG_DIST="${ARG_DIST:+${ARG_DIST},}minipix";
+ fi;
+ if [ -n "${ARG_RESTART}" ]\
+ && [ "${ARG_RESTART#\*}" != "${ARG_RESTART}" ]; then
+ ARG_RESTART="${ARG_RESTART#\*}"; ARG_RESTART_RECURSIVE=1;
fi;
case "${ARG_RESTART}" in
ALL) ARG_RESTART_AT=ALL; ;;
@@ -73,12 +40,6 @@ build_args() {
ARG_RESTART="$(echo "${ARG_RESTART}" | sed "s/,/ /g")";
;;
esac;
- case "${ARG_VERBOSE}" in
- -v) ARG_VERBOSE=1; ;;
- -vv) ARG_VERBOSE=2; ;;
- -vvv) ARG_VERBOSE=3; ;;
- -vvvv) ARG_VERBOSE=4; ;;
- esac;
while [ ${#} -gt 0 ]; do
case "${1}" in
*=*) ex_rtl_set_var_unsafe "${1%%=*}" "${1#*=}"; ;;
diff --git a/subr/ex_pkg_dispatch.subr b/subr/ex_pkg_dispatch.subr
index 2a40e16c..7ea95875 100644
--- a/subr/ex_pkg_dispatch.subr
+++ b/subr/ex_pkg_dispatch.subr
@@ -9,7 +9,7 @@
exp_pkg_check_depends() {
local _group_name="${1}" _pkg_depends="${2}" _pkg_name="${3}" _dependfl=0;
if ! [ -n "${_restart}" ]\
- && ! [ "$(ex_rtl_get_var_unsafe "$(ex_rtl_toupper "${_group_name}")_IN_ORDER"))" = "1" ]; then
+ || [ "${ARG_RESTART_RECURSIVE:-0}" -eq 1 ]; then
for _pkg_name_depend in ${_pkg_depends}; do
if [ -n "$(ex_rtl_lsearch "${_pkgs_wait}" "${_pkg_name_depend}")" ]\
|| [ -z "$(ex_rtl_lsearch "${_pkgs_complete}" "${_pkg_name_depend}")" ]; then
@@ -89,7 +89,7 @@ exp_pkg_get_packages() {
_pkg_names="$(ex_rtl_lsearch "${_pkg_names}" "${_restart}")";
fi;
if ! [ -n "${_restart}" ]\
- && ! [ "$(ex_rtl_get_var_unsafe "${_group_name_uc}"_IN_ORDER)" = "1" ]; then
+ || [ "${ARG_RESTART_RECURSIVE:-0}" -eq 1 ]; then
_pkg_names="$(ex_rtl_uniq $(exp_pkg_expand_packages ${_pkg_names}))";
fi;
};
@@ -105,8 +105,7 @@ ex_pkg_dispatch() {
for _pkg_name in ${_pkg_names}; do
: $((_pkgs_count_max+=1));
done;
- if [ "${ARG_PARALLEL:-0}" -gt 1 ]\
- && ! [ "$(ex_rtl_get_var_unsafe "$(ex_rtl_toupper "${_group_name}")"_IN_ORDER)" = 1 ]; then
+ if [ "${ARG_PARALLEL:-0}" -gt 1 ]; then
_njobs_max="${DEFAULT_BUILD_CPUS}";
fi;
ex_rtl_fileop mkfifo "${_pipe_path}"; exp_pkg_dispatch_group;