summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz (arab, vxp) <l.illanes@gmx.de>2017-02-03 23:49:26 +0100
committerLucio Andrés Illanes Albornoz (arab, vxp) <l.illanes@gmx.de>2017-02-03 23:54:46 +0100
commite2fea1701c9f50beef117f881721626d3f94c5dc (patch)
treee6661d7ccfc429bb92c6620331e73e6a2877a5e0
parent17c3980547f62c21e31dbbdd53a919514aeda5de (diff)
downloadmidipix_build-e2fea1701c9f50beef117f881721626d3f94c5dc.tar.bz2
midipix_build-e2fea1701c9f50beef117f881721626d3f94c5dc.tar.xz
build.sh, subr/{build,pre_*}.subr: general cleanup.
-rwxr-xr-xbuild.sh46
-rw-r--r--subr/post_build_files.subr15
-rw-r--r--subr/pre_build_files.subr15
-rw-r--r--subr/pre_setup_env.subr20
4 files changed, 54 insertions, 42 deletions
diff --git a/build.sh b/build.sh
index 9caaeae6..288f86aa 100755
--- a/build.sh
+++ b/build.sh
@@ -5,9 +5,7 @@
#
#
#
-for __ in subr/*.subr; do
- . ./${__};
-done;
+for __ in subr/*.subr; do . ${__}; done;
while [ ${#} -gt 0 ]; do
case ${1} in
-c) ARG_CLEAN=1; ;;
@@ -33,37 +31,8 @@ host_toolchain|native_toolchain|runtime|lib_packages|leaf_packages|devroot|world
BUILD_TARGETS_META="${BUILD_TARGETS_META:+${BUILD_TARGETS_META} }${1}"; ;;
*=*) set_var_unsafe "${1%%=*}" "${1#*=}"; ;;
*) exec cat etc/build.usage; ;;
-esac; shift;
-done;
-
-#
-#
-#
-if [ -z "${BUILD_CPUS}" ]\
-&& [ -e /proc/cpuinfo ]; then
- BUILD_CPUS=$(awk '/^processor/{cpus++} END{print cpus}' /proc/cpuinfo);
-fi;
-for __ in ${HOME}/midipix_build.vars ../midipix_build.vars ./vars/build.vars; do
- [ -e ${__} ] && . ${__};
-done;
-for __ in $(export | sed -e 's/^export //' -e 's/=.*$//'); do
- if ! match_list "${CLEAR_ENV_VARS_EXCEPT}" " " "${__}"; then
- unset "${__}";
- fi;
-done;
-
-#
-#
-#
-pre_prereqs;
-pre_subdirs;
-if [ -e ${BUILD_LOG_FNAME} ]; then
- mv -- ${BUILD_LOG_FNAME} ${BUILD_LOG_LAST_FNAME};
-fi;
-touch ${BUILD_STATUS_IN_PROGRESS_FNAME};
-BUILD_DATE_START="$(date %Y-%m-%d-%H-%M-%S)";
-BUILD_NFINI=${BUILD_NSKIP:=${BUILD_NFAIL:=${BUILD_NBUILT:=0}}};
-BUILD_TIMES_SECS=$(command date +%s);
+esac; shift; done;
+pre_setup_env; pre_prereqs; pre_subdirs; pre_build_files;
#
#
@@ -142,16 +111,9 @@ for BUILD_TARGET_LC in $(subst_tgts invariants ${BUILD_TARGETS_META:-world}); do
break;
fi;
done;
-post_copy_etc; post_strip; post_tarballs;
-: $((BUILD_TIMES_SECS=$(command date +%s)-${BUILD_TIMES_SECS}));
-: $((BUILD_TIMES_HOURS=${BUILD_TIMES_SECS}/3600));
-: $((BUILD_TIMES_MINUTES=(${BUILD_TIMES_SECS}%3600)/60));
-: $((BUILD_TIMES_SECS=(${BUILD_TIMES_SECS}%3600)%60));
+post_copy_etc; post_strip; post_tarballs; post_build_files;
log_msg info "${BUILD_NFINI} finished, ${BUILD_NSKIP} skipped, and ${BUILD_NFAIL} failed builds in ${BUILD_NBUILT} build script(s).";
log_msg info "Build time: ${BUILD_TIMES_HOURS} hour(s), ${BUILD_TIMES_MINUTES} minute(s), and ${BUILD_TIMES_SECS} second(s).";
-if [ -f "${BUILD_STATUS_IN_PROGRESS_FNAME}" ]; then
- build_fileop rm ${BUILD_STATUS_IN_PROGRESS_FNAME};
-fi;
exit ${BUILD_SCRIPT_RC})} 2>&1 | tee ${BUILD_LOG_FNAME} &
#
diff --git a/subr/post_build_files.subr b/subr/post_build_files.subr
new file mode 100644
index 00000000..0f629eb1
--- /dev/null
+++ b/subr/post_build_files.subr
@@ -0,0 +1,15 @@
+#
+# . ./build.vars and set -o errexit -o noglob are assumed.
+#
+
+post_build_files() {
+ : $((BUILD_TIMES_SECS=$(command date +%s)-${BUILD_TIMES_SECS}));
+ : $((BUILD_TIMES_HOURS=${BUILD_TIMES_SECS}/3600));
+ : $((BUILD_TIMES_MINUTES=(${BUILD_TIMES_SECS}%3600)/60));
+ : $((BUILD_TIMES_SECS=(${BUILD_TIMES_SECS}%3600)%60));
+ if [ -f "${BUILD_STATUS_IN_PROGRESS_FNAME}" ]; then
+ build_fileop rm ${BUILD_STATUS_IN_PROGRESS_FNAME};
+ fi;
+};
+
+# vim:filetype=sh
diff --git a/subr/pre_build_files.subr b/subr/pre_build_files.subr
new file mode 100644
index 00000000..ea0e6b95
--- /dev/null
+++ b/subr/pre_build_files.subr
@@ -0,0 +1,15 @@
+#
+# . ./build.vars and set -o errexit -o noglob are assumed.
+#
+
+pre_build_files() {
+ if [ -e ${BUILD_LOG_FNAME} ]; then
+ mv -- ${BUILD_LOG_FNAME} ${BUILD_LOG_LAST_FNAME};
+ fi;
+ touch ${BUILD_STATUS_IN_PROGRESS_FNAME};
+ BUILD_DATE_START="$(date %Y-%m-%d-%H-%M-%S)";
+ BUILD_NFINI=${BUILD_NSKIP:=${BUILD_NFAIL:=${BUILD_NBUILT:=0}}};
+ BUILD_TIMES_SECS=$(command date +%s);
+};
+
+# vim:filetype=sh
diff --git a/subr/pre_setup_env.subr b/subr/pre_setup_env.subr
new file mode 100644
index 00000000..c454393e
--- /dev/null
+++ b/subr/pre_setup_env.subr
@@ -0,0 +1,20 @@
+#
+# . ./build.vars and set -o errexit -o noglob are assumed.
+#
+
+pre_setup_env() {
+ if [ -z "${BUILD_CPUS}" ]\
+ && [ -e /proc/cpuinfo ]; then
+ BUILD_CPUS=$(awk '/^processor/{cpus++} END{print cpus}' /proc/cpuinfo);
+ fi;
+ for __ in ${HOME}/midipix_build.vars ../midipix_build.vars ./vars/build.vars; do
+ [ -e ${__} ] && . ${__};
+ done;
+ for __ in $(export | sed -e 's/^export //' -e 's/=.*$//'); do
+ if ! match_list "${CLEAR_ENV_VARS_EXCEPT}" " " "${__}"; then
+ unset "${__}";
+ fi;
+ done;
+};
+
+# vim:filetype=sh