From ed4109698b2e5ff64d7f8d8c5349b512a6d2de3c Mon Sep 17 00:00:00 2001 From: Lucio Andrés Illanes Albornoz Date: Jan 19 2019 18:33:11 +0000 Subject: build.sh, subr/build_checks.subr, vars/midipix.vars: removes ${DEFAULT_CHECK_PREREQ_{CMDS,FILES{,_DYNAMIC},PERL_MODULES}}. etc/build.usage: update target list. subr/build_checks.subr: merges remaining checks into subr/build_init.subr. --- diff --git a/build.sh b/build.sh index 146ac4b..d8c6d9c 100755 --- a/build.sh +++ b/build.sh @@ -7,7 +7,7 @@ buildp_dispatch() { _build_tgt_meta="" _build_tgt_lc="" _build_tgts_lc=""_pkg_restart="" _pkgs_found=""; case "${_msg}" in # Top-level - start_build) shift; build_args "${@}"; build_init; build_checks; + start_build) shift; build_args "${@}"; build_init; ex_rtl_log_set_vnfo_lvl "${ARG_VERBOSE:-0}"; 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}; diff --git a/etc/build.usage b/etc/build.usage index b065e18..4f2c02f 100644 --- a/etc/build.usage +++ b/etc/build.usage @@ -35,11 +35,10 @@ usage: ./build.sh [-a nt32|nt64] [-b debug|release] [-C dir[,..]] [-D kind[,..]] -v[v[v[v]]] Be verbose; -vv: always print package logs; -vvv: set xtrace during package builds; -vvvv: logs fileops. --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. - [ ..] 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. + [ ..] One of: host_packages_deps, host_toolchain, host_toolchain_deps, host_toolchain_mingw32, + host_tools, host_tools_deps, host_tools_rpm, minipix, native_packages, native_packages_deps, + native_packages_deps_x11, native_runtime, native_toolchain, native_toolchain_deps, + native_toolchain_mingw32, and/or native_tools. ${HOME}/midipix_build.vars, ${HOME}/.midipix_build.vars, and/or ../midipix_build.vars will be sourced if present. diff --git a/subr/build_checks.subr b/subr/build_checks.subr deleted file mode 100644 index 1955d58..0000000 --- a/subr/build_checks.subr +++ /dev/null @@ -1,44 +0,0 @@ -# -# set -o noglob is assumed. -# - -build_checks() { - local __="" _exit="" _pname=""; - for __ in ${DEFAULT_CHECK_PATH_VARS}; do - if [ -z "${___:=$(ex_rtl_get_var_unsafe "${__}")}" ]; then - ex_rtl_log_msg failexit "Error: variable \`${__}' is empty or unset."; - elif [ "${___#* *}" != "${___}" ]; then - ex_rtl_log_msg failexit "Error: variable \`${__}' contains one or more whitespace characters."; - fi; - done; - for __ in ${DEFAULT_CHECK_PREREQ_CMDS} $(eval echo ${DEFAULT_CHECK_PREREQ_FILES_DYNAMIC}) ${DEFAULT_CHECK_PREREQ_FILES}; do - if [ "${__#/}" != "${__}" ]; then - if [ ! -e "${__}" ]; then - ex_rtl_log_msg fail "Error: missing prerequisite file \`${__}'."; - _exit=1; - fi; - else - if ! ex_rtl_test_cmd "${__}"; then - ex_rtl_log_msg fail "Error: missing prerequisite command \`${__}'."; - _exit=1; - fi; - fi; - done; - for __ in ${DEFAULT_CHECK_PREREQ_PERL_MODULES}; do - if ! perl -M"${__}" -e "" 2>/dev/null; then - ex_rtl_log_msg fail "Error: missing prerequisite Perl module \`${__}'."; - _exit=1; - fi; - done; - if [ ${_exit:-0} = 1 ]; then - exit 1; - fi; - 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; - fi; -}; - -# vim:filetype=sh diff --git a/subr/build_init.subr b/subr/build_init.subr index c7ec7d4..3bd6af1 100644 --- a/subr/build_init.subr +++ b/subr/build_init.subr @@ -9,7 +9,7 @@ build_fini() { }; build_init() { - local __="" _env_vars="" _env_vars_except="" _env_var="" _log_last_fname="" _log_last_ts=""; + local __="" _env_vars="" _env_vars_except="" _env_var="" _log_last_fname="" _log_last_ts="" _vname="" _vname_val=""; set -o noglob; umask 022; if [ -z "${DEFAULT_BUILD_CPUS}" ]\ && [ -e /proc/cpuinfo ]; then @@ -84,6 +84,20 @@ build_init() { HUP INT TERM USR1 USR2; trap "rm -f "${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}";" \ EXIT; + for _vname in ${DEFAULT_CHECK_PATH_VARS}; do + _vname_val="$(ex_rtl_get_var_unsafe "${_vname}")"; + if [ -z "${_vname_val}" ]; then + ex_rtl_log_msg failexit "Error: variable \`${_vname}' is empty or unset."; + elif [ "${_vname_val#* *}" != "${_vname_val}" ]; then + ex_rtl_log_msg failexit "Error: variable \`${_vname}' contains one or more whitespace characters."; + fi; + done; + 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; + fi; }; # vim:filetype=sh diff --git a/vars/midipix.vars b/vars/midipix.vars index f7cbcd6..7a779d5 100644 --- a/vars/midipix.vars +++ b/vars/midipix.vars @@ -18,10 +18,14 @@ : ${PREFIX_RPM:=${PREFIX}/rpm}; : ${BUILD_DLCACHEDIR:=${PREFIX_ROOT}/dlcache}; : ${BUILD_WORKDIR:=${PREFIX}/tmp}; -: ${DEFAULT_LOG_ENV_VARS:=" - ARCH BUILD BUILD_DLCACHEDIR BUILD_WORKDIR DEFAULT_GITROOT - HOME PATH PREFIX PREFIX_CROSS PREFIX_MINGW32 PREFIX_MINIPIX - PREFIX_NATIVE USER"}; +: ${DEFAULT_CHECK_PATH_VARS:=" + PREFIX PREFIX_NATIVE PREFIX_CROSS BUILD_DLCACHEDIR BUILD_WORKDIR"}; +: ${DEFAULT_CLEAR_ENV_VARS_EXCEPT:=" + HOME PATH TERM DEFAULT_TARBALL_SIGN_GPG_KEY USER"}; +: ${DEFAULT_CLEAR_PREFIX_PATHS:=" + bin i686-nt32-midipix doc include info lib lib64 libexec man minipix minipix_dist native + rpm sbin share tmp usr x86_64-nt64-midipix x86_64-w64-mingw32 pkglist.cross pkglist.host + pkglist.native SHA256SUMS SHA256SUMS.last"}; : ${DEFAULT_INSTALL_FILES_DESTDIR:=" /=bin /=include /=lib /=lib/pkgconfig /=sbin /=share /=share/doc /=share/info /=share/man @@ -33,6 +37,10 @@ @share/man=man @../lib/pkgconfig=share/pkgconfig @.=usr"}; +: ${DEFAULT_LOG_ENV_VARS:=" + ARCH BUILD BUILD_DLCACHEDIR BUILD_WORKDIR DEFAULT_GITROOT + HOME PATH PREFIX PREFIX_CROSS PREFIX_MINGW32 PREFIX_MINIPIX + PREFIX_NATIVE USER"}; # Default flags & variables : ${DEFAULT_BUILD_CPUS:=}; @@ -88,24 +96,4 @@ : ${DEFAULT_TARBALL_MINIPIX_FNAME_PREFIX:=minipix-${ARCH}-${BUILD}.}; : ${DEFAULT_ZIPDIST_FNAME_PREFIX:=midipix-${ARCH}-${BUILD}.}; -# Check & clear predicates -: ${DEFAULT_CHECK_PATH_VARS:=" - PREFIX PREFIX_NATIVE PREFIX_CROSS DLCACHEDIR WORKDIR"}; -: ${DEFAULT_CHECK_PREREQ_CMDS:=" - aclocal autoconf autopoint awk basename bunzip2 find flex gcc git groff gunzip install - ld libtool lzma make makeinfo msgfmt nl nroff openssl paste patch python sed sha256sum - sort tar tee tic tr uname wget xz"}; -: ${DEFAULT_CHECK_PREREQ_FILES_DYNAMIC:=' - /usr/share/groff/$(groff -v 2>/dev/null | awk '\''/^GNU groff version /{print $NF}'\'')/tmac/e.tmac'}; -: ${DEFAULT_CHECK_PREREQ_FILES:=" - /usr/include/gmpxx.h /usr/include/mpc.h /usr/include/mpfr.h"}; -: ${DEFAULT_CHECK_PREREQ_PERL_MODULES:=" - autodie ExtUtils::MakeMaker"}; -: ${DEFAULT_CLEAR_ENV_VARS_EXCEPT:=" - HOME PATH TERM DEFAULT_TARBALL_SIGN_GPG_KEY USER"}; -: ${DEFAULT_CLEAR_PREFIX_PATHS:=" - bin i686-nt32-midipix doc include info lib lib64 libexec man minipix minipix_dist native - rpm sbin share tmp usr x86_64-nt64-midipix x86_64-w64-mingw32 pkglist.cross pkglist.host - pkglist.native SHA256SUMS SHA256SUMS.last"}; - # vim:filetype=sh textwidth=0