diff options
117 files changed, 960 insertions, 712 deletions
@@ -3,39 +3,42 @@ # buildp_dispatch() { - local _msg="${1}" _group_name="${2}" _pkg_name="${3}" \ - _build_group_meta="" _build_group_lc="" _build_groups_lc="" _pkg_restart="" PKGS_FOUND; + local _msg="${1}" _group_name="${2}" _pkg_name="${3}" \ + _build_group_lc="" _build_group_meta="" _build_groups_lc="" \ + _njobs_max=0 _pkg_names="" _pkg_restart="" _rc=0; case "${_msg}" in # Top-level start_build) shift; build_init "${@}"; ex_rtl_log_msg info "Build started by ${BUILD_USER:=${USER}}@${BUILD_HNAME:=$(hostname)} at ${BUILD_DATE_START}."; ex_rtl_log_env_vars "build (global)" ${DEFAULT_LOG_ENV_VARS}; _build_groups_lc="${BUILD_GROUPS:-${GROUPS_DEFAULT}}"; - if ! ex_rtl_lmatch "${ARG_DIST}" , rpm; then + if ! ex_rtl_lmatch "${ARG_DIST}" "rpm" ","; then _build_groups_lc="$(ex_rtl_lfilter "${_build_groups_lc}" "host_deps_rpm")"; fi; - PKGS_FOUND=""; + if [ "${ARG_PARALLEL:-0}" -gt 1 ]; then + _njobs_max="${DEFAULT_BUILD_CPUS}"; + fi; for _build_group_lc in ${_build_groups_lc}; do - ex_pkg_dispatch "${_build_group_lc}" \ - "${ARG_RESTART}" "${ARG_RESTART_AT}" \ - buildp_dispatch PKGS_FOUND; - if [ ${?} -ne 0 ]; then + ex_pkg_dispatch buildp_dispatch "${_build_group_lc}" "${_njobs_max}" \ + "${ARG_RESTART}" "${ARG_RESTART_AT}" "${ARG_RESTART_RECURSIVE}"; _rc="${?}"; + : $((_nskipped+=${EX_PKG_NSKIPPED})); _pkg_names="$(ex_rtl_lconcat "${_pkg_names}" "${EX_PKG_NAMES}")"; + if [ "${_rc}" -ne 0 ]; then break; fi; done; for _pkg_restart in ${ARG_RESTART}; do - if ! ex_rtl_lmatch "ALL LAST" " " "${_pkg_restart}" \ - && ! ex_rtl_lmatch "${PKGS_FOUND}" " " "${_pkg_restart}"; then + if ! ex_rtl_lmatch "${_pkg_restart}" "ALL LAST"\ + && ! ex_rtl_lmatch "${_pkg_names}" "${_pkg_restart}"; then ex_rtl_log_msg failexit "Error: package \`${_pkg_restart}' unknown."; fi; done; - if ! ex_pkg_dispatch "invariants" "ALL" "ALL" buildp_dispatch ""; then + if ! ex_pkg_dispatch buildp_dispatch "invariants" "${_njobs_max}" "ALL" "ALL" 2; then break; fi; buildp_dispatch finish_build; ;; finish_build) build_fini; - ex_rtl_log_msg info "${BUILD_NFINI} finished, ${BUILD_NSKIP} skipped, and ${BUILD_NFAIL} failed builds in ${BUILD_NBUILT} build script(s)."; - ex_rtl_log_msg info "Build time: ${BUILD_TIMES_HOURS} hour(s), ${BUILD_TIMES_MINUTES} minute(s), and ${BUILD_TIMES_SECS} second(s)."; + ex_rtl_log_msg info "${BUILD_NFINI:-0} finished, ${_nskipped:-0} skipped, and ${BUILD_NFAIL:-0} failed builds in ${BUILD_NBUILT:-0} build script(s)."; + ex_rtl_log_msg info "Build time: ${BUILD_TIMES_HOURS:-0} hour(s), ${BUILD_TIMES_MINUTES:-0} minute(s), and ${BUILD_TIMES_SECS:-0} second(s)."; if [ -n "${BUILD_PKGS_FAILED}" ]; then ex_rtl_log_msg failexit "Build script failure(s) in: ${BUILD_PKGS_FAILED}."; fi; ;; @@ -68,18 +71,13 @@ buildp_dispatch() { fi; exit 1; fi; ;; - disabled_pkg) : $((BUILD_NSKIP+=1)); - ex_rtl_log_msg vnfo "$(printf "[%03d/%03d] Skipping disabled package \`%s.'" "${4}" "${5}" "${_pkg_name}")"; ;; - skipped_pkg) : $((BUILD_NSKIP+=1)); - ex_rtl_log_msg vnfo "$(printf "[%03d/%03d] Skipping finished package \`%s.'" "${4}" "${5}" "${_pkg_name}")"; ;; step_pkg) ex_rtl_log_msg vucc "$(printf "Finished build step %s of package \`%s'." "${4}" "${_pkg_name}")"; ;; # Child process exec_finish) ;; exec_missing) ex_rtl_log_msg failexit "Error: package \`${_pkg_name}' missing in build.vars."; ;; exec_start) if [ "${PKG_NO_LOG_VARS:-0}" -eq 0 ]; then - ex_rtl_log_env_vars "build" \ - $(set | awk -F= '/^PKG_/{print $1}' | sort); + ex_rtl_log_env_vars "build" $(set | awk -F= '/^PKG_/{print $1}' | sort); fi; if [ "${ARG_VERBOSE:-0}" -ge 3 ]; then set -o xtrace; @@ -88,7 +86,7 @@ buildp_dispatch() { esac; return 0; }; -cd "$(dirname "${0}")"; +set +o errexit -o noglob; cd "$(dirname "${0}")"; for __ in $(find subr -name *.subr); do . "${__}"; done; buildp_dispatch start_build "${@}"; @@ -2,7 +2,7 @@ IRC channel #midipix on Freenode and ask for the address of the internal repositories. > N.B. If in doubt, consult the fault-tolerant & highly optimised 3D laser show-equipped -usage screen w/ ./build.sh -h or a hungry lion may eat you alive. +usage screen w/ ./build.sh -h or a hungry lion might eat you alive. A Midipix distribution consists of the following: * the native Midipix toolchain, consisting of perk, gcc, its dependencies, diff --git a/etc/build.usage b/etc/build.usage index ee7f249d..da58fcc9 100644 --- a/etc/build.usage +++ b/etc/build.usage @@ -29,10 +29,9 @@ usage: ./build.sh [-a nt32|nt64] [-b debug|release] [-C dir[,..]] [-D kind[,..]] Currently defined steps are: fetch_wget, fetch_git, fetch_extract, - configure_patch_pre, configure_autotools, configure_patch, - configure, build, install_subdirs, install_make, - install_files, install_libs, install_pkgconfig, install_purge_la, - install_strip, install, and install_rpm. + configure_patch_pre, configure_autotools, configure_patch, configure, + build, + install_subdirs, install_make, install_files, install_libs, install, and install_rpm. -R Ignore build failures, skip printing package logs, and continue building (relaxed mode.) -v[v[v[v]]] Be verbose; -vv: always print package logs; -vvv: set xtrace during package builds; -vvvv: logs fileops. diff --git a/vars/busybox/busyboxconfig b/etc/busyboxconfig index 8ab89eb5..8ab89eb5 100644 --- a/vars/busybox/busyboxconfig +++ b/etc/busyboxconfig diff --git a/etc/package.spec b/etc/package.spec new file mode 100644 index 00000000..c1dcac57 --- /dev/null +++ b/etc/package.spec @@ -0,0 +1,25 @@ +Name: %{pkg_name} +Version: %{pkg_version_rpm} +Release: 1 +Summary: %{pkg_name} %{pkg_version_full} +License: Unknown +Group: Applications +Url: %{pkg_url} + +%description +%{pkg_name} %{pkg_version_full} + +%prep +%build +%install +rm -rf "${RPM_BUILD_ROOT}" +mkdir -p "${RPM_BUILD_ROOT}" +cp -pPr "%{pkg_destdir}/." "${RPM_BUILD_ROOT}" + +%post +%postun +%files +/ + +%changelog + diff --git a/groups/010.host_deps.group b/groups/010.host_deps.group index 07690401..c473b1f3 100644 --- a/groups/010.host_deps.group +++ b/groups/010.host_deps.group @@ -40,7 +40,7 @@ HOST_DEPS_PREFIX="${PREFIX}"; : ${PKG_BZIP2_HOST_MAKEFLAGS_BUILD_EXTRA:=-f Makefile-libbz2_so}; : ${PKG_BZIP2_HOST_MAKE_INSTALL_VNAME:=PREFIX}; : ${PKG_CHAINPORT_HOST_URLS_GIT:="chainport=${DEFAULT_GITROOT}/ports/chainport"}; -: ${PKG_CHAINPORT_HOST_BUILD_STEPS_DISABLE:=build}; +: ${PKG_CHAINPORT_HOST_BUILD_STEPS_DISABLE:="build"}; : ${PKG_CHAINPORT_HOST_NO_LOG_VARS:=1}; : ${PKG_CHAINPORT_HOST_PREFIX:=${PREFIX}}; : ${PKG_CLANG_HOST_DEPENDS:="llvm_host"}; diff --git a/subr/build_init.subr b/subr/build_init.subr index 78b2982f..870128ba 100644 --- a/subr/build_init.subr +++ b/subr/build_init.subr @@ -56,7 +56,7 @@ buildp_init_args() { }; buildp_init_clean_prefix() { - if ex_rtl_lmatch "${ARG_CLEAN_BUILDS}" , prefix; then + if ex_rtl_lmatch "${ARG_CLEAN_BUILDS}" "prefix" ","; then ex_rtl_log_msg info "-C prefix specified, cleaning prefix..."; for _pname in ${DEFAULT_CLEAR_PREFIX_PATHS}; do ex_rtl_fileop rm "${PREFIX}/${_pname}"; @@ -96,12 +96,12 @@ buildp_init_exec() { buildp_init_files() { local _log_last_fname="" _log_last_ts="" _rc=0; _status="" - ex_rtl_fileop mkdir "${BUILD_DLCACHEDIR}" "${BUILD_WORKDIR}"; - if ex_rtl_lmatch "${ARG_DIST}" , rpm; then - ex_rtl_fileop mkdir "${PREFIX_RPM}"; - fi; - if [ -e "${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}" ]; then - _rc=13; _status="Error: another build targeting this architecture and build type is currently in progress."; + if ! ex_rtl_fileop mkdir "${BUILD_DLCACHEDIR}" "${BUILD_WORKDIR}"\ + || ex_rtl_lmatch "${ARG_DIST}" "rpm" ","\ + && ! ex_rtl_fileop mkdir "${PREFIX_RPM}"; then + _rc=13; _status="Error: cannot create build directories."; + elif [ -e "${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}" ]; then + _rc=14; _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 @@ -168,7 +168,7 @@ buildp_init_prereqs() { pgrep pkill printf readlink rm sed seq sha256sum \ sort stat tail tar test touch tr wget xz zip; do if ! which "${_cmd}" >/dev/null 2>&1; then - _cmds_missing="${_cmds_missing:+${_cmds_missing} }${_cmd}"; + _cmds_missing="$(ex_rtl_lconcat "${_cmds_missing}" "${_cmd}")"; fi; done; if [ -n "${_cmds_missing}" ]; then diff --git a/subr/ex_pkg_dispatch.subr b/subr/ex_pkg_dispatch.subr index a0131560..0a2a80ff 100644 --- a/subr/ex_pkg_dispatch.subr +++ b/subr/ex_pkg_dispatch.subr @@ -1,18 +1,25 @@ # -# set -o noglob is assumed. -# WARNING: ex_pkg_dispatch(), its caller, and its callers must _NOT_ be executed -# as part of conditional evaluation, e.g. if, until, while, !, or && and ||, as -# doing so would inhibit set -o errexit during execution of this function and its -# subshell(!). Instead, call ex_pkg_dispatch() and subsequently evaluate ${?}. +# set +o errexit -o noglob is assumed. # +# +# exp_pkg_check_depends() - check single named package for unsatisfied dependencies +# @_pkg_complete: list of completed packages +# @_pkg_name: single package name +# @_pkg_wait: list of in-progress packages +# @_restart_recursive: optional flag specifiying either no dependency expansion (0,) dependency expansion (1,) dependency expansion and forcibly rebuild (2.) +# +# Return: zero (0) given no outstanding dependencies, non-zero (>0) otherwise +# exp_pkg_check_depends() { - local _group_name="${1}" _pkg_depends="${2}" _pkg_name="${3}" _dependfl=0; - if ! [ -n "${_restart}" ]\ - || [ "${ARG_RESTART_RECURSIVE:-0}" -ge 1 ]; then + local _pkg_complete="${1}" _pkg_name="${2}" _pkg_wait="${3}" _restart_recursive="${4}" \ + _pkg_depends="" _pkg_name_depend="" _dependfl=0; + if _pkg_depends="$(exp_pkg_expand_depends $(ex_rtl_get_var_unsafe -u "PKG_"${_pkg_name}"_DEPENDS"))"\ + && [ -n "${_pkg_depends}" ]\ + && ! [ -n "${_restart}" ] || [ "${_restart_recursive:-0}" -ge 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 + if ! ex_rtl_lmatch "${_pkg_complete}" "${_pkg_name_depend}"\ + || ex_rtl_lmatch "${_pkg_wait}" "${_pkg_name_depend}"; then _dependfl=1; break; fi; done; @@ -20,130 +27,166 @@ exp_pkg_check_depends() { return "${_dependfl}"; }; -exp_pkg_dispatch_group() { - local _njob=0 _pkg_depends="" _pkg_name="" _pkg_skipfl=0; - for _njob in $(seq 1 $((${_njobs_max}-${_njobs}))); do - for _pkg_name in ${_pkg_names}; do - _pkg_skipfl=0; - if [ -z "$(ex_rtl_lsearch "${_pkgs_complete}" "${_pkg_name}")" ]\ - && [ -z "$(ex_rtl_lsearch "${_pkgs_wait}" "${_pkg_name}")" ]\ - && _pkg_depends="$(exp_pkg_expand_packages $(ex_rtl_get_var_unsafe "PKG_$(ex_rtl_toupper "${_pkg_name}")_DEPENDS"))"\ - && exp_pkg_check_depends "${_group_name}" "${_pkg_depends}" "${_pkg_name}" \ - && exp_pkg_dispatch_package "${_dispatch_fn}" "${_group_name}" \ - "${_pkg_name}" "${_restart}" "${_restart_at}" \ - "${_stderrout_path}" "${_pipe_path}"; then - _pkgs_found_new="${_pkgs_found_new:+${_pkgs_found_new} }${_pkg_name}"; - break; - elif [ "${_pkg_skipfl:-0}" -eq 1 ]; then - _pkgs_found_new="${_pkgs_found_new:+${_pkgs_found_new} }${_pkg_name}"; - continue; - fi; - done; - done; -}; - +# +# exp_pkg_dispatch_package() - dispatch single named packages +# @_dispatch_fn: top-level dispatch function name +# @_group_name: build group name +# @_pkg_name: single package name +# @_restart_at: optional comma-separated list of build steps at which to rebuild or ALL +# +# Return: zero (0) on success, non-zero (>0) on failure, ${NJOBS}, ${PKG_COUNT}, ${PKG_NAMES}, and ${PKG_WAIT} may be mutated post-return. +# exp_pkg_dispatch_package() { - local _dispatch_fn="${1}" _group_name="${2}" _pkg_name="${3}" _restart="${4}" _restart_at="${5}" \ - _stderrout_path="${6}" _pipe_path="${7}" _pkg_name_uc="" _rc=0; - _pkg_name_uc="$(ex_rtl_toupper "${_pkg_name}")"; - if [ -n "$(ex_rtl_get_var_unsafe PKG_${_pkg_name_uc}_DISABLED)" ]; then - _pkgs_complete="${_pkgs_complete:+${_pkgs_complete} }${_pkg_name}"; - _pkg_names="$(ex_rtl_lfilter "${_pkg_names}" "${_pkg_name}")"; - : $((_pkgs_count+=1)); _pkg_skipfl=1; _rc=1; - "${_dispatch_fn}" disabled_pkg "${_group_name}" "${_pkg_name}" "${_pkgs_count}" "${_pkgs_count_max}"; - elif ex_pkg_state_test "${_pkg_name}" finish\ - && [ -z "$(ex_rtl_lsearch "${_restart}" "${_pkg_name}")" ]\ - && [ "${ARG_RESTART_RECURSIVE:-0}" -ne 2 ]; then - _pkgs_complete="${_pkgs_complete:+${_pkgs_complete} }${_pkg_name}"; - _pkg_names="$(ex_rtl_lfilter "${_pkg_names}" "${_pkg_name}")"; - : $((_pkgs_count+=1)); _pkg_skipfl=1; _rc=1; - "${_dispatch_fn}" skipped_pkg "${_group_name}" "${_pkg_name}" "${_pkgs_count}" "${_pkgs_count_max}"; + local _dispatch_fn="${1}" _group_name="${2}" _pkg_name="${3}" _restart_at="${4}"; + if "${_dispatch_fn}" start_pkg "${_group_name}" "${_pkg_name}" "$((${PKG_COUNT}+1))" "${PKG_COUNT_MAX}"; then + : $((NJOBS+=1)); : $((PKG_COUNT+=1)); PKG_WAIT="$(ex_rtl_lconcat "${PKG_WAIT}" "${_pkg_name}")"; + (set +o errexit -o noglob; BUILD_IS_PARENT=0; + if ex_pkg_env "${_group_name}" "${_pkg_name}" "${_restart_at}"; then + ex_pkg_exec "${_dispatch_fn}" "${_group_name}" "${_pkg_name}" "${_restart_at}"; + else + return "${?}"; + fi;) 1>"${BUILD_WORKDIR}/${_pkg_name}_stderrout.log" 2>&1 3>"${_pipe_path}" & else - : $((_pkgs_count+=1)); _pkgs_wait="${_pkgs_wait:+${_pkgs_wait} }${_pkg_name}"; - _stderrout_path="${BUILD_WORKDIR}/${_pkg_name}_stderrout.log"; - "${_dispatch_fn}" start_pkg "${_group_name}" "${_pkg_name}" "${_pkgs_count}" "${_pkgs_count_max}"; - (set -o errexit -o noglob; BUILD_IS_PARENT=0; - ex_pkg_env "${_group_name}" "${_pkg_name}" "${_restart_at}"; - ex_pkg_exec "${_group_name}" "${_pkg_name}" "${_restart_at}" \ - "${_dispatch_fn}";) 1>"${_stderrout_path}" 2>&1 3>"${_pipe_path}" & - : $((_njobs+=1)); + return "${?}"; fi; - return "${_rc}"; }; -exp_pkg_expand_packages() { +# +# exp_pkg_dispatch_packages() - dispatch set of packages +# @_dispatch_fn: top-level dispatch function name +# @_group_name: build group name +# @_njobs_max: maximum count of simultaneous jobs +# @_pipe_path: pathname to parent-child process FIFO +# @_pkg_complete: list of completed packages +# @_restart_at: optional comma-separated list of build steps at which to rebuild or ALL +# @_restart_recursive: optional flag specifiying either no dependency expansion (0,) dependency expansion (1,) dependency expansion and forcibly rebuild (2.) +# +# Return: zero (0) on success, non-zero (>0) on failure, ${NJOBS}, ${PKG_COUNT}, ${PKG_NAMES}, and ${PKG_WAIT} may be mutated post-return. +# +exp_pkg_dispatch_packages() { + local _dispatch_fn="${1}" _group_name="${2}" _njobs_max="${3}" _pipe_path="${4}" \ + _pkg_complete="${5}" _restart_at="${6}" _restart_recursive="${7}" \ + _njob=0 _pkg_depends="" _pkg_name=""; + for _njob in $(seq 1 $((${_njobs_max}-${NJOBS}))); do + for _pkg_name in ${PKG_NAMES}; do + if ! ex_rtl_lmatch "${_pkg_complete}" "${_pkg_name}"\ + && ! ex_rtl_lmatch "${PKG_WAIT}" "${_pkg_name}"\ + && exp_pkg_check_depends "${_pkg_complete}" "${_pkg_name}" "${PKG_WAIT}" "${_restart_recursive}"; then + exp_pkg_dispatch_package "${_dispatch_fn}" "${_group_name}" "${_pkg_name}" "${_restart_at}"; break; + fi; + done; + done; +}; + +# +# exp_pkg_expand_depends() - expand list of package names to amended and ordered list according to dependency constraints +# @${@}: list of package names +# +# Return: zero (0) on success, non-zero (>0) on failure, list of packages on stdout +# +exp_pkg_expand_depends() { local _pkg_depends="" _pkg_name="" _pkg_names=""; for _pkg_name in "${@}"; do - _pkg_depends="$(ex_rtl_get_var_unsafe "PKG_$(ex_rtl_toupper "${_pkg_name}")_DEPENDS")"; - if [ -n "${_pkg_depends}" ]; then - _pkg_depends="$(exp_pkg_expand_packages ${_pkg_depends})"; - _pkg_names="${_pkg_names:+${_pkg_names} }${_pkg_depends} ${_pkg_name}"; - else - _pkg_names="${_pkg_names:+${_pkg_names} }${_pkg_name}"; + if _pkg_depends="$(ex_rtl_get_var_unsafe -u "PKG_${_pkg_name}_DEPENDS")"\ + && [ -n "${_pkg_depends}" ]; then + _pkg_depends="$(exp_pkg_expand_depends ${_pkg_depends})"; + _pkg_names="$(ex_rtl_lconcat "${_pkg_names}" "${_pkg_depends}")"; fi; + _pkg_names="$(ex_rtl_lconcat "${_pkg_names}" "${_pkg_name}")"; done; echo "${_pkg_names}"; }; -exp_pkg_get_packages() { - local _dispatch_fn="${1}" _group_name="${2}" _restart="${3}" _group_name_uc=""; - _group_name_uc="$(ex_rtl_toupper "${_group_name}")"; - _pkg_names="$(ex_rtl_get_var_unsafe ${_group_name_uc}_PACKAGES)"; - if [ -n "${_restart}" ]\ - && ! ex_rtl_lmatch "ALL LAST" " " "${_restart}"; then - _pkg_names="$(ex_rtl_lsearch "${_pkg_names}" "${_restart}")"; - fi; - if ! [ -n "${_restart}" ]\ - || [ "${ARG_RESTART_RECURSIVE:-0}" -ge 1 ]; then - ex_rtl_log_msg vnfo "Resolving \`${_group_name}' dependencies..."; - _pkg_names="$(ex_rtl_uniq $(exp_pkg_expand_packages ${_pkg_names}))"; - ex_rtl_log_msg vnfo "Resolved \`${_group_name}' dependencies."; +# +# exp_pkg_expand_packages() - expand build group name to list of packages ordered and filtered according to dependency and restart constraints +# @_group_name: build group name +# @_restart: optional comma-separated list of package names to rebuild +# @_restart_recursive: optional flag specifiying either no dependency expansion (0,) dependency expansion (1,) dependency expansion and forcibly rebuild (2.) +# +# Return: zero (0) on success, non-zero (>0) on failure, ${EX_PKG_NSKIPPED}, ${EX_PKG_NAMES}, and ${PKG_COMPLETE} set post-return. +# +exp_pkg_expand_packages() { + local _group_name="${1}" _restart="${2}" _restart_recursive="${3}" _pkg_name="" _pkg_names=""; + if _pkg_names="$(ex_rtl_get_var_unsafe -u "${_group_name}_PACKAGES")"\ + && [ -n "${_pkg_names}" ]; then + if [ -n "${_restart}" ] && ! ex_rtl_lmatch "${_restart}" "ALL LAST"; then + _pkg_names="$(ex_rtl_lsearch "${_pkg_names}" "${_restart}")"; + fi; + if ! [ -n "${_restart}" ] || [ "${_restart_recursive:-0}" -ge 1 ]; then + _pkg_names="$(ex_rtl_uniq $(exp_pkg_expand_depends ${_pkg_names}))"; + fi; + for _pkg_name in ${_pkg_names}; do + if [ -n "$(ex_rtl_get_var_unsafe -u "PKG_${_pkg_name}_DISABLED")" ]; then + PKG_COMPLETE="$(ex_rtl_lconcat "${PKG_COMPLETE}" "${_pkg_name}")"; + : $((EX_PKG_NSKIPPED+=1)); _pkg_names="$(ex_rtl_lfilter "${_pkg_names}" "${_pkg_name}")"; + elif ex_pkg_state_test "${_pkg_name}" finish\ + && ! ex_rtl_lmatch "${_restart}" "${_pkg_name}"\ + && [ "${_restart_recursive:-0}" -ne 2 ]; then + PKG_COMPLETE="$(ex_rtl_lconcat "${PKG_COMPLETE}" "${_pkg_name}")"; + : $((EX_PKG_NSKIPPED+=1)); _pkg_names="$(ex_rtl_lfilter "${_pkg_names}" "${_pkg_name}")"; + fi; + done; + EX_PKG_NAMES="${_pkg_names}"; return 0; fi; }; +# +# ex_pkg_dispatch() - dispatch a single build group +# @_dispatch_fn: top-level dispatch function name +# @_group_name: build group name +# @_njobs_max: maximum count of simultaneous jobs +# @_restart: optional comma-separated list of package names to rebuild +# @_restart_at: optional comma-separated list of build steps at which to rebuild or ALL +# @_restart_recursive: optional flag specifiying either no dependency expansion (0,) dependency expansion (1,) dependency expansion and forcibly rebuild (2.) +# +# Return: zero (0) on success, non-zero (>0) on failure, ${EX_PKG_NAMES} and ${EX_PKG_NSKIPPED} set post-return. +# ex_pkg_dispatch() { - local _group_name="${1}" _restart="${2}" _restart_at="${3}" _dispatch_fn="${4}" _pkgs_found_vname="${5}" \ - _njob="" _njobs=0 _njobs_max=1 _pipe_msg="" _pipe_path="${BUILD_WORKDIR}/build.fifo" \ - _pkg_name="" _pkg_names="" _pkgs_complete="" _pkgs_count=0 _pkgs_count_max=0 _pkgs_found="" \ - _pkgs_found_new="" _pkgs_wait="" _script_rc=0 _stderrout_path=""; - "${_dispatch_fn}" start_group "${_group_name}" ""; ex_rtl_fileop mkdir "${BUILD_WORKDIR}"; - if exp_pkg_get_packages "${_dispatch_fn}" "${_group_name}" "${_restart}"\ - && [ -n "${_pkg_names}" ]; then - for _pkg_name in ${_pkg_names}; do - : $((_pkgs_count_max+=1)); - done; - if [ "${ARG_PARALLEL:-0}" -gt 1 ]; then - _njobs_max="${DEFAULT_BUILD_CPUS}"; - fi; - ex_rtl_fileop mkfifo "${_pipe_path}"; exp_pkg_dispatch_group; - while [ "${_njobs:-0}" -gt 0 ]; do - while read _pipe_msg; do - case "${_pipe_msg%% *}" in - done) "${_dispatch_fn}" finish_pkg ${_pipe_msg#done }; - : $((_njobs-=1)); _pkg_name="${_pipe_msg#done * }"; - _pkgs_complete="${_pkgs_complete:+${_pkgs_complete} }${_pkg_name}"; - _pkg_names="$(ex_rtl_lfilter "${_pkg_names}" "${_pkg_name}")"; - _pkgs_wait="$(ex_rtl_lfilter "${_pkgs_wait}" "${_pkg_name}")"; - if [ "${_script_rc:-0}" -eq 0 ]; then - exp_pkg_dispatch_group; - fi; - if [ "${_njobs}" -eq 0 ]\ - && [ -z "${_pkg_names}" ]; then + local _dispatch_fn="${1}" _group_name="${2}" _njobs_max="${3}" _restart="${4}" _restart_at="${5}" \ + _restart_recursive="${6}" _pipe_msg="" _pipe_path="${BUILD_WORKDIR}/build.fifo" _pkg_name="" \ + _script_rc=0 NJOBS=0 PKG_COMPLETE="" PKG_COUNT=0 PKG_COUNT_MAX=0 PKG_NAMES="" PKG_WAIT=""; EX_PKG_NSKIPPED=0; EX_PKG_NAMES=""; + if "${_dispatch_fn}" start_group "${_group_name}" ""; then + if ex_rtl_fileop mkdir "${BUILD_WORKDIR}"\ + && ex_rtl_log_msg vnfo "Resolving \`${_group_name}' dependencies..."\ + && exp_pkg_expand_packages "${_group_name}" "${_restart}" "${_restart_recursive}"\ + && ex_rtl_log_msg vnfo "Resolved \`${_group_name}' dependencies."\ + && PKG_COUNT_MAX="$(ex_rtl_llength "${EX_PKG_NAMES}")"\ + && [ "${PKG_COUNT_MAX}" -gt 0 ]; then + PKG_NAMES="${EX_PKG_NAMES}"; ex_rtl_fileop mkfifo "${_pipe_path}"; + while true; do + while [ "${NJOBS:-0}" -gt 0 ] && read _pipe_msg; do + case "${_pipe_msg%% *}" in + done) : $((NJOBS-=1)); _pkg_name="${_pipe_msg#done * }"; + "${_dispatch_fn}" finish_pkg ${_pipe_msg#done }; + PKG_COMPLETE="$(ex_rtl_lconcat "${PKG_COMPLETE}" "${_pkg_name}")"; + PKG_NAMES="$(ex_rtl_lfilter "${PKG_NAMES}" "${_pkg_name}")"; + PKG_WAIT="$(ex_rtl_lfilter "${PKG_WAIT}" "${_pkg_name}")"; + if [ -n "${PKG_NAMES}" ] && [ "${_script_rc}" -eq 0 ]; then + if [ "${NJOBS}" -ne "${_njobs_max}" ]; then + exp_pkg_dispatch_packages "${_dispatch_fn}" "${_group_name}" "${_njobs_max}" \ + "${_pipe_path}" "${PKG_COMPLETE}" "${_restart_at}" "${_restart_recursive}"; + fi; + elif [ "${NJOBS:-0}" -eq 0 ]; then + break; + fi; ;; + fail) : $((NJOBS-=1)); _script_rc=1; + "${_dispatch_fn}" fail_pkg ${_pipe_msg#fail }; ;; + step) "${_dispatch_fn}" step_pkg ${_pipe_msg#step }; ;; + esac; done <>"${_pipe_path}"; + if [ -n "${PKG_NAMES}" ] && [ "${_script_rc}" -eq 0 ]; then + if [ "${NJOBS}" -ne "${_njobs_max}" ]; then + exp_pkg_dispatch_packages "${_dispatch_fn}" "${_group_name}" "${_njobs_max}" \ + "${_pipe_path}" "${PKG_COMPLETE}" "${_restart_at}" "${_restart_recursive}"; + fi; + elif [ "${NJOBS:-0}" -eq 0 ]; then break; - fi; ;; - 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}"; - done; - ex_rtl_fileop rm "${_pipe_path}"; - fi; - "${_dispatch_fn}" finish_group "${_group_name}" ""; - if [ -n "${_pkgs_found_vname}" ]; then - _pkgs_found="$(ex_rtl_get_var_unsafe "${_pkgs_found_vname}")"; - ex_rtl_set_var_unsafe "${_pkgs_found_vname}" "${_pkgs_found:+${_pkgs_found} }${_pkgs_found_new}"; + fi; + done; + ex_rtl_fileop rm "${_pipe_path}"; + fi; + "${_dispatch_fn}" finish_group "${_group_name}" ""; fi; return "${_script_rc}"; }; -# vim:filetype=sh +# vim:filetype=sh textwidth=0 diff --git a/subr/ex_pkg_env.subr b/subr/ex_pkg_env.subr index ef2166c2..e92f5e45 100644 --- a/subr/ex_pkg_env.subr +++ b/subr/ex_pkg_env.subr @@ -1,49 +1,20 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # -exp_pkg_env_source() { - local _group_name="${1}" _pkg_name="${2}" \ - _group_name_uc="" _pkg_name_uc="" _pkg_name_inherit_uc="" \ - _build_type_uc="" _vname_dst="" _vars_set=""; - ex_rtl_fileop source_opt "vars/${_pkg_name}.vars"; - _group_name_uc="$(ex_rtl_toupper "${_group_name}")"; - _pkg_name_uc="$(ex_rtl_toupper "${_pkg_name}")"; - ex_rtl_set_vars BUILD_TYPE \ - "DEFAULT ${_group_name_uc} PKG_${_pkg_name_uc}" \ - _vars_set; - _build_type_uc="$(ex_rtl_toupper "${PKG_BUILD_TYPE}")"; - ex_rtl_set_vars INHERIT_FROM "PKG_${_pkg_name_uc}" _vars_set; - _pkg_name_inherit_uc="$(ex_rtl_toupper "${PKG_INHERIT_FROM}")"; - for _vname_dst in $(ex_rtl_lfilter \ - "${DEFAULT_BUILD_VARS}" BUILD_TYPE); do - if [ -n "${_pkg_name_inherit_uc}" ]; then - ex_rtl_set_vars "${_vname_dst}" \ - "DEFAULT DEFAULT_${_build_type_uc} \ - ${_group_name_uc} \ - PKG_${_pkg_name_inherit_uc} \ - PKG_${_pkg_name_uc}" _vars_set; - else - ex_rtl_set_vars "${_vname_dst}" \ - "DEFAULT DEFAULT_${_build_type_uc} \ - ${_group_name_uc} PKG_${_pkg_name_uc}" \ - _vars_set; - fi; - done; - ex_rtl_unset_vars $(ex_rtl_lfilter \ - "$(set | awk -F= '/^PKG_/{print $1}' | sort)" \ - "${_vars_set}"); -}; - -ex_pkg_env() { - local _group_name="${1}" _pkg_name="${2}" _restart_at="${3}" _vname=""; - exp_pkg_env_source "${_group_name}" "${_pkg_name}"; +# +# exp_pkg_env_defaults() - set package variable defaults for single named package +# @_pkg_name: single package name +# +# Return: zero (0) on success, non-zero (>0) on failure +# +exp_pkg_env_defaults() { + local _pkg_name="${1}"; : ${PKG_NAME:="${_pkg_name}"}; : ${MIDIPIX_BUILD_PWD:="$(pwd)"}; : ${PKG_BASE_DIR:="${BUILD_WORKDIR}/${_pkg_name}-${PKG_BUILD_TYPE}-${PKG_TARGET}"}; : ${PKG_FNAME:="${PKG_URL##*/}"}; - : ${PKG_BUILD_STEPS:="$(ex_rtl_lfilter "${DEFAULT_BUILD_STEPS}" \ - "${PKG_BUILD_STEPS_DISABLE}")"}; + : ${PKG_BUILD_STEPS:="$(ex_rtl_lfilter "${DEFAULT_BUILD_STEPS}" "${PKG_BUILD_STEPS_DISABLE}")"}; if [ -z "${PKG_SUBDIR}" ]; then if [ -n "${PKG_URLS_GIT}" ]; then PKG_SUBDIR="${PKG_URLS_GIT%%=*}"; @@ -61,12 +32,82 @@ ex_pkg_env() { PKG_BUILD_DIR="${PKG_BASE_DIR}/${PKG_BUILD_DIR}"; PKG_CONFIGURE="${PKG_BASE_DIR}/${PKG_CONFIGURE:-${PKG_SUBDIR}/configure}"; PKG_DESTDIR="${PKG_BASE_DIR}/${PKG_DESTDIR:-destdir}"; +}; + +# +# exp_pkg_env_set() - set package variables for single named package +# @_group_name: build group name +# @_pkg_name: single package name +# +# Sets package variables from either defaults, defaults specific to build type, +# build group, package to inherit from if any, or package for a single named +# package, exports variables optionally named in ${PKG_ENV_VARS_EXTRA}, and +# clears the package variable namespace. +# +# Return: zero (0) on success, non-zero (>0) on failure +# +exp_pkg_env_set() { + local _group_name="${1}" _pkg_name="${2}" _var_prefixes="" _vars_set="" _vname=""; + ex_rtl_set_vars _vars_set BUILD_TYPE "DEFAULT ${_group_name} PKG_${_pkg_name}"; + ex_rtl_set_vars _vars_set INHERIT_FROM "PKG_${_pkg_name}"; + _var_prefixes="$(ex_rtl_toupper "DEFAULT DEFAULT_${PKG_BUILD_TYPE} ${_group_name}")"; + for _vname in $(ex_rtl_lfilter "${DEFAULT_BUILD_VARS}" BUILD_TYPE); do + if [ -n "${PKG_INHERIT_FROM}" ]; then + ex_rtl_set_vars _vars_set "${_vname}" \ + "$(ex_rtl_lconcat "${_var_prefixes}" "$(ex_rtl_toupper "PKG_${PKG_INHERIT_FROM} PKG_${_pkg_name}")")" + else + ex_rtl_set_vars _vars_set "${_vname}" \ + "$(ex_rtl_lconcat "${_var_prefixes}" "$(ex_rtl_toupper "PKG_${_pkg_name}")")"; + fi; + done; ex_rtl_push_IFS :; for _vname in ${PKG_ENV_VARS_EXTRA}; do export "${_vname}"; done; ex_rtl_pop_IFS; + ex_rtl_unset_vars $(ex_rtl_lfilter \ + "$(set | awk -F= '/^PKG_/{print $1}' | sort)" \ + "${_vars_set}"); +}; + +# +# ex_pkg_env() - set package variables for single named package +# @_group_name: build group name +# @_pkg_name: single package name +# @_restart_at: optional comma-separated list of build steps at which to rebuild or ALL +# +# Return: zero (0) on success, non-zero (>0) on failure +# +ex_pkg_env() { + local _group_name="${1}" _pkg_name="${2}" _restart_at="${3}" _vname=""; + ex_rtl_fileop source_opt "vars/${_pkg_name}.vars"; + if ! exp_pkg_env_set "${_group_name}" "${_pkg_name}"\ + || ! exp_pkg_env_defaults "${_pkg_name}"; then + return "${?}"; + fi; +}; + +# +# ex_pkg_state_set() - update build step status for single named package +# @_workdir: pathname to temporary build directory +# @_pkg_name: single package name +# @${@}: list of build steps +# +# Return: zero (0) on success, non-zero (>0) on failure +# +ex_pkg_state_set() { + ex_rtl_state_set "${BUILD_WORKDIR}" "${@}"; }; -ex_pkg_state_set() { ex_rtl_state_set "${BUILD_WORKDIR}" "${@}"; }; -ex_pkg_state_test() { ex_rtl_state_test "${BUILD_WORKDIR}" "${@}"; }; +# +# ex_pkg_state_test() - test build step status of single named package +# @_workdir: pathname to temporary build directory +# @_pkg_name: single package name +# @_build_step: build step to test status of +# @_restart_at: optional comma-separated list of build steps at which to rebuild or ALL +# +# Return: zero (0) on success, non-zero (>0) on failure +# +ex_pkg_state_test() { + ex_rtl_state_test "${BUILD_WORKDIR}" "${@}"; +}; # vim:filetype=sh diff --git a/subr/ex_pkg_exec.subr b/subr/ex_pkg_exec.subr index 0a87b450..2d14a018 100644 --- a/subr/ex_pkg_exec.subr +++ b/subr/ex_pkg_exec.subr @@ -1,7 +1,15 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # +# +# exp_pkg_exec_pre() - XXX +# @_group_name: build group name +# @_pkg_name: single package name +# @_restart_at: optional comma-separated list of build steps at which to rebuild or ALL +# +# Return: zero (0) on success, non-zero (>0) on failure +# exp_pkg_exec_pre() { local _group_name="${1}" _pkg_name="${2}" _restart_at="${3}"; if [ -z "${PKG_URL}" ]\ @@ -11,57 +19,88 @@ exp_pkg_exec_pre() { "${_dispatch_fn}" exec_missing "${_group_name}" "${_pkg_name}"; return 1; elif ! ex_pkg_state_test "${_pkg_name}" "start" "${_restart_at}"; then - if [ "${PKG_NO_CLEAN_BASE_DIR:-0}" -eq 0 ]; then - ex_rtl_fileop rm "${PKG_BASE_DIR}" "${PKG_BUILD_DIR}" "${PKG_DESTDIR}"; - ex_rtl_fileop mkdir "${PKG_BASE_DIR}"; + if [ "${PKG_NO_CLEAN_BASE_DIR:-0}" -eq 0 ]\ + && ! ex_rtl_fileop rm "${PKG_BASE_DIR}" "${PKG_BUILD_DIR}" "${PKG_DESTDIR}"\ + || ! ex_rtl_fileop mkdir "${PKG_BASE_DIR}"; then + return "${?}"; + fi; + if ! ex_rtl_fileop mkdir "${PKG_BUILD_DIR}" "${PKG_DESTDIR}"\ + || ! ex_pkg_state_set "${_pkg_name}" "start"; then + return "${?}"; fi; - ex_rtl_fileop mkdir "${PKG_BUILD_DIR}" "${PKG_DESTDIR}"; - ex_pkg_state_set "${_pkg_name}" "start"; fi; ex_rtl_fileop cd "${PKG_BUILD_DIR}"; }; +# +# exp_pkg_exec_step() - XXX +# @_group_name: build group name +# @_pkg_name: single package name +# @_restart_at: optional comma-separated list of build steps at which to rebuild or ALL +# @_step: build step to execute +# +# Return: zero (0) on success, non-zero (>0) on failure +# +exp_pkg_exec_step() { + local _group_name="${1}" _pkg_name="${2}" _restart_at="${3}" _step="${4}" \ + _fn_name="" _pkg_step_fn="" _rc=0; + if ex_rtl_test_cmd "pkg_${_pkg_name}_${_step}"; then + _pkg_step_fn="pkg_${_pkg_name}_${_step}"; + else + _pkg_step_fn="pkg_${_step}"; + fi; + for _fn_name in \ + "pkg_${_pkg_name}_${_step}_pre" \ + "${_pkg_step_fn}" \ + "pkg_${_pkg_name}_${_step}_post"; do + if ex_rtl_test_cmd "${_fn_name}"\ + && ! "${_fn_name}" "${_group_name}" "${_pkg_name}" "${_restart_at}"; then + _rc=1; break; + fi; + done; + return "${_rc}"; +}; + +# +# exp_pkg_exec() - XXX +# @_dispatch_fn: top-level dispatch function name +# @_group_name: build group name +# @_pkg_name: single package name +# @_restart_at: optional comma-separated list of build steps at which to rebuild or ALL +# +# Return: zero (0) on success, non-zero (>0) on failure +# ex_pkg_exec() { - local _group_name="${1}" _pkg_name="${2}" _restart_at="${3}" \ - _step="" _step_cmd="" _step_cmd_pfx="" _step_rc=""; - trap "if [ \${?} -eq 0 ]; then \ - echo \"done ${_group_name} ${_pkg_name}\" >&3; \ - else \ - echo \"fail ${_group_name} ${_pkg_name}\" >&3; \ - pkill -U "${$}"; \ + local _dispatch_fn="${1}" _group_name="${2}" _pkg_name="${3}" _restart_at="${4}" \ + _rc=0 _step="" _step_next=""; + trap "if [ \${?} -eq 0 ]; then \ + echo \"done ${_group_name} ${_pkg_name}\" >&3; \ + else \ + echo \"fail ${_group_name} ${_pkg_name}\" >&3; \ + pkill -U "${$}"; \ fi;" EXIT HUP INT TERM USR1 USR2; - exp_pkg_exec_pre "${_group_name}" "${_pkg_name}" "${_restart_at}"; - "${_dispatch_fn}" exec_start "${_group_name}" "${_pkg_name}"; - if ex_rtl_test_cmd "pkg_${_pkg_name}_all"; then - "pkg_${_pkg_name}_all" "${_restart_at}"; - else set -- ${PKG_BUILD_STEPS}; - while [ ${#} -gt 0 ]; do - _step="${1}"; shift; - if ex_pkg_state_test "${_pkg_name}" "${_step}" \ - "${_restart_at}"; then - continue; - else ex_rtl_try_run \ - "pkg_${_pkg_name}_${_step}_pre" \ - "${_group_name}" "${_pkg_name}" "${_restart_at}"; - if ex_rtl_test_cmd "pkg_${_pkg_name}_${_step}"; then - ex_rtl_try_run "pkg_${_pkg_name}_${_step}" \ - "${_group_name}" "${_pkg_name}" "${_restart_at}"; + if exp_pkg_exec_pre "${_group_name}" "${_pkg_name}" "${_restart_at}"\ + && "${_dispatch_fn}" exec_start "${_group_name}" "${_pkg_name}"; then + if ex_rtl_test_cmd "pkg_${_pkg_name}_all"; then + "pkg_${_pkg_name}_all" "${_restart_at}"; + else set -- ${PKG_BUILD_STEPS}; + while [ ${#} -gt 0 ]; do + _step="${1}"; _step_next="${2}"; shift; + if ex_pkg_state_test "${_pkg_name}" "${_step}" "${_restart_at}"; then + continue; + elif ! exp_pkg_exec_step "${_group_name}" "${_pkg_name}" "${_restart_at}" "${_step}"; then + _rc=1; break; else - ex_rtl_try_run "pkg_${_step}" \ - "${_group_name}" "${_pkg_name}" "${_restart_at}"; + echo "step ${_group_name} ${_pkg_name} ${_step}" >&3; + "${_dispatch_fn}" exec_step "${_group_name}" "${_pkg_name}" "${_step}"; + ex_pkg_state_set "${_pkg_name}" "${_step}" "${_step_next:+-${_step_next}}"; fi; - ex_rtl_try_run \ - "pkg_${_pkg_name}_${_step}_post" \ - "${_group_name}" "${_pkg_name}" "${_restart_at}"; - - fi; - echo "step ${_group_name} ${_pkg_name} ${_step}" >&3; - "${_dispatch_fn}" exec_step "${_group_name}" "${_pkg_name}" "${_step}"; - ex_pkg_state_set "${_pkg_name}" "${_step}" "${1:+-${1}}"; - done; + done; + fi; + "${_dispatch_fn}" exec_finish "${_group_name}" "${_pkg_name}"; + ex_pkg_state_set "${_pkg_name}" finish; fi; - "${_dispatch_fn}" exec_finish "${_group_name}" "${_pkg_name}"; - ex_pkg_state_set "${_pkg_name}" finish; + return "${_rc}"; }; # vim:filetype=sh diff --git a/subr/ex_rtl.subr b/subr/ex_rtl.subr index e751759b..1c48bb00 100644 --- a/subr/ex_rtl.subr +++ b/subr/ex_rtl.subr @@ -1,5 +1,5 @@ # -# set -o noglob is assumed. +# set +o errexit -o noglob is assumed. # EXP_RTL_IFS="${IFS}"; @@ -7,13 +7,10 @@ EXP_RTL_IFS="${IFS}"; ex_rtl_basename() { echo "${1##*/}"; }; ex_rtl_date() { command date "+${1:-${DEFAULT_TIMESTAMP_FMT}}"; }; ex_rtl_dirname() { echo "${1%/*}"; }; -ex_rtl_get_var_unsafe() { eval echo \${${1}}; }; ex_rtl_pop_IFS() { IFS="${EXP_RTL_IFS}"; }; ex_rtl_push_IFS() { EXP_RTL_IFS="${IFS}"; IFS="${1}"; }; -ex_rtl_try_run() { if ex_rtl_test_cmd "${1}"; then "${@}"; fi; }; ex_rtl_set_var_unsafe() { [ -n "${2}" ] && eval ${1}=\"${2}\" || return 0; }; ex_rtl_test_cmd() { command -v "${1}" >/dev/null; }; -ex_rtl_toupper() { echo "${1}" | tr a-z A-Z; }; ex_rtl_uniq() { echo "${@}" | sed 's/ /\n/g' | awk '!x[$0]++' | paste -s -d" "; }; ex_rtl_unset_vars() { while [ ${#} -gt 0 ]; do unset "${1}"; shift; done; }; diff --git a/subr/ex_rtl_complex.subr b/subr/ex_rtl_complex.subr index 869cbba7..682a950e 100644 --- a/subr/ex_rtl_complex.subr +++ b/subr/ex_rtl_complex.subr @@ -1,5 +1,5 @@ # -# set -o noglob is assumed. +# set +o errexit -o noglob is assumed. # ex_rtl_check_path_vars() { @@ -27,56 +27,61 @@ ex_rtl_clean_env() { ex_rtl_unset_vars $(ex_rtl_lfilter "${_env_vars}" "${_env_vars_except}"); }; -ex_rtl_kill_tree() { - local _pid="${1}" _signal="TERM" _pid_child="" _pid_top=""; - for _pid_top in $(pgrep -P "${_pid}"); do - for _pid_child in $(pgrep -P "${_pid_top}" 2>/dev/null); do - _pids_killed="${_pids_killed:+${_pids_killed} }${_pid_child}"; kill "-${_signal}" "${_pid_child}" 2>/dev/null; - done; - _pids_killed="${_pids_killed:+${_pids_killed} }${_pid_top}"; kill "-${_signal}" "${_pid_top}" 2>/dev/null; - done; +ex_rtl_exists_any() { + local _subdir="${1}"; shift; + while [ "${#}" -gt 0 ]; do + if [ -e "${_subdir}/${1}" ]; then + return 0; + else + shift; + fi; + done; return 1; }; -ex_rtl_lfilter() { - local _list="${1}" _filter="${2}" _lnew="" _litem="" _litem_filter="" _filterfl=""; - if [ -z "${_filter}" ]; then - echo "${_list}"; return 0; - else for _litem in ${_list}; do - _filterfl=0; - for _litem_filter in ${_filter}; do - if [ "${_litem_filter}" = "${_litem}" ]; then - _filterfl=1; break; +ex_rtl_export_vars() { + local _unsetfl=0; [ "x${1}" = "x-u" ] && { _unsetfl=1; shift; }; + while [ "${#}" -ge 2 ]; do + if [ -n "${2}" ]; then + if [ "${_unsetfl:-0}" -eq 0 ]; then + ex_rtl_set_var_unsafe "${1}" "${2}"; export "${1}"; + else + unset "${1}"; fi; - done; - if [ "${_filterfl:-0}" -eq 0 ]; then - _lnew="${_lnew:+${_lnew} }${_litem}"; fi; - done; fi; - echo "${_lnew}"; + shift 2; + done; }; -ex_rtl_lmatch() { - local _cmp="${3}" IFS="${2}"; set -- ${1}; - while [ ${#} -gt 0 ]; do - if [ "${1}" = "${_cmp}" ]; then - return 0; - fi; shift; - done; return 1; +ex_rtl_get_var_unsafe() { + local _vname=""; + if [ "x${1}" = "x-u" ]; then + shift; _vname="$(ex_rtl_toupper "${1}")"; + else + _vname="${1}"; + fi; + eval echo \${${_vname}}; }; -ex_rtl_lsearch() { - local _list="${1}" _filter="${2}" _lnew="" _litem="" _litem_filter=""; - if [ -z "${_filter}" ]; then - echo "${_list}"; return 0; - else for _litem in ${_list}; do - for _litem_filter in ${_filter}; do - if [ "${_litem_filter}" = "${_litem}" ]; then - _lnew="${_lnew:+${_lnew} }${_litem}"; - break; - fi; +ex_rtl_head() { + local _pattern="${1}" _s="${2}"; + while true; do + if [ "${_s%%${_pattern}}" = "${_s}" ]; then + break; + else + _s="${_s%%${_pattern}}"; + fi; + done; + echo "${_s}"; +}; + +ex_rtl_kill_tree() { + local _pid="${1}" _signal="TERM" _pid_child="" _pid_top=""; + for _pid_top in $(pgrep -P "${_pid}"); do + for _pid_child in $(pgrep -P "${_pid_top}" 2>/dev/null); do + _pids_killed="${_pids_killed:+${_pids_killed} }${_pid_child}"; kill "-${_signal}" "${_pid_child}" 2>/dev/null; done; - done; fi; - echo "${_lnew}"; + _pids_killed="${_pids_killed:+${_pids_killed} }${_pid_top}"; kill "-${_signal}" "${_pid_top}" 2>/dev/null; + done; }; ex_rtl_run_cmd_unsplit() { @@ -91,10 +96,9 @@ ex_rtl_run_cmd_unsplit() { }; ex_rtl_set_vars() { - local _vname_dst="${1}" _vname_src_tmpls="${2}" \ - _vars_set_vname="${3}" _vname_src _vars_set_tmp="" \ - _vars_set_old=""; - for _vname_src in ${_vname_src_tmpls}; do + local _vars_set_vname="${1}" _vname_dst="${2}" _vname_src_tmpls="${3}" \ + _vars_set_old="" _vars_set_tmp="" _vname_src=""; + for _vname_src in $(ex_rtl_toupper "${_vname_src_tmpls}"); do _vname_src="${_vname_src}_${_vname_dst}"; _vval_src="$(ex_rtl_get_var_unsafe "${_vname_src}")"; if [ -n "${_vval_src}" ]; then @@ -103,7 +107,7 @@ ex_rtl_set_vars() { fi; done; _vars_set_old="$(ex_rtl_get_var_unsafe "${_vars_set_vname}")"; - ex_rtl_set_var_unsafe "${_vars_set_vname}" \ + ex_rtl_set_var_unsafe "${_vars_set_vname}" \ "${_vars_set_old:+${_vars_set_old} }${_vars_set_tmp}"; }; diff --git a/subr/ex_rtl_fetch.subr b/subr/ex_rtl_fetch.subr index 8aaebf66..c4ba862d 100644 --- a/subr/ex_rtl_fetch.subr +++ b/subr/ex_rtl_fetch.subr @@ -1,5 +1,5 @@ # -# set -o noglob is assumed. +# set +o errexit -o noglob is assumed. # exp_rtl_fetch_url_git() { diff --git a/subr/ex_rtl_fileop.subr b/subr/ex_rtl_fileop.subr index 98116644..417ec261 100644 --- a/subr/ex_rtl_fileop.subr +++ b/subr/ex_rtl_fileop.subr @@ -1,102 +1,111 @@ # -# set -o noglob is assumed. +# set +o errexit -o noglob is assumed. # exp_rtl_fileop_check() { local _prefix="${1}" _pname="" _rname=""; shift; - while [ ${#} -gt 0 ]; do + while [ "${#}" -gt 0 ]; do return 0; shift; done; }; ex_rtl_fileop() { - local _op="${1}" _src="" _dst=""; shift; + local _op="${1}" _dst="" _install_args="" _rc=0 _src=""; shift; case "${_op}" in cd) if [ \( -z "${1}" \) -o ! \( -L "${1}" -o -e "${1}" \) ]; then ex_rtl_log_msg failexit "Invalid or non-existent directory \`${1}'."; - else + elif exp_rtl_fileop_check "${PREFIX}" "${1}"; then ex_rtl_log_msg vvvv "Changing working directory to \`${1}'."; - exp_rtl_fileop_check "${PREFIX}" "${1}"; - cd -- "${1}"; + cd -- "${1}"; _rc="${?}"; fi; ;; cp_follow) - if [ ${#} -lt 2 ]; then + if [ "${#}" -lt 2 ]; then ex_rtl_log_msg failexit "Missing parameters (in: cp_follow ${*}.)"; - else + elif exp_rtl_fileop_check "${PREFIX}" "${*}"; then _src="${*}"; _src="${_src% *}"; _dst="${*}"; _dst="${_dst##* }"; ex_rtl_log_msg vvvv "Copying \`${_src}' into \`${_dst}' w/ -pLR."; - exp_rtl_fileop_check "${PREFIX}" "${*}"; - cp -pLR -- "${@}"; + cp -pLR -- "${@}"; _rc="${?}"; fi; ;; - cp) if [ ${#} -lt 2 ]; then + cp) if [ "${#}" -lt 2 ]; then ex_rtl_log_msg failexit "Missing parameters (in: cp ${*}.)"; - else + elif exp_rtl_fileop_check "${PREFIX}" "${*}"; then _src="${*}"; _src="${_src% *}"; _dst="${*}"; _dst="${_dst##* }"; ex_rtl_log_msg vvvv "Copying \`${_src}' into \`${_dst}' w/ -pPR."; - exp_rtl_fileop_check "${PREFIX}" "${*}"; - cp -pPR -- "${@}"; + cp -pPR -- "${@}"; _rc="${?}"; + fi; ;; + install) + if [ "${#}" -lt 2 ]; then + ex_rtl_log_msg failexit "Missing parameters (in: install ${*}.)"; + else _dst="$(while [ ""${#}"" -gt 2 ]; do shift; done; echo "${2}")"; + _install_args="$(while [ ""${#}"" -gt 2 ]; do echo "${1}"; shift; done)"; + _src="$(while [ ""${#}"" -gt 2 ]; do shift; done; echo "${1}")"; + if exp_rtl_fileop_check "${PREFIX}" "${_dst}" "${_src}"; then + ex_rtl_log_msg vvvv "Installing \`${_src}' into \`${_dst}' w/ ${_install_args}."; + install "${@}"; _rc="${?}"; + fi; fi; ;; ln_symbolic) if [ \( -z "${1}" \) -o \( -z "${2}" \) ]; then ex_rtl_log_msg failexit "Missing parameters (in: ln_symbolic ${*}.)"; - else - exp_rtl_fileop_check "${PREFIX}" "${2}"; + elif exp_rtl_fileop_check "${PREFIX}" "${2}"; then if ex_rtl_fileop test "${2}"; then ex_rtl_fileop rm "${2}"; fi; - ex_rtl_log_msg vvvv "Linking \`${1}' to \`${2}' w/ -fs"; - ln -fs -- "${1}" "${2}"; + if [ "${?}" -eq 0 ]; then + ex_rtl_log_msg vvvv "Linking \`${1}' to \`${2}' w/ -fs"; + ln -fs -- "${1}" "${2}"; _rc="${?}"; + fi; fi; ;; mv) if [ \( -z "${1}" \) -o \( -z "${2}" \) ]; then ex_rtl_log_msg failexit "Missing parameters (in: mv ${*}.)"; - else + elif exp_rtl_fileop_check "${PREFIX}" "${1}" "${2}"; then ex_rtl_log_msg vvvv "Moving \`${1}' to \`${2}' w/ -fs"; - exp_rtl_fileop_check "${PREFIX}" "${1}" "${2}"; - mv -f -- "${1}" "${2}"; + mv -f -- "${1}" "${2}"; _rc="${?}"; fi; ;; mkdir|mkfifo|rm|source_opt|test|touch) - while [ ${#} -gt 0 ]; do + while [ \( "${?}" -eq 0 \) -a \( ""${#}"" -gt 0 \) ]; do if [ -z "${1}" ]; then ex_rtl_log_msg failexit "Missing parameters (in: ${_op} ${*}.)"; elif [ "${_op}" = mkdir ]\ - && [ ! -d "${1}" ]; then - exp_rtl_fileop_check "${PREFIX}" "${1}"; + && [ ! -d "${1}" ]\ + && exp_rtl_fileop_check "${PREFIX}" "${1}"; then if ex_rtl_fileop test "${1}"; then ex_rtl_fileop rm "${1}"; fi; ex_rtl_log_msg vvvv "Making directory \`${1}'."; - mkdir -p -- "${1}"; - elif [ "${_op}" = mkfifo ]; then - exp_rtl_fileop_check "${PREFIX}" "${1}"; + mkdir -p -- "${1}"; _rc="${?}"; + elif [ "${_op}" = mkfifo ]\ + && exp_rtl_fileop_check "${PREFIX}" "${1}"; then if ex_rtl_fileop test "${1}"; then ex_rtl_fileop rm "${1}"; fi; ex_rtl_log_msg vvvv "Creating FIFO \`${1}'."; exp_rtl_fileop_check "${PREFIX}" "${1}"; - mkfifo -- "${1}"; + mkfifo -- "${1}"; _rc="${?}"; elif [ "${_op}" = rm ]\ - && ex_rtl_fileop test "${1}"; then + && ex_rtl_fileop test "${1}"\ + && exp_rtl_fileop_check "${PREFIX}" "${1}"; then ex_rtl_log_msg vvvv "Removing directory or file \`${1}'."; - exp_rtl_fileop_check "${PREFIX}" "${1}"; - rm -rf -- "${1}"; + rm -rf -- "${1}"; _rc="${?}"; elif [ "${_op}" = source_opt ]\ - && ex_rtl_fileop test "${1}"; then + && ex_rtl_fileop test "${1}"\ + && exp_rtl_fileop_check "${PREFIX}" "${1}"; then ex_rtl_log_msg vvvv "Sourcing file \`${1}'."; - exp_rtl_fileop_check "${PREFIX}" "${1}"; - . "${1}"; + . "${1}"; _rc="${?}"; elif [ "${_op}" = test ]\ + && exp_rtl_fileop_check "${PREFIX}" "${1}"\ && ! [ \( -L "${1}" \) -o \( -e "${1}" \) ]; then return 1; - elif [ "${_op}" = touch ]; then + elif [ "${_op}" = touch ]\ + && exp_rtl_fileop_check "${PREFIX}" "${1}"; then ex_rtl_log_msg vvvv "Touching file \`${1}'."; - exp_rtl_fileop_check "${PREFIX}" "${1}"; - touch -- "${1}"; + touch -- "${1}"; _rc="${?}"; fi; shift; done; ;; *) ex_rtl_log_msg failexit "Error: ex_rtl_fileop() called w/ invalid parameter(s): ${*}"; ;; - esac; return 0; + esac; return "${_rc}"; }; # vim:filetype=sh diff --git a/subr/ex_rtl_install.subr b/subr/ex_rtl_install.subr index 01d6fac4..742347d7 100644 --- a/subr/ex_rtl_install.subr +++ b/subr/ex_rtl_install.subr @@ -1,5 +1,5 @@ # -# set -o noglob is assumed. +# set +o errexit -o noglob is assumed. # ex_rtl_install() { diff --git a/subr/ex_rtl_list.subr b/subr/ex_rtl_list.subr new file mode 100644 index 00000000..45a641c6 --- /dev/null +++ b/subr/ex_rtl_list.subr @@ -0,0 +1,62 @@ +# +# set +o errexit -o noglob is assumed. +# + +ex_rtl_lconcat() { + local _list="${1}" _litem_new="${2}" _sep="${3:- }" IFS="${3:-${IFS}}"; + if [ -n "${_list}" ]; then + printf "%s%s%s" "${_list}" "${_sep}" "${_litem_new}"; + else + printf "%s" "${_litem_new}"; + fi; +}; + +ex_rtl_lfilter() { + local _list="${1}" _filter="${2}" _sep="${3:- }" IFS="${3:-${IFS}}" \ + _filterfl="" _litem="" _litem_filter="" _lnew=""; + if [ -z "${_filter}" ]; then + echo "${_list}"; return 0; + else for _litem in ${_list}; do + _filterfl=0; + for _litem_filter in ${_filter}; do + if [ "${_litem_filter}" = "${_litem}" ]; then + _filterfl=1; break; + fi; + done; + if [ "${_filterfl:-0}" -eq 0 ]; then + _lnew="${_lnew:+${_lnew}${_sep}}${_litem}"; + fi; + done; fi; + echo "${_lnew}"; +}; + +ex_rtl_llength() { + local _list="${1}" _sep="${2:- }" IFS="${2:-${IFS}}" _litem="" _llength=0; + for _litem in ${_list}; do + : $((_llength+=1)); + done; + echo "${_llength}"; +}; + +ex_rtl_lmatch() { + local _list="${1}" _item="${2}" _sep="${3}"; + [ -n "$(ex_rtl_lsearch "${_list}" "${_item}" "${_sep}")" ]; +}; + +ex_rtl_lsearch() { + local _list="${1}" _filter="${2}" _sep="${3:- }" IFS="${3:-${IFS}}" \ + _litem="" _litem_filter="" _lnew=""; + if [ -z "${_filter}" ]; then + echo "${_list}"; return 0; + else for _litem in ${_list}; do + for _litem_filter in ${_filter}; do + if [ "${_litem_filter}" = "${_litem}" ]; then + _lnew="${_lnew:+${_lnew}${_sep}}${_litem}"; + break; + fi; + done; + done; fi; + echo "${_lnew}"; +}; + +# vim:filetype=sh diff --git a/subr/ex_rtl_log.subr b/subr/ex_rtl_log.subr index 460c899e..514d4636 100644 --- a/subr/ex_rtl_log.subr +++ b/subr/ex_rtl_log.subr @@ -1,5 +1,5 @@ # -# set -o noglob is assumed. +# set +o errexit -o noglob is assumed. # : ${DEFAULT_LOG_MSG_FAIL_COLOUR:=91}; @@ -15,7 +15,9 @@ exp_rtl_log_printf() { local _attrs="${1}" _msg=""; shift; _msg="$(printf "${@}")"; - if [ "${BUILD_IS_PARENT:-0}" -eq 1 ]; then + if [ "${BUILD_IS_PARENT:-0}" -eq 1 ]\ + && [ -n "${DEFAULT_BUILD_LOG_FNAME}" ]\ + && [ -e "${DEFAULT_BUILD_LOG_FNAME}" ]; then printf "%s\n" "${_msg}" >> "${DEFAULT_BUILD_LOG_FNAME}"; fi; printf "\033[0m\033[${_attr}m%s\033[0m\n" "${_msg}"; diff --git a/subr/ex_rtl_state.subr b/subr/ex_rtl_state.subr index 70e72a06..406da477 100644 --- a/subr/ex_rtl_state.subr +++ b/subr/ex_rtl_state.subr @@ -1,5 +1,5 @@ # -# set -o noglob is assumed. +# set +o errexit -o noglob is assumed. # ex_rtl_state_clear() { @@ -33,7 +33,7 @@ ex_rtl_state_test() { elif [ "${_restart_at}" = "ALL" ]; then return 1; else - ! ex_rtl_lmatch "${_restart_at}" , "${_build_step}"; + ! ex_rtl_lmatch "${_restart_at}" "${_build_step}" ","; fi; }; diff --git a/subr/ex_rtl_string.subr b/subr/ex_rtl_string.subr new file mode 100644 index 00000000..703ae1b2 --- /dev/null +++ b/subr/ex_rtl_string.subr @@ -0,0 +1,83 @@ +# +# set +o errexit -o noglob is assumed. +# + +ex_rtl_tolower() { + local _s="${1}" _s_new=""; + while [ -n "${_s}" ]; do + case "${_s}" in + A*) _s_new="${_s_new:+${_s_new}}a"; _s="${_s#A}"; ;; + B*) _s_new="${_s_new:+${_s_new}}b"; _s="${_s#B}"; ;; + C*) _s_new="${_s_new:+${_s_new}}c"; _s="${_s#C}"; ;; + D*) _s_new="${_s_new:+${_s_new}}d"; _s="${_s#D}"; ;; + E*) _s_new="${_s_new:+${_s_new}}e"; _s="${_s#E}"; ;; + F*) _s_new="${_s_new:+${_s_new}}f"; _s="${_s#F}"; ;; + G*) _s_new="${_s_new:+${_s_new}}g"; _s="${_s#G}"; ;; + H*) _s_new="${_s_new:+${_s_new}}h"; _s="${_s#H}"; ;; + I*) _s_new="${_s_new:+${_s_new}}i"; _s="${_s#I}"; ;; + J*) _s_new="${_s_new:+${_s_new}}j"; _s="${_s#J}"; ;; + K*) _s_new="${_s_new:+${_s_new}}k"; _s="${_s#K}"; ;; + L*) _s_new="${_s_new:+${_s_new}}l"; _s="${_s#L}"; ;; + M*) _s_new="${_s_new:+${_s_new}}m"; _s="${_s#M}"; ;; + N*) _s_new="${_s_new:+${_s_new}}n"; _s="${_s#N}"; ;; + O*) _s_new="${_s_new:+${_s_new}}o"; _s="${_s#O}"; ;; + P*) _s_new="${_s_new:+${_s_new}}p"; _s="${_s#P}"; ;; + Q*) _s_new="${_s_new:+${_s_new}}q"; _s="${_s#Q}"; ;; + R*) _s_new="${_s_new:+${_s_new}}r"; _s="${_s#R}"; ;; + S*) _s_new="${_s_new:+${_s_new}}s"; _s="${_s#S}"; ;; + T*) _s_new="${_s_new:+${_s_new}}t"; _s="${_s#T}"; ;; + U*) _s_new="${_s_new:+${_s_new}}u"; _s="${_s#U}"; ;; + V*) _s_new="${_s_new:+${_s_new}}v"; _s="${_s#V}"; ;; + W*) _s_new="${_s_new:+${_s_new}}w"; _s="${_s#W}"; ;; + X*) _s_new="${_s_new:+${_s_new}}x"; _s="${_s#X}"; ;; + Y*) _s_new="${_s_new:+${_s_new}}y"; _s="${_s#Y}"; ;; + Z*) _s_new="${_s_new:+${_s_new}}z"; _s="${_s#Z}"; ;; + [^A-Z]*) + _s_new="${_s_new:+${_s_new}}${_s%%[A-Z]*}"; + while [ "${_s#[^A-Z]}" != "${_s}" ]; do + _s="${_s#[^A-Z]}"; + done; ;; + esac; done; + echo "${_s_new}"; +}; + +ex_rtl_toupper() { + local _s="${1}" _s_new=""; + while [ -n "${_s}" ]; do + case "${_s}" in + a*) _s_new="${_s_new:+${_s_new}}A"; _s="${_s#a}"; ;; + b*) _s_new="${_s_new:+${_s_new}}B"; _s="${_s#b}"; ;; + c*) _s_new="${_s_new:+${_s_new}}C"; _s="${_s#c}"; ;; + d*) _s_new="${_s_new:+${_s_new}}D"; _s="${_s#d}"; ;; + e*) _s_new="${_s_new:+${_s_new}}E"; _s="${_s#e}"; ;; + f*) _s_new="${_s_new:+${_s_new}}F"; _s="${_s#f}"; ;; + g*) _s_new="${_s_new:+${_s_new}}G"; _s="${_s#g}"; ;; + h*) _s_new="${_s_new:+${_s_new}}H"; _s="${_s#h}"; ;; + i*) _s_new="${_s_new:+${_s_new}}I"; _s="${_s#i}"; ;; + j*) _s_new="${_s_new:+${_s_new}}J"; _s="${_s#j}"; ;; + k*) _s_new="${_s_new:+${_s_new}}K"; _s="${_s#k}"; ;; + l*) _s_new="${_s_new:+${_s_new}}L"; _s="${_s#l}"; ;; + m*) _s_new="${_s_new:+${_s_new}}M"; _s="${_s#m}"; ;; + n*) _s_new="${_s_new:+${_s_new}}N"; _s="${_s#n}"; ;; + o*) _s_new="${_s_new:+${_s_new}}O"; _s="${_s#o}"; ;; + p*) _s_new="${_s_new:+${_s_new}}P"; _s="${_s#p}"; ;; + q*) _s_new="${_s_new:+${_s_new}}Q"; _s="${_s#q}"; ;; + r*) _s_new="${_s_new:+${_s_new}}R"; _s="${_s#r}"; ;; + s*) _s_new="${_s_new:+${_s_new}}S"; _s="${_s#s}"; ;; + t*) _s_new="${_s_new:+${_s_new}}T"; _s="${_s#t}"; ;; + u*) _s_new="${_s_new:+${_s_new}}U"; _s="${_s#u}"; ;; + v*) _s_new="${_s_new:+${_s_new}}V"; _s="${_s#v}"; ;; + w*) _s_new="${_s_new:+${_s_new}}W"; _s="${_s#w}"; ;; + x*) _s_new="${_s_new:+${_s_new}}X"; _s="${_s#x}"; ;; + y*) _s_new="${_s_new:+${_s_new}}Y"; _s="${_s#y}"; ;; + z*) _s_new="${_s_new:+${_s_new}}Z"; _s="${_s#z}"; ;; + [^a-z]*) + _s_new="${_s_new:+${_s_new}}${_s%%[a-z]*}"; + while [ "${_s#[^a-z]}" != "${_s}" ]; do + _s="${_s#[^a-z]}"; + done; ;; + esac; done; + echo "${_s_new}"; +}; + +# vim:filetype=sh diff --git a/subr/pkg_build.subr b/subr/pkg_build.subr index 3f1fa270..e7ea6beb 100644 --- a/subr/pkg_build.subr +++ b/subr/pkg_build.subr @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_build() { diff --git a/subr/pkg_clean.subr b/subr/pkg_clean.subr index f9f9a204..40d56540 100644 --- a/subr/pkg_clean.subr +++ b/subr/pkg_clean.subr @@ -1,20 +1,18 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_clean() { - local _dir=""; - if [ -n "${PKG_NO_CLEAN}" ]; then - return 0; - fi; - if ex_rtl_lmatch "${ARG_CLEAN_BUILDS}" , build; then - ex_rtl_fileop rm "${PKG_BUILD_DIR}"; - fi; - if ex_rtl_lmatch "${ARG_CLEAN_BUILDS}" , dest; then - ex_rtl_fileop rm "${PKG_DESTDIR}"; - fi; - if ex_rtl_lmatch "${ARG_CLEAN_BUILDS}" , src; then - ex_rtl_fileop rm "${PKG_BASE_DIR}/${PKG_SUBDIR}"; + if [ "${PKG_NO_CLEAN:-0}" -eq 0 ]; then + if ex_rtl_lmatch "${ARG_CLEAN_BUILDS}" "build" ","; then + ex_rtl_fileop rm "${PKG_BUILD_DIR}" || return "${?}"; + fi; + if ex_rtl_lmatch "${ARG_CLEAN_BUILDS}" "dest" ","; then + ex_rtl_fileop rm "${PKG_DESTDIR}" || return "${?}"; + fi; + if ex_rtl_lmatch "${ARG_CLEAN_BUILDS}" "src" ","; then + ex_rtl_fileop rm "${PKG_BASE_DIR}/${PKG_SUBDIR}" || return "${?}"; + fi; fi; }; diff --git a/subr/pkg_configure.subr b/subr/pkg_configure.subr index de6fd494..0adc7acf 100644 --- a/subr/pkg_configure.subr +++ b/subr/pkg_configure.subr @@ -1,18 +1,11 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_configure() { + local _rc=0; if [ -x "${PKG_CONFIGURE}" ]; then - if [ -n "${PKG_PKG_CONFIG}" ]; then - export PKG_CONFIG="${PKG_PKG_CONFIG}"; - fi; - if [ -n "${PKG_PKG_CONFIG_PATH}" ]; then - export PKG_CONFIG_PATH="${PKG_PKG_CONFIG_PATH}"; - fi; - if [ -n "${PKG_PYTHON}" ]; then - export PYTHON="${PKG_PYTHON}"; - fi; + ex_rtl_export_vars PKG_CONFIG "${PKG_PKG_CONFIG}" PKG_CONFIG_PATH "${PKG_PKG_CONFIG_PATH}" PYTHON "${PKG_PYTHON}"; AR="${PKG_AR}" \ CC="${PKG_CC}" \ RANLIB="${PKG_RANLIB}" \ @@ -20,10 +13,10 @@ pkg_configure() { CPPFLAGS="${PKG_CFLAGS_CONFIGURE}${PKG_CFLAGS_CONFIGURE_EXTRA:+ ${PKG_CFLAGS_CONFIGURE_EXTRA}}" \ CXXFLAGS="${PKG_CXXFLAGS_CONFIGURE}${PKG_CXXFLAGS_CONFIGURE_EXTRA:+ ${PKG_CXXFLAGS_CONFIGURE_EXTRA}}" \ LDFLAGS="${PKG_LDFLAGS_CONFIGURE}${PKG_LDFLAGS_CONFIGURE_EXTRA:+ ${PKG_LDFLAGS_CONFIGURE_EXTRA}}" \ - ${PKG_CONFIGURE} \ - ${PKG_CONFIGURE_ARGS} ${PKG_CONFIGURE_ARGS_EXTRA} ${PKG_CONFIGURE_ARGS_EXTRA_DEBUG}; - unset PKG_CONFIG PKG_CONFIG_PATH PYTHON; + "${PKG_CONFIGURE}" ${PKG_CONFIGURE_ARGS} ${PKG_CONFIGURE_ARGS_EXTRA} ${PKG_CONFIGURE_ARGS_EXTRA_DEBUG}; _rc="${?}" + ex_rtl_export_vars -u PKG_CONFIG "${PKG_PKG_CONFIG}" PKG_CONFIG_PATH "${PKG_PKG_CONFIG_PATH}" PYTHON "${PKG_PYTHON}"; fi; + return "${?}"; }; # vim:filetype=sh diff --git a/subr/pkg_configure_autotools.subr b/subr/pkg_configure_autotools.subr index 01f81ce5..7c1ee329 100644 --- a/subr/pkg_configure_autotools.subr +++ b/subr/pkg_configure_autotools.subr @@ -1,63 +1,51 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_configure_autotools() { - local _script_fname="" _subdir_tgt=""; - if [ -e "${PKG_BASE_DIR}/${PKG_SUBDIR}/configure" -o \ - -e "${PKG_BASE_DIR}/${PKG_SUBDIR}/configure.ac" -o \ - -e "${PKG_BASE_DIR}/${PKG_SUBDIR}/configure.in" -o \ - -e "${PKG_BASE_DIR}/${PKG_SUBDIR}/config.guess" ]; then - if [ -n "${PKG_PKG_CONFIG}" ]; then - export PKG_CONFIG="${PKG_PKG_CONFIG}"; - fi; - if [ -n "${PKG_PKG_CONFIG_PATH}" ]; then - export PKG_CONFIG_PATH="${PKG_PKG_CONFIG_PATH}"; - fi; + local _config_cache="" _fname="" _subdir_tgt=""; + if ex_rtl_exists_any "${PKG_BASE_DIR}/${PKG_SUBDIR}" \ + "config.guess" "configure.ac" "configure.in" "configure"; + then ex_rtl_export_vars PKG_CONFIG "${PKG_PKG_CONFIG}" PKG_CONFIG_PATH "${PKG_PKG_CONFIG_PATH}"; if [ -e "${PKG_BASE_DIR}/${PKG_SUBDIR}/configure.ac" ]\ && [ ! -e "${PKG_BASE_DIR}/${PKG_SUBDIR}/configure" ]; then - for _script_fname in bootstrap bootstrap.sh autogen.sh ""; do - if [ -z "${_script_fname}" ]; then - (ex_rtl_fileop cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && autoconf)\ - || exit 1 && break; - elif [ -e "${PKG_BASE_DIR}/${PKG_SUBDIR}/${_script_fname}" ]; then - for _subdir_tgt in "${PKG_BASE_DIR}/${PKG_SUBDIR}/build-aux" "${PKG_BASE_DIR}/${PKG_SUBDIR}"; do - if [ -e "${_subdir_tgt}" ]; then - echo install -m 0700 \ - "${MIDIPIX_BUILD_PWD}/etc/config.sub" \ - "${_subdir_tgt}/config.sub"; - install -m 0700 \ - "${MIDIPIX_BUILD_PWD}/etc/config.sub" \ - "${_subdir_tgt}/config.sub"; - break; + for _fname in bootstrap bootstrap.sh autogen.sh; do + if [ -e "${PKG_BASE_DIR}/${PKG_SUBDIR}/${_fname}" ]; then + for _subdir_tgt in \ + "${PKG_BASE_DIR}/${PKG_SUBDIR}/build-aux" \ + "${PKG_BASE_DIR}/${PKG_SUBDIR}"; + do if [ -e "${_subdir_tgt}" ]; then + ex_rtl_fileop install -m 0700 \ + "${MIDIPIX_BUILD_PWD}/etc/config.sub" \ + "${_subdir_tgt}/config.sub" || return "${?}" && break; fi; done; - (ex_rtl_fileop cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && \ - /bin/sh "${_script_fname}") || exit 1 && break; + (ex_rtl_fileop cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && \ + /bin/sh "${_fname}") || return "${?}" && break; fi; done; + (ex_rtl_fileop cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && autoconf) || return "${?}"; fi; - find "${PKG_BASE_DIR}/${PKG_SUBDIR}" -name config.sub \ - -exec echo mv -- {} {}.orig \; \ - -exec mv -- {} {}.orig \; \ - -exec echo install -m 0700 "${MIDIPIX_BUILD_PWD}/etc/config.sub" {} \; \ - -exec install -m 0700 "${MIDIPIX_BUILD_PWD}/etc/config.sub" {} \;; + for _fname in $(find "${PKG_BASE_DIR}/${PKG_SUBDIR}" -name config.sub); do + if ! ex_rtl_fileop mv "${_fname}" "${_fname}.orig"\ + || ! ex_rtl_fileop install -m 0700 "${MIDIPIX_BUILD_PWD}/etc/config.sub" "${_fname}"; then + return 1; + fi; + done if [ "${PKG_BUILD_TYPE}" != host ]; then - if [ -n "${PKG_CONFIG_CACHE}" ]; then - echo "${PKG_CONFIG_CACHE}" |\ - tr " " "\n" > "${PKG_BUILD_DIR}/config.cache"; - if [ -n "${PKG_CONFIG_CACHE_LOCAL}" ]; then - echo "${PKG_CONFIG_CACHE_LOCAL}" |\ - tr " " "\n" >> "${PKG_BUILD_DIR}/config.cache"; - fi; - if [ -n "${PKG_CONFIG_CACHE_EXTRA}" ]; then - echo "${PKG_CONFIG_CACHE_EXTRA}" |\ - tr " " "\n" >> "${PKG_BUILD_DIR}/config.cache"; - fi; + if ! ex_rtl_fileop touch "${PKG_BUILD_DIR}/config.cache"; then + return 1; + else for _config_cache in \ + "${PKG_CONFIG_CACHE}" \ + "${PKG_CONFIG_CACHE_LOCAL}" \ + "${PKG_CONFIG_CACHE_EXTRA}"; + do echo "${_config_cache}" |\ + tr " " "\n" >> "${PKG_BUILD_DIR}/config.cache" || return "${?}"; + done; + sed -i"" "s,%PREFIX%,${PKG_PREFIX},g" "${PKG_BUILD_DIR}/config.cache" || return "${?}"; fi; - sed -i"" "s,%PREFIX%,${PKG_PREFIX},g" "${PKG_BUILD_DIR}/config.cache"; fi; - unset PKG_CONFIG PKG_CONFIG_PATH; + ex_rtl_export_vars -u PKG_CONFIG "${PKG_PKG_CONFIG}" PKG_CONFIG_PATH "${PKG_PKG_CONFIG_PATH}"; fi; }; diff --git a/subr/pkg_configure_patch.subr b/subr/pkg_configure_patch.subr index 45ee3601..366a9e52 100644 --- a/subr/pkg_configure_patch.subr +++ b/subr/pkg_configure_patch.subr @@ -1,24 +1,20 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_configure_patch() { - local _pkg_name="${PKG_NAME}" _pkg_name_full="" _patch_dir="" _patch_fname="" _patches_done=""; - if [ -z "${_pkg_name}" ]; then - continue; - else - _pkg_name_full="${_pkg_name}${PKG_VERSION:+-${PKG_VERSION}}"; - _patch_dir="${MIDIPIX_BUILD_PWD}/patches"; - fi; - set +o noglob; for _patch_fname in \ - ${_patch_dir}/${_pkg_name}/*.patch \ - ${_patch_dir}/${_pkg_name_full}.local.patch \ - ${_patch_dir}/${_pkg_name_full}.local@${BUILD_HNAME}.patch \ - "${PKG_PATCHES_EXTRA}"; do + local _patch_dir="${MIDIPIX_BUILD_PWD}/patches" _patch_fname="" \ + _patches_done="" _pkg_name_full="${PKG_NAME}${PKG_VERSION:+-${PKG_VERSION}}"; + set +o noglob; + for _patch_fname in \ + "${_patch_dir}/${_pkg_name}/"*.patch \ + "${_patch_dir}/${_pkg_name_full}.local.patch" \ + "${_patch_dir}/${_pkg_name_full}.local@${BUILD_HNAME}.patch" \ + ${PKG_PATCHES_EXTRA}; do if [ -r "${_patch_fname}" ]\ - && ! ex_rtl_lmatch "${_patches_done}" " " "${_patch_fname}"; then - patch -b -d "${PKG_BASE_DIR}/${PKG_SUBDIR}" -p1 < "${_patch_fname}"; - _patches_done="${_patches_done:+${_patches_done} }${_patch_fname}"; + && ! ex_rtl_lmatch "${_patches_done}" "${_patch_fname}"; then + patch -b -d "${PKG_BASE_DIR}/${PKG_SUBDIR}" -p1 < "${_patch_fname}" || return "${?}"; + _patches_done="$(ex_rtl_lconcat "${_patches_done}" "${_patch_fname}")"; fi; done; set -o noglob; }; diff --git a/subr/pkg_configure_patch_pre.subr b/subr/pkg_configure_patch_pre.subr index 22eb52ac..f38b5188 100644 --- a/subr/pkg_configure_patch_pre.subr +++ b/subr/pkg_configure_patch_pre.subr @@ -1,16 +1,32 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # -pkg_configure_patch_pre() { +pkgp_configure_patch_pre() { local _patch_path=""; - for _patch_path in \ - ${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}${PKG_VERSION:+-${PKG_VERSION}}_pre.local.patch \ - ${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}${PKG_VERSION:+-${PKG_VERSION}}_pre.local@${BUILD_HNAME}.patch; do + for _patch_path in \ + "${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}${PKG_VERSION:+-${PKG_VERSION}}_pre.local.patch" \ + "${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}${PKG_VERSION:+-${PKG_VERSION}}_pre.local@${BUILD_HNAME}.patch"; do if [ -r "${_patch_path}" ]; then - patch -b -d "${PKG_BASE_DIR}/${PKG_SUBDIR}" -p1 < "${_patch_path}"; + patch -b -d "${PKG_BASE_DIR}/${PKG_SUBDIR}" -p1 < "${_patch_path}" || return "${?}"; fi; done; }; +pkgp_configure_patch_pre_chainport() { + local _chainport_patch_fname="${BUILD_WORKDIR}/chainport/patches/${PKG_NAME%%_*}/${PKG_NAME%%_*}-${PKG_VERSION}.midipix.patch"\ + _chainport_patch_dname="${PKG_BASE_DIR}/${PKG_SUBDIR}/patches/${PKG_NAME%%_*}" _oldpwd=""; + if [ -e "${_chainport_patch_fname}" ]; then + ex_rtl_fileop mkdir "${_chainport_patch_dname}" || return "${?}"; + ex_rtl_fileop cp "${_chainport_patch_fname}" "${_chainport_patch_dname}" || return "${?}"; + fi; +}; + +pkg_configure_patch_pre() { + if ! pkgp_configure_patch_pre_chainport\ + || ! pkgp_configure_patch_pre; then + return 1; + fi; +}; + # vim:filetype=sh diff --git a/subr/pkg_fetch_download.subr b/subr/pkg_fetch_download.subr index 5774d2e4..8e1d193b 100644 --- a/subr/pkg_fetch_download.subr +++ b/subr/pkg_fetch_download.subr @@ -1,13 +1,13 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_fetch_download() { if [ -n "${PKG_URL}" ]; then - ex_rtl_fetch_url_wget "${PKG_URL}" "${PKG_SHA256SUM}" "${PKG_FNAME}"; + ex_rtl_fetch_url_wget "${PKG_URL}" "${PKG_SHA256SUM}" "${PKG_FNAME}" || return "${?}"; fi; if [ -n "${PKG_URLS_GIT}" ]; then - ex_rtl_fetch_urls_git "${PKG_BASE_DIR}" ${PKG_URLS_GIT}; + ex_rtl_fetch_urls_git "${PKG_BASE_DIR}" ${PKG_URLS_GIT} || return "${?}"; fi; }; diff --git a/subr/pkg_fetch_extract.subr b/subr/pkg_fetch_extract.subr index bb54c87f..66e51669 100644 --- a/subr/pkg_fetch_extract.subr +++ b/subr/pkg_fetch_extract.subr @@ -1,34 +1,29 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # +pkgp_fetch_extract_type() { + local _fname="${1}"; + if [ "${1##*.tar.}" != "${1}" ]; then + echo "${1##*.tar.}"; + elif [ "${1##*.t}" != "${1}" ]; then + echo "${1##*.t}"; + fi; +}; + pkg_fetch_extract() { - local _chainport_patch_fname="${BUILD_WORKDIR}/chainport/patches/${PKG_NAME%%_*}/${PKG_NAME%%_*}-${PKG_VERSION}.midipix.patch" - _chainport_patch_dname="${PKG_BASE_DIR}/${PKG_SUBDIR}/patches/${PKG_NAME%%_*}" _oldpwd=""; if [ -n "${PKG_URL}" ]\ && [ "${PKG_URL_TYPE:-wget}" = wget ]; then - _oldpwd="${PWD}"; ex_rtl_fileop cd "${PKG_BASE_DIR}"; - ex_rtl_fileop rm "${PKG_BASE_DIR}/${PKG_SUBDIR}"; - if [ "${PKG_FNAME##*.tar.}" = "bz2" ]\ - || [ "${PKG_FNAME##*.t}" = "bz2" ]; then - bunzip2 -d < "${BUILD_DLCACHEDIR}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf -; - elif [ "${PKG_FNAME##*.tar.}" = "gz" ]\ - || [ "${PKG_FNAME##*.t}" = "gz" ]; then - gunzip -d < "${BUILD_DLCACHEDIR}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf -; - elif [ "${PKG_FNAME##*.tar.}" = "lz" ]\ - || [ "${PKG_FNAME##*.t}" = "lz" ]; then - lzip -d < "${BUILD_DLCACHEDIR}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf -; - elif [ "${PKG_FNAME##*.tar.}" = "xz" ]\ - || [ "${PKG_FNAME##*.t}" = "xz" ]; then - xz -d < "${BUILD_DLCACHEDIR}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf -; - else - tar -C "${PKG_BASE_DIR}" -xf "${BUILD_DLCACHEDIR}/${PKG_FNAME}"; - fi; - ex_rtl_fileop cd "${_oldpwd}"; - fi; - if [ -e "${_chainport_patch_fname}" ]; then - ex_rtl_fileop mkdir "${_chainport_patch_dname}"; - ex_rtl_fileop cp "${_chainport_patch_fname}" "${_chainport_patch_dname}"; + _oldpwd="${PWD}"; ex_rtl_fileop cd "${PKG_BASE_DIR}" || return "${?}"; + ex_rtl_fileop rm "${PKG_BASE_DIR}/${PKG_SUBDIR}" || return "${?}"; + case "$(pkgp_fetch_extract_type "${PKG_NAME}")" in + bz2) bunzip2 -d < "${BUILD_DLCACHEDIR}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf - || return "${?}"; ;; + gz) gunzip -d < "${BUILD_DLCACHEDIR}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf - || return "${?}"; ;; + lz) lzip -d < "${BUILD_DLCACHEDIR}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf - || return "${?}"; ;; + xz) xz -d < "${BUILD_DLCACHEDIR}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf - || return "${?}"; ;; + *) tar -C "${PKG_BASE_DIR}" -xf "${BUILD_DLCACHEDIR}/${PKG_FNAME}" || return "${?}"; ;; + esac; + ex_rtl_fileop cd "${_oldpwd}" || return "${?}"; fi; }; diff --git a/subr/pkg_install.subr b/subr/pkg_install.subr index b4f68754..46024e8e 100644 --- a/subr/pkg_install.subr +++ b/subr/pkg_install.subr @@ -1,30 +1,27 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_install() { local _pkglist_name=""; - ex_rtl_fileop mkdir "${PKG_PREFIX}"; - find "${PKG_DESTDIR}" \ - -type d -exec chmod 0755 {} \;; - find "${PKG_DESTDIR}" \ - \( -not -perm /0111 \) \ - -type f -exec chmod 0644 {} \;; - find "${PKG_DESTDIR}" \ - -perm /0111 -type f -exec chmod 0755 {} \;; - tar -C "${PKG_DESTDIR}" -cpf - . |\ - tar -C "${PKG_PREFIX}" --overwrite -xpf -; - if ex_rtl_lmatch "${ARG_DIST}" , pkg; then - tar -C "${PKG_DESTDIR}" -cpf - . |\ - gzip -c -9 - > "${PKG_BASE_DIR}/${PKG_NAME}.tgz" - fi; - if [ "${PKG_PKGLIST_DISABLE:-0}" -eq 0 ]; then - if [ ! -e "${PREFIX}/pkglist.${PKG_BUILD_TYPE}" ]; then - touch "${PREFIX}/pkglist.${PKG_BUILD_TYPE}"; + if ! ex_rtl_fileop mkdir "${PKG_PREFIX}"\ + || ! find "${PKG_DESTDIR}" -type d -exec chmod 0755 {} \;\ + || ! find "${PKG_DESTDIR}" \( -not -perm /0111 \) -type f -exec chmod 0644 {} \;\ + || ! find "${PKG_DESTDIR}" -perm /0111 -type f -exec chmod 0755 {} \;\ + || ! tar -C "${PKG_DESTDIR}" -cpf - . | tar -C "${PKG_PREFIX}" --overwrite -xpf -; then + return "${?}"; + else + if ex_rtl_lmatch "${ARG_DIST}" "pkg" ","; then + tar -C "${PKG_DESTDIR}" -cpf - . |\ + gzip -c -9 - > "${PKG_BASE_DIR}/${PKG_NAME}.tgz" || return "${?}"; + fi; + if [ "${PKG_PKGLIST_DISABLE:-0}" -eq 0 ]; then + if [ ! -e "${PREFIX}/pkglist.${PKG_BUILD_TYPE}" ]; then + touch "${PREFIX}/pkglist.${PKG_BUILD_TYPE}" || return "${?}"; + fi; + _pkglist_name="${PKG_BASE_DIR##*/}"; _pkglist_name="${_pkglist_name%%-*}"; + echo "${_pkglist_name}" >> "${PREFIX}/pkglist.${PKG_BUILD_TYPE}" || return "${?}"; fi; - _pkglist_name="${PKG_BASE_DIR##*/}"; - _pkglist_name="${_pkglist_name%%-*}"; - echo "${_pkglist_name}" >> "${PREFIX}/pkglist.${PKG_BUILD_TYPE}"; fi; }; diff --git a/subr/pkg_install_files.subr b/subr/pkg_install_files.subr index 31f101ea..92c7ed7e 100644 --- a/subr/pkg_install_files.subr +++ b/subr/pkg_install_files.subr @@ -1,10 +1,47 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # -pkg_install_files() { +pkgp_install_files() { if [ -n "${PKG_INSTALL_FILES}" ]; then - ex_rtl_install -v "${PKG_DESTDIR}" ${PKG_INSTALL_FILES}; + ex_rtl_install -v "${PKG_DESTDIR}" ${PKG_INSTALL_FILES} || return "${?}"; + fi; +}; + +pkgp_install_files_pkgconfig() { + local _pc_path=""; + for _pc_path in $(find "${PKG_DESTDIR}" -name \*.pc); do + if grep -Eq '^libdir=[^$]+$' "${_pc_path}"; then + sed -i"" -e '/^libdir=[^$]\+$/s/^libdir=\(.\+\)$/libdir=${exec_prefix}\1/' \ + -e '/^exec_prefix=$/s/^.*$/exec_prefix=${prefix}/' \ + "${_pc_path}" || return "${?}"; + fi; + done; +}; + +pkgp_install_files_strip() { + local _bin_path="" _tree_root="${PKG_DESTDIR}"; + if [ -e "${_tree_root}" ]\ + && [ "${BUILD}" = release ]\ + && [ "${PKG_BUILD_TYPE}" = native ]; then + if [ "${PKG_NAME%_minipix}" != "${PKG_NAME}" ]\ + && [ "${ARG_DEBUG_MINIPIX:-0}" -eq 1 ]; then + return 0; + fi; + for _bin_path in $(find "${_tree_root}" -perm /a=x -type f); do + if objdump -sj .debug_info "${_bin_path}" >/dev/null 2>&1; then + ex_rtl_log_msg info "Stripping ${_bin_path}..."; + "${PKG_TARGET}-strip" "${_bin_path}" || return "${?}"; + fi; + done; + fi; +}; + +pkg_install_files() { + if ! pkgp_install_files\ + || ! pkgp_install_files_pkgconfig\ + || ! pkgp_install_files_strip; then + return "${?}"; fi; }; diff --git a/subr/pkg_install_libs.subr b/subr/pkg_install_libs.subr index 2035225d..379a0374 100644 --- a/subr/pkg_install_libs.subr +++ b/subr/pkg_install_libs.subr @@ -1,63 +1,60 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # -pkgp_install_lib_check() { - local _so_path="${1}" _so_ver="${1##*.so}"; - if [ -z "${_so_path}" ]; then - return 1; - else while [ -n "${_so_ver}" ]; do - if [ "${_so_ver#[0-9.]}" = "${_so_ver}" ]; then - return 1; - else - _so_ver="${_so_ver#[0-9.]}"; - fi; - done; return 0; fi; +pkgp_install_libs_purge_la() { + local _la_path=""; + for _la_path in $(find "${PKG_DESTDIR}" -type f -name \*.la); do + ex_rtl_fileop rm "${_la_path}" || return "${?}"; + done; }; -pkgp_install_lib_link() { - local _so_path="${1}" _so_dir="${2}" _lib_name="${3}" \ - _lib_link_tgt="" _lib_link_path=""; - _lib_link_path="${_so_path%.so*}.lib.a"; - _lib_link_tgt="$(find "${_so_dir}" \ - -name "${_lib_name%%.*}.*.lib.a" |\ - sort | tail -1)"; - if [ -n "${_lib_link_tgt}" ]\ +pkgp_install_libs_shared_link() { + local _lib_name="${1}" _so_dir="${2}" _so_path="${3}" _lib_link_path="${3%.so*}.lib.a" _lib_link_tgt=""; + if _lib_link_tgt="$(find "${_so_dir}" -name "${_lib_name%%.*}.*.lib.a" | sort | tail -1)"\ + && [ -n "${_lib_link_tgt}" ]\ && [ "${_lib_link_tgt}" != "${_lib_link_path}" ]; then - ex_rtl_fileop rm "${_lib_link_path}"; - ex_rtl_fileop ln_symbolic "$(ex_rtl_basename "${_lib_link_tgt}")" \ - "${_lib_link_path}"; + if ! ex_rtl_fileop rm "${_lib_link_path}"\ + || ! ex_rtl_fileop ln_symbolic "$(ex_rtl_basename "${_lib_link_tgt}")" "${_lib_link_path}"; then + return 1; + fi; fi; }; -pkg_install_libs() { - local _so_src_path="" _so_dst_dir="" _lib_src_path="" _lib_name="" _lib_dst_path=""; +pkgp_install_libs_shared() { + local _lib_dst_path="" _lib_name="" _lib_src_path="" _so_dst_dir="" _so_src_path=""; if [ "${PKG_BUILD_TYPE}" != "host" ]; then - for _so_src_path in \ - $(find "${PKG_DESTDIR}" \ + for _so_src_path in \ + $(find "${PKG_DESTDIR}" \ \( -name "*.so" -or -name "*.so.*" \) -print); - do if ! pkgp_install_lib_check "${_so_src_path}" \ - || [ "$(readlink -f "${_so_src_path}")" = "/dev/null" ]; then - continue; - else _so_dst_dir="${_so_src_path%/*}"; + do if [ "$(readlink -f "${_so_path}")" != "/dev/null" ]\ + && [ -z "$(ex_rtl_head "[0-9.]" "${_so_src_path##*.so}")" ]; then case "${_so_src_path}" in *.so) _lib_src_path="${_so_src_path%%.so}.lib.a"; ;; *.so.*) _lib_src_path="${_so_src_path%%.so.*}.${_so_src_path##*.so.}.lib.a"; ;; esac; + _so_dst_dir="${_so_src_path%/*}"; _lib_name="$(ex_rtl_basename "${_lib_src_path}")"; _lib_dst_path="${_so_dst_dir}/${_lib_name}"; + if [ ! -L "${_lib_src_path}" ]\ + && [ ! -e "${_lib_dst_path}" ]; then + (ex_rtl_fileop cd "$(ex_rtl_dirname "${_so_src_path}")" &&\ + perk -e "$(ex_rtl_basename "${_so_src_path}")" |\ + "${PKG_TARGET}-mdso" \ + -i "$(ex_rtl_basename "${_lib_dst_path}")" \ + -n "$(ex_rtl_basename "${_so_src_path}")" -) || return "${?}"; + fi; + pkgp_install_libs_shared_link "${_lib_name}" "${_so_dst_dir}" "${_so_src_path}" || return "${?}"; fi; - if [ ! -L "${_lib_src_path}" ]\ - && [ ! -e "${_lib_dst_path}" ]; then - (ex_rtl_fileop cd "$(ex_rtl_dirname "${_so_src_path}")"; - perk -e "$(ex_rtl_basename "${_so_src_path}")" |\ - "${PKG_TARGET}-mdso" \ - -i "$(ex_rtl_basename "${_lib_dst_path}")" \ - -n "$(ex_rtl_basename "${_so_src_path}")" -); - fi; - pkgp_install_lib_link "${_so_src_path}" "${_so_dst_dir}" "${_lib_name}"; done; fi; }; +pkg_install_libs() { + if ! pkgp_install_libs_purge_la\ + || ! pkgp_install_libs_shared; then + return 1; + fi; +}; + # vim:filetype=sh diff --git a/subr/pkg_install_make.subr b/subr/pkg_install_make.subr index 48489c53..5cf16fe9 100644 --- a/subr/pkg_install_make.subr +++ b/subr/pkg_install_make.subr @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_install_make() { diff --git a/subr/pkg_install_pkgconfig.subr b/subr/pkg_install_pkgconfig.subr deleted file mode 100644 index 314e1427..00000000 --- a/subr/pkg_install_pkgconfig.subr +++ /dev/null @@ -1,16 +0,0 @@ -# -# set -o errexit -o noglob are assumed. -# - -pkg_install_pkgconfig() { - local _pc_path=""; - for _pc_path in $(find "${PKG_DESTDIR}" -name \*.pc); do - if grep -Eq '^libdir=[^$]+$' "${_pc_path}"; then - sed -i"" -e '/^libdir=[^$]\+$/s/^libdir=\(.\+\)$/libdir=${exec_prefix}\1/' \ - -e '/^exec_prefix=$/s/^.*$/exec_prefix=${prefix}/' \ - "${_pc_path}"; - fi; - done; -}; - -# vim:filetype=sh diff --git a/subr/pkg_install_purge_la.subr b/subr/pkg_install_purge_la.subr deleted file mode 100644 index 01a78cb4..00000000 --- a/subr/pkg_install_purge_la.subr +++ /dev/null @@ -1,12 +0,0 @@ -# -# set -o errexit -o noglob are assumed. -# - -pkg_install_purge_la() { - local _la_path=""; - for _la_path in $(find "${PKG_DESTDIR}" -type f -name \*.la); do - ex_rtl_fileop rm ${_la_path}; - done; -}; - -# vim:filetype=sh diff --git a/subr/pkg_install_rpm.subr b/subr/pkg_install_rpm.subr index 59667388..b3c939ab 100644 --- a/subr/pkg_install_rpm.subr +++ b/subr/pkg_install_rpm.subr @@ -1,69 +1,51 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_install_rpm() { - local _pkg_url="" _pkg_version_full="" _pkg_version_rpm=""; - if ex_rtl_lmatch "${ARG_DIST}" , rpm \ - && [ "${PKG_RPM_DISABLE:-0}" -eq 0 ] \ + local _pkg_url="" _pkg_version_full="" _pkg_version_rpm="" _rc=0; + if ex_rtl_lmatch "${ARG_DIST}" "rpm" ","\ + && [ "${PKG_RPM_DISABLE:-0}" -eq 0 ]\ && [ -x "$(which rpmbuild 2>/dev/null)" ]; then if [ -n "${PKG_URL}" ]; then - _pkg_version_rpm="${PKG_VERSION%%-*}"; - _pkg_version_full="${PKG_VERSION}"; - _pkg_url="${PKG_URL}"; + _pkg_url="${PKG_URL}"; _pkg_version_full="${PKG_VERSION}"; _pkg_version_rpm="${PKG_VERSION%%-*}"; elif [ -n "${PKG_URLS_GIT}" ]; then _pkg_version_rpm="$(cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && git rev-parse HEAD)"; _pkg_version_full="${_pkg_version_rpm} ($(cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && git rev-parse --abbrev-ref HEAD))"; - _pkg_url="${PKG_URLS_GIT%% *}"; - _pkg_url="${_pkg_url##*=}"; _pkg_url="${_pkg_url%%@*}"; + _pkg_url="${PKG_URLS_GIT%% *}"; _pkg_url="${_pkg_url##*=}"; _pkg_url="${_pkg_url%%@*}"; if [ "${_pkg_url#${DEFAULT_GITROOT_HEAD}}" != "${_pkg_url}" ]; then _pkg_url="Unknown"; fi; fi; - cat > "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec" <<EOF -Name: ${PKG_NAME} -Version: ${_pkg_version_rpm} -Release: 1 -Summary: ${PKG_NAME} ${_pkg_version_full} -License: Unknown -Group: Applications -Url: ${_pkg_url} - -%description -${PKG_NAME} ${_pkg_version_full} - -%prep -%build -%install -rm -rf "\${RPM_BUILD_ROOT}" -mkdir -p "\${RPM_BUILD_ROOT}" -cp -pPr "${PKG_DESTDIR}/." "\${RPM_BUILD_ROOT}" - -%post -%postun -%files -/ - -%changelog - -EOF - while true; do - if ! rpmbuild \ - -bb \ - --define="_tmppath ${BUILD_WORKDIR}" \ - --define="_topdir ${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}" \ - --nodeps "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec"; - then - if [ "${?}" -ne 141 ]; then + if ! ex_rtl_fileop cp "${MIDIPIX_BUILD_PWD}/etc/package.spec" \ + "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec"; then + return 1; + else while true; do + rpmbuild \ + -bb \ + --define="_tmppath ${BUILD_WORKDIR}" \ + --define="_topdir ${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}" \ + --define="pkg_destdir ${PKG_DESTDIR}" \ + --define="pkg_name ${PKG_NAME}" \ + --define="pkg_url ${_pkg_url}" \ + --define="pkg_version_full ${_pkg_version_full}" \ + --define="pkg_version_rpm ${_pkg_version_rpm}" \ + --nodeps "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec"; _rc="${?}"; + if [ "${_rc}" -eq 0 ]; then break; + elif [ "${_rc}" -eq 141 ]; then + continue; + else + return "${?}"; fi; - else - break; + done; + if ! find "${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}/RPMS" \ + -iname \*.rpm -exec cp -pP {} "${PREFIX_RPM}/" \; \ + || ! ex_rtl_fileop rm "${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}" \ + || ! ex_rtl_fileop cp "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec" "${PREFIX_RPM}/"; then + return "${?}"; fi; - done; - find "${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}/RPMS" -iname \*.rpm -exec cp -pP {} "${PREFIX_RPM}/" \;; - ex_rtl_fileop rm "${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}"; - ex_rtl_fileop cp "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec" "${PREFIX_RPM}/"; + fi; fi; }; diff --git a/subr/pkg_install_strip.subr b/subr/pkg_install_strip.subr deleted file mode 100644 index e94609eb..00000000 --- a/subr/pkg_install_strip.subr +++ /dev/null @@ -1,24 +0,0 @@ -# -# set -o errexit -o noglob are assumed. -# - -pkg_install_strip() { - local _tree_root="${PKG_DESTDIR}" _bin_path=""; - if [ -e "${_tree_root}" ]\ - && [ "${BUILD}" = release ]\ - && [ "${PKG_BUILD_TYPE}" = native ]; then - if [ "${PKG_NAME%_minipix}" != "${PKG_NAME}" ]\ - && [ "${ARG_DEBUG_MINIPIX:-0}" -eq 1 ]; then - return; - fi; - for _bin_path in $(find "${_tree_root}" -perm /a=x -type f); do - if objdump -sj .debug_info "${_bin_path}" >/dev/null 2>&1; then - ex_rtl_log_msg info "Stripping ${_bin_path}..."; - ex_rtl_log_msg vnfo "${PKG_TARGET}-strip ${_bin_path}"; - ${PKG_TARGET}-strip ${_bin_path}; - fi; - done; - fi; -}; - -# vim:filetype=sh diff --git a/subr/pkg_install_subdirs.subr b/subr/pkg_install_subdirs.subr index 9bba9d68..379592f5 100644 --- a/subr/pkg_install_subdirs.subr +++ b/subr/pkg_install_subdirs.subr @@ -1,17 +1,17 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_install_subdirs() { local _spec=""; - for _spec in "${PKG_INSTALL_FILES_DESTDIR}" \ + for _spec in \ + "${PKG_INSTALL_FILES_DESTDIR}" \ "${PKG_INSTALL_FILES_DESTDIR_EXTRA}"; do - ex_rtl_install "${PKG_DESTDIR}" ${_spec}; + ex_rtl_install "${PKG_DESTDIR}" ${_spec} || return "${?}"; done; if [ "${PKG_PREFIX%/}" = "${PREFIX_NATIVE%/}" ]; then ex_rtl_install \ - "${PKG_DESTDIR}/${DEFAULT_TARGET}" \ - ${PKG_INSTALL_FILES_DESTDIR}; + "${PKG_DESTDIR}/${DEFAULT_TARGET}" ${PKG_INSTALL_FILES_DESTDIR} || return "${?}"; fi; }; diff --git a/vars/apr.vars b/vars/apr.vars index 1d32d376..cbc192a5 100644 --- a/vars/apr.vars +++ b/vars/apr.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_APR_CONFIG_CACHE_EXTRA:=" diff --git a/vars/bash.vars b/vars/bash.vars index 3d9bae15..2a61c1ce 100644 --- a/vars/bash.vars +++ b/vars/bash.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_BASH_CONFIG_CACHE_EXTRA:=" diff --git a/vars/binutils.vars b/vars/binutils.vars index d5669ff9..c7727319 100644 --- a/vars/binutils.vars +++ b/vars/binutils.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_binutils_configure_patch_post() { diff --git a/vars/bison.vars b/vars/bison.vars index 3dca19a2..0f29a896 100644 --- a/vars/bison.vars +++ b/vars/bison.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_BISON_CONFIG_CACHE_EXTRA:=" diff --git a/vars/busybox.vars b/vars/busybox.vars index e0414384..71dd3aa3 100644 --- a/vars/busybox.vars +++ b/vars/busybox.vars @@ -1,16 +1,16 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_busybox_configure() { - ex_rtl_fileop cp ${MIDIPIX_BUILD_PWD}/vars/busybox/busyboxconfig ${PKG_BUILD_DIR}/.config; + ex_rtl_fileop cp "${MIDIPIX_BUILD_PWD}/etc/busyboxconfig" "${PKG_BUILD_DIR}/.config"; }; pkg_busybox_install_make_post() { set +o noglob - ex_rtl_fileop cp ${PKG_BUILD_DIR}/_install/bin/* ${PKG_DESTDIR}/bin/; + ex_rtl_fileop cp "${PKG_BUILD_DIR}/_install/bin/"* "${PKG_DESTDIR}/bin/"; set -o noglob - ex_rtl_fileop cp ${PKG_BUILD_DIR}/_install/lib/libbusybox.so.${PKG_VERSION} ${PKG_DESTDIR}/lib/; + ex_rtl_fileop cp "${PKG_BUILD_DIR}/_install/lib/libbusybox.so.${PKG_VERSION}" "${PKG_DESTDIR}/lib/"; }; # vim:filetype=sh diff --git a/vars/ca_certificates.vars b/vars/ca_certificates.vars index d43d5b78..65b8387b 100644 --- a/vars/ca_certificates.vars +++ b/vars/ca_certificates.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_ca_certificates_install_make_pre() { diff --git a/vars/chainport_host.vars b/vars/chainport_host.vars index 94b56b18..5db2cdb9 100644 --- a/vars/chainport_host.vars +++ b/vars/chainport_host.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_chainport_host_install_make() { diff --git a/vars/check_updates.vars b/vars/check_updates.vars index 91d3b01b..e563dac6 100644 --- a/vars/check_updates.vars +++ b/vars/check_updates.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_apk_tools_check_updates() { diff --git a/vars/clang_host.vars b/vars/clang_host.vars index 4f779800..32e9cc70 100644 --- a/vars/clang_host.vars +++ b/vars/clang_host.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_clang_host_configure() { diff --git a/vars/cmake.vars b/vars/cmake.vars index bf211972..21b22c48 100644 --- a/vars/cmake.vars +++ b/vars/cmake.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_cmake_configure() { diff --git a/vars/dbus_host.vars b/vars/dbus_host.vars index b443a3d8..8536b3d6 100644 --- a/vars/dbus_host.vars +++ b/vars/dbus_host.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_dbus_host_install_pre() { diff --git a/vars/emacs.vars b/vars/emacs.vars index ce6857fd..79fdd2f7 100644 --- a/vars/emacs.vars +++ b/vars/emacs.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_EMACS_CONFIG_CACHE_EXTRA:=" diff --git a/vars/env.vars b/vars/env.vars index b8e6289c..32383213 100644 --- a/vars/env.vars +++ b/vars/env.vars @@ -11,8 +11,7 @@ DEFAULT_BUILD_STEPS=" fetch_download fetch_extract \ configure_patch_pre configure_autotools configure_patch configure \ build \ - install_subdirs install_make install_files install_libs \ - install_pkgconfig install_purge_la install_strip install install_rpm clean"; + install_subdirs install_make install_files install_libs install install_rpm clean"; DEFAULT_BUILD_VARS=" AR BASE_DIR BUILD_DIR BUILD_STEPS_DISABLE BUILD_TYPE CC \ CFLAGS_BUILD_EXTRA CFLAGS_CONFIGURE CFLAGS_CONFIGURE_EXTRA \ diff --git a/vars/gcc.vars b/vars/gcc.vars index d8f48adf..61675322 100644 --- a/vars/gcc.vars +++ b/vars/gcc.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # Order: stage1_host, runtime_host, libstdcpp_v3_host, full_host, full # Order: stage1_mingw32, native_mingw32 # diff --git a/vars/gdb.vars b/vars/gdb.vars index 2a7e9957..595db375 100644 --- a/vars/gdb.vars +++ b/vars/gdb.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_gdb_configure_patch_post() { diff --git a/vars/gdk.vars b/vars/gdk.vars index 7ba62b8f..a55bbcd4 100644 --- a/vars/gdk.vars +++ b/vars/gdk.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_GDB_CONFIG_CACHE_EXTRA:=" diff --git a/vars/ghostscript.vars b/vars/ghostscript.vars index 9b429c90..aed92398 100644 --- a/vars/ghostscript.vars +++ b/vars/ghostscript.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_ghostscript_configure_patch_pre() { diff --git a/vars/git.vars b/vars/git.vars index 85e04ae5..78e8746d 100644 --- a/vars/git.vars +++ b/vars/git.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_GIT_CONFIG_CACHE_EXTRA:=" diff --git a/vars/glib.vars b/vars/glib.vars index eb3fb060..8a9393e3 100644 --- a/vars/glib.vars +++ b/vars/glib.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_GLIB_CONFIG_CACHE_EXTRA:=" diff --git a/vars/gnutls.vars b/vars/gnutls.vars index b1675ac1..556ac215 100644 --- a/vars/gnutls.vars +++ b/vars/gnutls.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_GNUTLS_CONFIG_CACHE_EXTRA:=" diff --git a/vars/htop.vars b/vars/htop.vars index a835dbe2..910d7140 100644 --- a/vars/htop.vars +++ b/vars/htop.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_HTOP_CONFIG_CACHE_EXTRA:=" diff --git a/vars/install_strip_host.vars b/vars/install_strip_host.vars index a5ee5e6c..1fb33868 100644 --- a/vars/install_strip_host.vars +++ b/vars/install_strip_host.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_install_strip_host_all() { diff --git a/vars/invariants_digest.vars b/vars/invariants_digest.vars index e51e6af0..1a013f15 100644 --- a/vars/invariants_digest.vars +++ b/vars/invariants_digest.vars @@ -1,12 +1,12 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_invariants_digest_all() { local _fname=""; - if ex_rtl_lmatch "${ARG_DIST}" , tbz2 \ - || ex_rtl_lmatch "${ARG_DIST}" , tgz \ - || ex_rtl_lmatch "${ARG_DIST}" , txz; then + if ex_rtl_lmatch "${ARG_DIST}" "tbz2" "," \ + || ex_rtl_lmatch "${ARG_DIST}" "tgz" "," \ + || ex_rtl_lmatch "${ARG_DIST}" "txz" ","; then ex_rtl_log_msg info "Compiling SHA256 sums..."; if [ -e "${PREFIX}/SHA256SUMS" ]; then ex_rtl_fileop mv "${PREFIX}/SHA256SUMS" "${PREFIX}/SHA256SUMS.last"; diff --git a/vars/invariants_gitref.vars b/vars/invariants_gitref.vars index 7af5c4a3..83c50e24 100644 --- a/vars/invariants_gitref.vars +++ b/vars/invariants_gitref.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_invariants_gitref_all() { diff --git a/vars/invariants_minipix.vars b/vars/invariants_minipix.vars index 055254e9..a1896ad2 100644 --- a/vars/invariants_minipix.vars +++ b/vars/invariants_minipix.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkgp_invariants_minipix_is_newer() { diff --git a/vars/invariants_zipdist.vars b/vars/invariants_zipdist.vars index 6bc9b7df..58f87a41 100644 --- a/vars/invariants_zipdist.vars +++ b/vars/invariants_zipdist.vars @@ -1,10 +1,10 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_invariants_zipdist_all() { local _dist_fname="" _pkg_name="" _pkglist_fname="${PREFIX}/pkglist.native"; - if ex_rtl_lmatch "${ARG_DIST}" , zipdist; then + if ex_rtl_lmatch "${ARG_DIST}" "zipdist" ","; then ex_rtl_log_msg info "Building deployable distribution ZIP archive..."; for _pkg_name in $(cat "${_pkglist_fname}"); do if ! stat "${BUILD_WORKDIR}/${_pkg_name}-native-${DEFAULT_TARGET}" >/dev/null 2>&1; then diff --git a/vars/jamvm.vars b/vars/jamvm.vars index abfe4fcc..fbefd30b 100644 --- a/vars/jamvm.vars +++ b/vars/jamvm.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_jamvm_configure_autotools_pre() { diff --git a/vars/libasr.vars b/vars/libasr.vars index a7a747c8..67737232 100644 --- a/vars/libasr.vars +++ b/vars/libasr.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_libasr_configure_autotools_pre() { diff --git a/vars/libevent.vars b/vars/libevent.vars index 6ce2cc60..cda3a3cd 100644 --- a/vars/libevent.vars +++ b/vars/libevent.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_LIBEVENT_CONFIG_CACHE_EXTRA:=" diff --git a/vars/libfirm.vars b/vars/libfirm.vars index 87a75c64..74008878 100644 --- a/vars/libfirm.vars +++ b/vars/libfirm.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_cparser_configure_pre() { diff --git a/vars/libgcrypt.vars b/vars/libgcrypt.vars index d928d88b..53a34f6e 100644 --- a/vars/libgcrypt.vars +++ b/vars/libgcrypt.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_LIBGCRYPT_CONFIG_CACHE_EXTRA:=" diff --git a/vars/libgpg_error.vars b/vars/libgpg_error.vars index a7e5eada..588f2c05 100644 --- a/vars/libgpg_error.vars +++ b/vars/libgpg_error.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_libgpg_error_configure_autotools_pre() { diff --git a/vars/libjpeg_turbo.vars b/vars/libjpeg_turbo.vars index e36bcf6e..8ede8063 100644 --- a/vars/libjpeg_turbo.vars +++ b/vars/libjpeg_turbo.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_libjpeg_turbo_configure() { diff --git a/vars/libksba.vars b/vars/libksba.vars index 1f7efbf2..64f491a1 100644 --- a/vars/libksba.vars +++ b/vars/libksba.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_LIBKSBA_CONFIG_CACHE_EXTRA:=" diff --git a/vars/libnettle.vars b/vars/libnettle.vars index db6629bb..3d6b96ed 100644 --- a/vars/libnettle.vars +++ b/vars/libnettle.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_libnettle_install_make_post() { diff --git a/vars/libpcap.vars b/vars/libpcap.vars index c5a65948..bf7416c1 100644 --- a/vars/libpcap.vars +++ b/vars/libpcap.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_LIBPCAP_CONFIG_CACHE_EXTRA:=" diff --git a/vars/libressl_host.vars b/vars/libressl_host.vars index befc3ea1..f8bbe852 100644 --- a/vars/libressl_host.vars +++ b/vars/libressl_host.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_libressl_host_install_pre() { diff --git a/vars/libsolv.vars b/vars/libsolv.vars index 90a50cf7..e3be2cbc 100644 --- a/vars/libsolv.vars +++ b/vars/libsolv.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_libsolv_configure() { diff --git a/vars/libtool_host.vars b/vars/libtool_host.vars index b1383609..d564ae91 100644 --- a/vars/libtool_host.vars +++ b/vars/libtool_host.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_libtool_host_build() { diff --git a/vars/libxml2.vars b/vars/libxml2.vars index f925f2db..8effa8da 100644 --- a/vars/libxml2.vars +++ b/vars/libxml2.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_libxml2_install_make_post() { diff --git a/vars/libzip.vars b/vars/libzip.vars index 40bcbf31..3c354121 100644 --- a/vars/libzip.vars +++ b/vars/libzip.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_libzip_configure() { diff --git a/vars/lighttpd.vars b/vars/lighttpd.vars index 346589c1..a35cbeda 100644 --- a/vars/lighttpd.vars +++ b/vars/lighttpd.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_LIGHTTPD_CONFIG_CACHE_EXTRA:=" diff --git a/vars/llvm_host.vars b/vars/llvm_host.vars index 18c15827..41e10b2a 100644 --- a/vars/llvm_host.vars +++ b/vars/llvm_host.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_llvm_host_configure() { diff --git a/vars/lolcode.vars b/vars/lolcode.vars index 8073c777..d41d138a 100644 --- a/vars/lolcode.vars +++ b/vars/lolcode.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_lolcode_configure() { diff --git a/vars/lua.vars b/vars/lua.vars index 451428fe..13dd4d51 100644 --- a/vars/lua.vars +++ b/vars/lua.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_lua_configure_autotools_pre() { diff --git a/vars/make.vars b/vars/make.vars index 9883d5e3..3323eb39 100644 --- a/vars/make.vars +++ b/vars/make.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_MAKE_CONFIG_CACHE_EXTRA:=" diff --git a/vars/mc.vars b/vars/mc.vars index a4ca6244..d739e01e 100644 --- a/vars/mc.vars +++ b/vars/mc.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_MC_CONFIG_CACHE_EXTRA:=" diff --git a/vars/mlogin.vars b/vars/mlogin.vars index aeafa138..1aa4d293 100644 --- a/vars/mlogin.vars +++ b/vars/mlogin.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_mlogin_configure_autotools_pre() { diff --git a/vars/mpackage_host.vars b/vars/mpackage_host.vars index e4965802..7ec3ba99 100644 --- a/vars/mpackage_host.vars +++ b/vars/mpackage_host.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_mpackage_host_install_make() { diff --git a/vars/musl.vars b/vars/musl.vars index 94975844..feb20d41 100644 --- a/vars/musl.vars +++ b/vars/musl.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_musl_full_fetch_download_post() { diff --git a/vars/mutt.vars b/vars/mutt.vars index 94e71655..c94970bf 100644 --- a/vars/mutt.vars +++ b/vars/mutt.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_MUTT_CONFIG_CACHE_EXTRA:=" diff --git a/vars/nano.vars b/vars/nano.vars index 3a7a0a84..4d68ae6e 100644 --- a/vars/nano.vars +++ b/vars/nano.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_NANO_CONFIG_CACHE_EXTRA:=" diff --git a/vars/nasm_host.vars b/vars/nasm_host.vars index 4cdcdf9f..802c3128 100644 --- a/vars/nasm_host.vars +++ b/vars/nasm_host.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_nasm_host_install_make_post() { diff --git a/vars/nginx.vars b/vars/nginx.vars index 0fbb5a34..1ce96bec 100644 --- a/vars/nginx.vars +++ b/vars/nginx.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_nginx_configure() { diff --git a/vars/nullmailer.vars b/vars/nullmailer.vars index c0815ab1..e1743c04 100644 --- a/vars/nullmailer.vars +++ b/vars/nullmailer.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_nullmailer_configure_autotools_pre() { diff --git a/vars/openbsd_baseutils.vars b/vars/openbsd_baseutils.vars index f77a0c61..3c2d7f24 100644 --- a/vars/openbsd_baseutils.vars +++ b/vars/openbsd_baseutils.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_openbsd_baseutils_build() { diff --git a/vars/openjpeg.vars b/vars/openjpeg.vars index 11d363c5..e05debf0 100644 --- a/vars/openjpeg.vars +++ b/vars/openjpeg.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_openjpeg_configure() { diff --git a/vars/perl.vars b/vars/perl.vars index 3e2a4fef..98c75f6e 100644 --- a/vars/perl.vars +++ b/vars/perl.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_perl_fetch_extract_post() { diff --git a/vars/pkgconf_host.vars b/vars/pkgconf_host.vars index b3923a26..ed619639 100644 --- a/vars/pkgconf_host.vars +++ b/vars/pkgconf_host.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_pkgconf_host_install_make_post() { diff --git a/vars/procps_ng.vars b/vars/procps_ng.vars index 754461a0..a09852f3 100644 --- a/vars/procps_ng.vars +++ b/vars/procps_ng.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_PROCPS_NG_CONFIG_CACHE_EXTRA:=" diff --git a/vars/psxstub_host.vars b/vars/psxstub_host.vars index d41fde58..835c8285 100644 --- a/vars/psxstub_host.vars +++ b/vars/psxstub_host.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_psxstub_install_make() { diff --git a/vars/python2.vars b/vars/python2.vars index 01a8729b..52912551 100644 --- a/vars/python2.vars +++ b/vars/python2.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_python2_fetch_download() { diff --git a/vars/python2_host.vars b/vars/python2_host.vars index c5c4eb21..05d0c263 100644 --- a/vars/python2_host.vars +++ b/vars/python2_host.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_python2_host_fetch_download() { diff --git a/vars/python3.vars b/vars/python3.vars index 7b21a866..5edc9f87 100644 --- a/vars/python3.vars +++ b/vars/python3.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_python3_fetch_download() { diff --git a/vars/python3_host.vars b/vars/python3_host.vars index 4910fdd0..048f5023 100644 --- a/vars/python3_host.vars +++ b/vars/python3_host.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_python3_host_fetch_download() { diff --git a/vars/rc.vars b/vars/rc.vars index 1eca08f6..2b82de51 100644 --- a/vars/rc.vars +++ b/vars/rc.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_RC_CONFIG_CACHE_EXTRA:=" diff --git a/vars/rpm_host.vars b/vars/rpm_host.vars index 1b05fca1..8593d07b 100644 --- a/vars/rpm_host.vars +++ b/vars/rpm_host.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_rpm_host_install_pre() { diff --git a/vars/ruby.vars b/vars/ruby.vars index 55ba881d..00273c1e 100644 --- a/vars/ruby.vars +++ b/vars/ruby.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_ruby_install_make_pre() { diff --git a/vars/sdl1.vars b/vars/sdl1.vars index 9dbb8df4..11cb139e 100644 --- a/vars/sdl1.vars +++ b/vars/sdl1.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_sdl1_configure_autotools_pre() { diff --git a/vars/smallbasic.vars b/vars/smallbasic.vars index 5dc9e4e0..f15da5bc 100644 --- a/vars/smallbasic.vars +++ b/vars/smallbasic.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_SMALLBASIC_CONFIG_CACHE_EXTRA:=" diff --git a/vars/tcl.vars b/vars/tcl.vars index 2b2be6ed..921d447a 100644 --- a/vars/tcl.vars +++ b/vars/tcl.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_TCL_CONFIG_CACHE_EXTRA:=" diff --git a/vars/tdnf.vars b/vars/tdnf.vars index f3b53f3c..60936bb4 100644 --- a/vars/tdnf.vars +++ b/vars/tdnf.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_tdnf_configure_autotools_pre() { diff --git a/vars/texinfo.vars b/vars/texinfo.vars index 82825961..59a60fea 100644 --- a/vars/texinfo.vars +++ b/vars/texinfo.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_texinfo_build_pre() { diff --git a/vars/texinfo_host.vars b/vars/texinfo_host.vars index 18a0c0f1..5aa6f961 100644 --- a/vars/texinfo_host.vars +++ b/vars/texinfo_host.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_texinfo_host_install_make_post() { diff --git a/vars/tzdb_host.vars b/vars/tzdb_host.vars index ce77848b..9a609129 100644 --- a/vars/tzdb_host.vars +++ b/vars/tzdb_host.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # pkg_tzdb_host_install_pre() { diff --git a/vars/util_linux.vars b/vars/util_linux.vars index db3e2da4..ba4d30e8 100644 --- a/vars/util_linux.vars +++ b/vars/util_linux.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_UTIL_LINUX_CONFIG_CACHE_EXTRA:=" diff --git a/vars/vim.vars b/vars/vim.vars index d1739ff9..414a7c3b 100644 --- a/vars/vim.vars +++ b/vars/vim.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_VIM_CONFIG_CACHE_EXTRA:=" diff --git a/vars/w3m.vars b/vars/w3m.vars index c9a4d923..898fb6b3 100644 --- a/vars/w3m.vars +++ b/vars/w3m.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_W3M_CONFIG_CACHE_EXTRA:=" diff --git a/vars/xcb.vars b/vars/xcb.vars index c734a4dd..bae1e2d2 100644 --- a/vars/xcb.vars +++ b/vars/xcb.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_XCB_CONFIG_CACHE_EXTRA:=" diff --git a/vars/yabasic.vars b/vars/yabasic.vars index a180a16e..1168342a 100644 --- a/vars/yabasic.vars +++ b/vars/yabasic.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_YABASIC_CONFIG_CACHE_EXTRA:=" diff --git a/vars/zsh.vars b/vars/zsh.vars index 99e3f003..2ebbfbe3 100644 --- a/vars/zsh.vars +++ b/vars/zsh.vars @@ -1,5 +1,5 @@ # -# set -o errexit -o noglob are assumed. +# set +o errexit -o noglob is assumed. # : ${PKG_ZSH_CONFIG_CACHE_EXTRA:=" |