summaryrefslogtreecommitdiffhomepage
path: root/subr
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz (arab, vxp) <l.illanes@gmx.de>2017-02-03 05:10:58 +0100
committerLucio Andrés Illanes Albornoz (arab, vxp) <l.illanes@gmx.de>2017-02-03 05:10:58 +0100
commitd1adc7c60425c2b34039f713881c3cdf75534ef1 (patch)
tree581d39b028c06b78094de6443ec915e4c20c9f5d /subr
parent61157302e0041eddd9f87720b4282c2e8f071f70 (diff)
downloadmidipix_build-d1adc7c60425c2b34039f713881c3cdf75534ef1.tar.bz2
midipix_build-d1adc7c60425c2b34039f713881c3cdf75534ef1.tar.xz
build.sh, subr/pre_{prereqs,subdirs}.subr: moved prereqs/subdirs code into subr/pre_*.subr.
subr/rtl.subr: move subst_tgts() back.
Diffstat (limited to 'subr')
-rw-r--r--subr/pre_prereqs.subr39
-rw-r--r--subr/pre_subdirs.subr33
-rw-r--r--subr/rtl.subr11
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