From a44f58f1c69eb041700f650583d74b0a4d5337ef Mon Sep 17 00:00:00 2001 From: Lucio Andrés Illanes Albornoz (arab, vxp) Date: Nov 21 2017 17:09:19 +0000 Subject: subr/pkg_setup_distclean.subr: rm(1) ${PKG_BASE_DIR} on-demand. etc/build.usage: updated. subr/pkg_setup_{env,subdirs}.subr: split {cd,mkdir}(1) sequence into setup_env_subdirs. vars/env.vars: adds setup_distclean:variant & setup_subdirs:invariant build steps. --- diff --git a/etc/build.usage b/etc/build.usage index 6993ed7..c68dc4c 100644 --- a/etc/build.usage +++ b/etc/build.usage @@ -9,18 +9,21 @@ usage: ./build.sh [-x] [-4|6] [-a nt32|nt64] [-b debug|release] [-c] [-h] -h Show this screen. -i Ignore SHA256 hash mismatches when downloading files. -N Offline mode: no {wget,git-{clone,pull}}(1) calls. - -r package[,...][:step] Restart the specified comma-separated build(s) completely or at - the optionally specified step. Currently defined steps are: - fetch_wget, fetch_git, fetch_extract, configure_patch_pre, - configure_autotools, configure_patch, configure, build_clean, - build, install_subdirs, install_make, install_files, install_libs, - install_pkgconfig, install_purge_la, install_strip, and install. + -r package[,...][:step] Restart the specified comma-separated build(s) completely + or at the optionally specified step. Currently defined + steps are: + setup_distclean, fetch_wget, fetch_git, fetch_extract, + configure_patch_pre, configure_autotools, configure_patch, + configure, build_clean, build, install_subdirs, install_make, + install_files, install_libs, install_pkgconfig, install_purge_la, + install_strip, and install. -R Ignore build failures and continue building (relaxed mode.) - -t[.gz|.bz2|.xz] Produce binary distribution and source tarballs containing ${PREFIX} - sans ${WORKDIR} and ${PREFIX}/src/midipix_build and ${WORKDIR} sans top- - level regular files at the end of a build with zero failures. The - tarballs will be compressed with either gzip, bzip2, or xz and signed - with GPG; the default compression is xz. + -t[.gz|.bz2|.xz] Produce binary distribution and source tarballs containing + ${PREFIX} sans ${WORKDIR} and ${PREFIX}/src/midipix_build + and ${WORKDIR} sans top-level regular files at the end of + a build with zero failures. The tarballs will be compressed + with either gzip, bzip2, or xz and signed with GPG; the + default compression is xz. -v Be verbose. --debug-minipix Don't strip(1) minipix binaries to facilitate debugging minipix. [ ...] One of: diff --git a/subr/pkg_setup_distclean.subr b/subr/pkg_setup_distclean.subr new file mode 100644 index 0000000..fc5999c --- /dev/null +++ b/subr/pkg_setup_distclean.subr @@ -0,0 +1,12 @@ +# +# set -o errexit -o noglob are assumed. +# + +pkg_setup_distclean() { + if [ "$(stat -c %i "${PKG_BASE_DIR}")" \ + != "$(stat -c %i "${WORKDIR}")" ]; then + build_fileop rm "${PKG_BASE_DIR}"; + fi; +}; + +# vim:filetype=sh diff --git a/subr/pkg_setup_env.subr b/subr/pkg_setup_env.subr index a02b1a6..f6d6118 100644 --- a/subr/pkg_setup_env.subr +++ b/subr/pkg_setup_env.subr @@ -53,8 +53,6 @@ pkg_setup_env() { PKG_ENV_VARS="$(echo "${PKG_ENV_VARS}" | tr " " "\n" | sort | tr "\n" " ")"; log_env_vars "build" ${PKG_ENV_VARS}; fi; - build_fileop mkdir "${PKG_BASE_DIR}"; - build_fileop cd "${PKG_BASE_DIR}"; }; # vim:filetype=sh diff --git a/subr/pkg_setup_subdirs.subr b/subr/pkg_setup_subdirs.subr new file mode 100644 index 0000000..1fc279c --- /dev/null +++ b/subr/pkg_setup_subdirs.subr @@ -0,0 +1,10 @@ +# +# set -o errexit -o noglob are assumed. +# + +pkg_setup_subdirs() { + build_fileop mkdir "${PKG_BASE_DIR}"; + build_fileop cd "${PKG_BASE_DIR}"; +}; + +# vim:filetype=sh diff --git a/vars/env.vars b/vars/env.vars index afbff05..6f184cc 100644 --- a/vars/env.vars +++ b/vars/env.vars @@ -16,7 +16,8 @@ : ${PREFIX_CROSS:=${PREFIX}/${TARGET}}; : ${DLCACHEDIR:=${PREFIX_ROOT}/dlcache}; : ${WORKDIR:=${PREFIX}/tmp}; -: ${BUILD_STEPS:="setup_vars:invariant setup_env:invariant all:all +: ${BUILD_STEPS:="setup_vars:invariant setup_env:invariant setup_distclean:variant setup_subdirs:invariant + all:all fetch_wget:dynamic fetch_git:dynamic fetch_extract:dynamic fetch_subdirs:invariant fetch:virtual configure_patch_pre:dynamic configure_autotools:dynamic configure_patch:dynamic configure:dynamic build_clean:variant build:dynamic