diff options
Diffstat (limited to 'subr')
-rw-r--r-- | subr/pre_prereqs.subr | 39 | ||||
-rw-r--r-- | subr/pre_subdirs.subr | 33 | ||||
-rw-r--r-- | subr/rtl.subr | 11 |
3 files changed, 83 insertions, 0 deletions
diff --git a/subr/pre_prereqs.subr b/subr/pre_prereqs.subr new file mode 100644 index 00000000..c5a965b3 --- /dev/null +++ b/subr/pre_prereqs.subr @@ -0,0 +1,39 @@ +# +# . ./build.vars and set -o errexit -o noglob are assumed. +# + +pre_prereqs() { + for __ in ${CHECK_PATH_VARS}; do + if [ -z "${___:=$(get_var_unsafe "${__}")}" ]; then + log_msg failexit "Error: variable \`${__}' is empty or unset."; + elif [ "${___#* *}" != "${___}" ]; then + log_msg failexit "Error: variable \`${__}' contains one or more whitespace characters."; + fi; + done; + for __ in ${CHECK_PREREQ_CMDS} $(eval echo ${CHECK_PREREQ_FILES_DYNAMIC}) ${CHECK_PREREQ_FILES}; do + if [ "${__#/}" != "${__}" ]; then + if [ ! -e "${__}" ]; then + log_msg fail "Error: missing prerequisite file \`${__}'."; + __exit=1; + fi; + else + if ! test_cmd "${__}"; then + log_msg fail "Error: missing prerequisite command \`${__}'."; + __exit=1; + fi; + fi; + done; + for __ in ${CHECK_PREREQ_PERL_MODULES}; do + if ! perl -M"${__}" -e "" 2>/dev/null; then + log_msg fail "Error: missing prerequisite Perl module \`${__}'."; + __exit=1; + fi; + done; + if [ ${__exit:-0} = 1 ]; then + exit 1; + elif [ -n "${__exit}" ]; then + unset __exit; + fi; +}; + +# vim:filetype=sh diff --git a/subr/pre_subdirs.subr b/subr/pre_subdirs.subr new file mode 100644 index 00000000..81b89d06 --- /dev/null +++ b/subr/pre_subdirs.subr @@ -0,0 +1,33 @@ +# +# . ./build.vars and set -o errexit -o noglob are assumed. +# + +post_subdirs() { + if [ ${ARG_CLEAN:-0} -eq 1 ]; then + log_msg info "-c specified, cleaning prefix..."; + for __ in ${CLEAR_PREFIX_DIRS}; do + if [ -e ${PREFIX}/${__} ]; then + secure_rm ${PREFIX}/${__}; + fi; + done; + fi; + install_files \ + /=${DLCACHEDIR} \ + /=${WORKDIR} \ + /=${PREFIX} \ + /=${PREFIX}/x86_64-w64-mingw32/mingw/include \ + /=${PREFIX_CROSS} \ + /=${PREFIX_MINIPIX}/bin \ + /=${PREFIX_NATIVE} \ + /=${PREFIX_TARGET}/lib \ + @.=${PREFIX}/usr \ + @.=${PREFIX}/x86_64-w64-mingw32/mingw \ + @.=${PREFIX_NATIVE}/usr \ + @bin=${PREFIX_MINIPIX}/lib \ + @bin=${PREFIX_MINIPIX}/libexec \ + @bin=${PREFIX_MINIPIX}/share \ + @share/man=${PREFIX}/man \ + @share/man=${PREFIX_NATIVE}/man; +}; + +# vim:filetype=sh diff --git a/subr/rtl.subr b/subr/rtl.subr index 90faa3c9..4779af8c 100644 --- a/subr/rtl.subr +++ b/subr/rtl.subr @@ -262,4 +262,15 @@ set_env_vars_with_sep() { done; unset _sevws_sep; pop_IFS; }; +subst_tgts() { + while [ ${#} -ge 1 ]; do + case "${1}" in + devroot) + echo ${DEVROOT_PACKAGES}; ;; + world) echo ${WORLD_PACKAGES}; ;; + *) echo ${1}; ;; + esac; shift; + done; +}; + # vim:filetype=sh |