diff options
-rwxr-xr-x | build.sh | 12 | ||||
-rw-r--r-- | etc/build.usage | 86 | ||||
-rw-r--r-- | subr/build_args.subr | 5 | ||||
-rw-r--r-- | subr/build_checks.subr | 4 | ||||
-rw-r--r-- | subr/build_init.subr | 6 | ||||
-rw-r--r-- | subr/ex_rtl_fetch.subr | 10 | ||||
-rw-r--r-- | subr/pkg_fetch_download.subr (renamed from subr/pkg_fetch_wget.subr) | 5 | ||||
-rw-r--r-- | subr/pkg_fetch_git.subr | 11 | ||||
-rw-r--r-- | subr/pkg_install_strip.subr | 28 | ||||
-rw-r--r-- | vars/env.vars | 2 | ||||
-rw-r--r-- | vars/midipix.vars | 1 | ||||
-rw-r--r-- | vars/musl.vars | 22 | ||||
-rw-r--r-- | vars/python2.vars | 4 | ||||
-rw-r--r-- | vars/python2_host.vars | 4 | ||||
-rw-r--r-- | vars/python3.vars | 4 | ||||
-rw-r--r-- | vars/python3_host.vars | 4 |
16 files changed, 99 insertions, 109 deletions
@@ -82,18 +82,6 @@ buildp_dispatch() { ex_rtl_log_env_vars "build" \ $(set | awk -F= '/^PKG_/{print $1}' | sort); fi; - if [ "${ARG_DEBUG_MINIPIX:-0}" -eq 1 ]\ - && [ "${_tgt_name}" = "dist_minipix" ]; then - PKG_BUILD_STEPS="$(ex_rtl_lfilter_not \ - "${PKG_BUILD_STEPS}" "strip")"; - elif [ "${BUILD}" = release ]; then - PKG_BUILD_STEPS="$(ex_rtl_lfilter_not \ - "${PKG_BUILD_STEPS}" "strip")"; - fi; - if [ "${ARG_OFFLINE:-0}" -eq 1 ]; then - PKG_BUILD_STEPS="$(ex_rtl_lfilter_not \ - "${PKG_BUILD_STEPS}" "fetch_git fetch_wget")"; - fi; if [ "${ARG_XTRACE:-0}" -eq 1 ]; then set -o xtrace; fi; ;; diff --git a/etc/build.usage b/etc/build.usage index bd77ae37..4a0a0d1b 100644 --- a/etc/build.usage +++ b/etc/build.usage @@ -1,45 +1,45 @@ -usage: ./build.sh [-4|6] [-a nt32|nt64] [-b debug|release] [-c] [-C dir[,..]] - [-D kind[,..]] [-h] [-N] [-P [jobs]] [-r ALL[:step,..]] - [-r name[,..][:step,..]] [-R] [-v[v[v]]] [-x] - [--as-needed] [--debug-minipix] [<target>[ ..]] - -4|-6 Force IPv[46] when downloading files. - -a nt32|nt64 Selects 32-bit or 64-bit architecture; defaults to nt64. - -b debug|release Selects debug or release build; defaults to debug. - -c Clean ${PREFIX} before processing build scripts. - -C dir[,..] Clean build directory (build,) source directory (src,) and/or - destination directory (dest) after successful package builds. - -D kind[,..] Produce minimal midipix distribution directory (minipix,) package - tarballs (pkg,) RPM binary packages (rpm,) compressed and optionally - signed binary and source tarballs containing ${PREFIX} sans ${BUILD_WORKDIR} - (t{bz2,gz,xz},) and/or deployable distribution ZIP archive (zipdist.) - {t{bz2,gz,xz},zipdist} imply minipix. - -h Show this screen. - -N Offline mode: no {wget,git-{clone,pull}}(1) calls. - -P [jobs] Enables parallelisation at target-level, whenever applicable. - The maximum count of jobs defaults to the number of logical - processors on the host system. - If -R is not specified and at least one (1) package fails to build, - all remaining package builds will be forcibly aborted for convenience. - -r ALL[:step,..] - -r name[,..][:step,..] Restart all packages/the specified comma-separated package(s) - completely or at optionally specified comma-separated step(s). - 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. - -R Ignore build failures, skip printing package logs, and continue - building (relaxed mode.) - -v[v[v]] Be verbose; -vv: always print package logs; -vvv: logs fileops. - -x Set xtrace during package builds; implies -vv. - --as-needed Don't build unless the midipix_build repository has received new commits. - --debug-minipix Don't strip(1) minipix binaries to facilitate debugging minipix. - <target>[ ..] One of: - host or host_tools, host_tools_deps, host_tools_rpm, host_toolchain_deps, host_toolchain, host_toolchain_mingw32, - native or native_tools, native_toolchain_deps, native_toolchain, native_toolchain_mingw32, native_runtime, - packages_deps or host_packages_deps, native_packages_deps, native_packages_deps_x11, - packages or native_packages. +usage: ./build.sh [-a nt32|nt64] [-b debug|release] [-C dir[,..]] [-D kind[,..]] + [-F ipv4|ipv6|offline] [-h] [-P [jobs]] [-r ALL|name[,..][:step,..]] + [-R] [-v[v[v]]] [-x] [--as-needed] [--debug-minipix] [<target>[ ..]] + -a nt32|nt64 Selects 32-bit or 64-bit architecture; defaults to nt64. + -b debug|release Selects debug or release build; defaults to debug. + -C dir[,..] Clean build directory (build,) ${PREFIX} before processing build + scripts (prefix,) source directory (src,) and/or destination directory + (dest) after successful package builds. + -D kind[,..] Produce minimal midipix distribution directory (minipix,) package + tarballs (pkg,) RPM binary packages (rpm,) compressed and optionally + signed binary and source tarballs containing ${PREFIX} sans ${BUILD_WORKDIR} + (t{bz2,gz,xz},) and/or deployable distribution ZIP archive (zipdist.) + {t{bz2,gz,xz},zipdist} imply minipix. + -F ipv4|ipv6|offline + Force IPv4 (ipv4) or IPv6 (ipv6) when downloading package archives + and/or Git repositories or don't download either at all (offline.) + -h Show this screen. + -P [jobs] Enables parallelisation at target-level, whenever applicable. + The maximum count of jobs defaults to the number of logical + processors on the host system. + If -R is not specified and at least one (1) package fails to build, + all remaining package builds will be forcibly aborted for convenience. + -r ALL|name[,..][:step,..] + Restart all packages/the specified comma-separated package(s) + completely or at optionally specified comma-separated step(s). + 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. + -R Ignore build failures, skip printing package logs, and continue + building (relaxed mode.) + -v[v[v]] Be verbose; -vv: always print package logs; -vvv: logs fileops. + -x Set xtrace during package builds; implies -vv. + --as-needed Don't build unless the midipix_build repository has received new commits. + --debug-minipix Don't strip(1) minipix binaries to facilitate debugging minipix. + <target>[ ..] One of: + host or host_tools, host_tools_deps, host_tools_rpm, host_toolchain_deps, host_toolchain, host_toolchain_mingw32, + native or native_tools, native_toolchain_deps, native_toolchain, native_toolchain_mingw32, native_runtime, + packages_deps or host_packages_deps, native_packages_deps, native_packages_deps_x11, + packages or native_packages. ${HOME}/midipix_build.vars, ${HOME}/.midipix_build.vars, and/or ../midipix_build.vars will be sourced if present. @@ -50,5 +50,5 @@ usage: ./build.sh [-4|6] [-a nt32|nt64] [-b debug|release] [-c] [-C dir[,..]] ./build.sh -r coreutils:configure,build,install Restart the configure, build, and install steps of the coreutils build. - ./build.sh -c -r ALL DEFAULT_GITROOT_HEAD=... + ./build.sh -C prefix -r ALL DEFAULT_GITROOT_HEAD=... Clean ${PREFIX} and forcibly rebuild everything. diff --git a/subr/build_args.subr b/subr/build_args.subr index 2f18a5dd..7f84414a 100644 --- a/subr/build_args.subr +++ b/subr/build_args.subr @@ -4,14 +4,11 @@ BUILD_ARGS_SPEC=" ARCH:arg:-a: - ARG_IPV4_ONLY:-4: - ARG_IPV6_ONLY:-6: ARG_AS_NEEDED:--as-needed: - ARG_CLEAN:-c: ARG_CLEAN_BUILDS:arg:-C: ARG_DEBUG_MINIPIX:--debug-minipix: ARG_DIST:arg:-D: - ARG_OFFLINE:-N: + ARG_FETCH_FORCE:-F: ARG_PARALLEL:optarg:-P:auto ARG_RELAXED:-R: ARG_RESTART:arg:-r: diff --git a/subr/build_checks.subr b/subr/build_checks.subr index b0ba88b8..1955d585 100644 --- a/subr/build_checks.subr +++ b/subr/build_checks.subr @@ -33,8 +33,8 @@ build_checks() { if [ ${_exit:-0} = 1 ]; then exit 1; fi; - if [ ${ARG_CLEAN:-0} -eq 1 ]; then - ex_rtl_log_msg info "-c specified, cleaning prefix..."; + 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}; done; diff --git a/subr/build_init.subr b/subr/build_init.subr index 34fa6b68..c7ec7d4f 100644 --- a/subr/build_init.subr +++ b/subr/build_init.subr @@ -40,9 +40,11 @@ build_init() { exit 0; fi; export PATH="${PREFIX}/bin${PATH:+:${PATH}}"; - if [ ${ARG_IPV4_ONLY:-0} -eq 1 ]; then + if [ "${ARG_FETCH_FORCE}" = "ipv4" ]; then + DEFAULT_GIT_ARGS="-4${DEFAULT_GIT_ARGS:+ ${DEFAULT_GIT_ARGS}}"; DEFAULT_WGET_ARGS="-4${DEFAULT_WGET_ARGS:+ ${DEFAULT_WGET_ARGS}}"; - elif [ ${ARG_IPV6_ONLY:-0} -eq 1 ]; then + elif [ "${ARG_FETCH_FORCE}" = "ipv6" ]; then + DEFAULT_GIT_ARGS="-6${DEFAULT_GIT_ARGS:+ ${DEFAULT_GIT_ARGS}}"; DEFAULT_WGET_ARGS="-6${DEFAULT_WGET_ARGS:+ ${DEFAULT_WGET_ARGS}}"; fi; _env_vars="$(export | sed -e 's/^export //' -e 's/=.*$//')"; diff --git a/subr/ex_rtl_fetch.subr b/subr/ex_rtl_fetch.subr index 5b063469..2468fb6b 100644 --- a/subr/ex_rtl_fetch.subr +++ b/subr/ex_rtl_fetch.subr @@ -7,9 +7,9 @@ exp_rtl_fetch_url_git() { _oldpwd=""; if [ -e "${BUILD_DLCACHEDIR}/${_subdir}" ]; then (ex_rtl_fileop cd "${BUILD_DLCACHEDIR}/${_subdir}" &&\ - git pull origin "${_branch:-main}"); + git pull ${DEFAULT_GIT_ARGS} origin "${_branch:-main}"); else - git clone "${_url}" "${BUILD_DLCACHEDIR}/${_subdir}"; + git clone ${DEFAULT_GIT_ARGS} "${_url}" "${BUILD_DLCACHEDIR}/${_subdir}"; if [ -n "${_branch}" ]; then (ex_rtl_fileop cd "${BUILD_DLCACHEDIR}/${_subdir}" &&\ git checkout "${_branch}"); @@ -24,6 +24,9 @@ exp_rtl_fetch_url_git() { ex_rtl_fetch_urls_git() { local _tgtdir="" _url_spec="" _subdir="" _url="" _git_branch=""; _tgtdir="${1}"; shift; + if [ "${ARG_FETCH_FORCE}" = "offline" ]; then + return 0; + fi; for _url_spec in "${@}"; do _subdir="${_url_spec%=*}"; _url="${_url_spec#*=}"; @@ -39,6 +42,9 @@ ex_rtl_fetch_urls_git() { # N.B. URLs ($1) may contain `?' or '&' characters. ex_rtl_fetch_url_wget() { local _url="${1}" _sha256sum_src="${2}" _sha256sum_dst=""; + if [ "${ARG_FETCH_FORCE}" = "offline" ]; then + return 0; + fi; if [ -z "${3}" ]; then _url_dst="${BUILD_DLCACHEDIR}/$(ex_rtl_basename "${_url}")"; else diff --git a/subr/pkg_fetch_wget.subr b/subr/pkg_fetch_download.subr index 56fe79d3..5774d2e4 100644 --- a/subr/pkg_fetch_wget.subr +++ b/subr/pkg_fetch_download.subr @@ -2,10 +2,13 @@ # set -o errexit -o noglob are assumed. # -pkg_fetch_wget() { +pkg_fetch_download() { if [ -n "${PKG_URL}" ]; then ex_rtl_fetch_url_wget "${PKG_URL}" "${PKG_SHA256SUM}" "${PKG_FNAME}"; fi; + if [ -n "${PKG_URLS_GIT}" ]; then + ex_rtl_fetch_urls_git "${PKG_BASE_DIR}" ${PKG_URLS_GIT}; + fi; }; # vim:filetype=sh diff --git a/subr/pkg_fetch_git.subr b/subr/pkg_fetch_git.subr deleted file mode 100644 index 67c05458..00000000 --- a/subr/pkg_fetch_git.subr +++ /dev/null @@ -1,11 +0,0 @@ -# -# set -o errexit -o noglob are assumed. -# - -pkg_fetch_git() { - if [ -n "${PKG_URLS_GIT}" ]; then - ex_rtl_fetch_urls_git "${PKG_BASE_DIR}" ${PKG_URLS_GIT}; - fi; -}; - -# vim:filetype=sh diff --git a/subr/pkg_install_strip.subr b/subr/pkg_install_strip.subr index 2709e77d..5b34d70e 100644 --- a/subr/pkg_install_strip.subr +++ b/subr/pkg_install_strip.subr @@ -2,19 +2,23 @@ # set -o errexit -o noglob are assumed. # -pkg_strip() { - local _tree_root="${PKG_DESTDIR}/bin" _bin_path=""; - if [ ! -e "${_tree_root}" ]; then - return; - fi; - for _bin_path in $(find "${_tree_root}" -perm /a=x \ - \( -type f -or -type l \)); 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}; +pkg_install_strip() { + local _tree_root="${PKG_DESTDIR}" _bin_path=""; + if [ -e "${_tree_root}" ]\ + && [ "${BUILD}" != release ]; then + if [ "${PKG_NAME%_minipix}" != "${PKG_NAME}" ]\ + && [ "${ARG_DEBUG_MINIPIX:-0}" -eq 1 ]; then + return; fi; - done; + for _bin_path in $(find "${_tree_root}" -perm /a=x \ + \( -type f -or -type l \)); 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/vars/env.vars b/vars/env.vars index 1f1c7f1e..7e7b6d50 100644 --- a/vars/env.vars +++ b/vars/env.vars @@ -1,5 +1,5 @@ DEFAULT_BUILD_STEPS=" - fetch_wget fetch_git fetch_extract fetch \ + fetch_download fetch_extract \ configure_patch_pre configure_autotools configure_patch configure \ build \ install_subdirs install_make install_files install_libs \ diff --git a/vars/midipix.vars b/vars/midipix.vars index 55df1d79..471670ca 100644 --- a/vars/midipix.vars +++ b/vars/midipix.vars @@ -51,6 +51,7 @@ : ${DEFAULT_GITROOT_HEAD:=git://midipix.org}; : ${DEFAULT_MAKE_INSTALL_VNAME:=DESTDIR}; : ${DEFAULT_MAKEFLAGS_BUILD:=-j${DEFAULT_BUILD_CPUS}}; +: ${DEFAULT_GIT_ARGS:=""}; : ${DEFAULT_WGET_ARGS:="--no-check-certificate"}; # Target-relative defaults diff --git a/vars/musl.vars b/vars/musl.vars index 97ee5cc5..5b2b984d 100644 --- a/vars/musl.vars +++ b/vars/musl.vars @@ -2,22 +2,22 @@ # set -o errexit -o noglob are assumed. # -pkgp_mmglue_fetch_git() { +pkgp_mmglue_fetch_download() { ex_rtl_fileop rm "${PKG_BASE_DIR}/mmglue"; ex_rtl_fetch_urls_git "${PKG_BASE_DIR}/build" "mmglue=${DEFAULT_GITROOT}/mmglue@main"; - ex_pkg_state_set "${PKG_NAME}" fetch -extract; + ex_pkg_state_set "${PKG_NAME}" fetch_download -fetch_extract; }; -pkg_musl_no_complex_host_fetch_git() { - pkgp_mmglue_fetch_git -} +pkg_musl_full_fetch_download() { + pkgp_mmglue_fetch_download; +}; -pkg_musl_full_host_fetch_git() { - pkgp_mmglue_fetch_git -} +pkg_musl_full_host_fetch_download() { + pkgp_mmglue_fetch_download; +}; -pkg_musl_full_fetch_git() { - pkgp_mmglue_fetch_git -} +pkg_musl_no_complex_host_fetch_download() { + pkgp_mmglue_fetch_download; +}; # vim:filetype=sh diff --git a/vars/python2.vars b/vars/python2.vars index aee9d6c6..6e13843e 100644 --- a/vars/python2.vars +++ b/vars/python2.vars @@ -2,10 +2,10 @@ # set -o errexit -o noglob are assumed. # -pkg_python2_fetch_git() { +pkg_python2_fetch_download() { ex_rtl_fileop rm "${PKG_BASE_DIR}/sbpython2"; ex_rtl_fetch_urls_git "${PKG_BASE_DIR}/build" "sbpython2=${DEFAULT_GITROOT}/python/sbpython2@main"; - ex_pkg_state_set "${PKG_NAME}" fetch -extract; + ex_pkg_state_set "${PKG_NAME}" fetch_download -fetch_extract; }; # vim:filetype=sh diff --git a/vars/python2_host.vars b/vars/python2_host.vars index 99f79636..c6343f20 100644 --- a/vars/python2_host.vars +++ b/vars/python2_host.vars @@ -2,10 +2,10 @@ # set -o errexit -o noglob are assumed. # -pkg_python2_host_fetch_git() { +pkg_python2_host_fetch_download() { ex_rtl_fileop rm "${PKG_BASE_DIR}/sbpython2"; ex_rtl_fetch_urls_git "${PKG_BASE_DIR}/build" "sbpython2=${DEFAULT_GITROOT}/python/sbpython2@main"; - ex_pkg_state_set "${PKG_NAME}" fetch -extract; + ex_pkg_state_set "${PKG_NAME}" fetch_download -fetch_extract; }; # vim:filetype=sh diff --git a/vars/python3.vars b/vars/python3.vars index da82bfcd..100a1b05 100644 --- a/vars/python3.vars +++ b/vars/python3.vars @@ -2,10 +2,10 @@ # set -o errexit -o noglob are assumed. # -pkg_python3_fetch_git() { +pkg_python3_fetch_download() { ex_rtl_fileop rm "${PKG_BASE_DIR}/sbpython3"; ex_rtl_fetch_urls_git "${PKG_BASE_DIR}/build" "sbpython3=${DEFAULT_GITROOT}/python/sbpython3@main"; - ex_pkg_state_set "${PKG_NAME}" fetch -extract; + ex_pkg_state_set "${PKG_NAME}" fetch_download -fetch_extract; }; # vim:filetype=sh diff --git a/vars/python3_host.vars b/vars/python3_host.vars index f0063efe..f2c72716 100644 --- a/vars/python3_host.vars +++ b/vars/python3_host.vars @@ -2,10 +2,10 @@ # set -o errexit -o noglob are assumed. # -pkg_python3_host_fetch_git() { +pkg_python3_host_fetch_download() { ex_rtl_fileop rm "${PKG_BASE_DIR}/sbpython3"; ex_rtl_fetch_urls_git "${PKG_BASE_DIR}/build" "sbpython3=${DEFAULT_GITROOT}/python/sbpython3@main"; - ex_pkg_state_set "${PKG_NAME}" fetch -extract; + ex_pkg_state_set "${PKG_NAME}" fetch_download -fetch_extract; }; # vim:filetype=sh |