|
lalbornoz |
340f4c |
#!/bin/sh
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0724e5 |
# Copyright (c) 2016 Lucio Andrés Illanes Albornoz <l.illanes@gmx.de>
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
1d0876 |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
090fd4 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
820be1 |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
d1adc7 |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
e2fea1 |
for __ in subr/*.subr; do . ${__}; done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
set -o noglob;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
090fd4 |
while [ ${#} -gt 0 ]; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
6e48a0 |
case ${1} in
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
6e313c |
-c) ARG_CLEAN=1; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
-C) ARG_CHECK_UPDATES=1; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
6e313c |
-N) ARG_OFFLINE=1; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
a0561a |
-i) ARG_IGNORE_SHA256SUMS=1; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
6e313c |
-t*) ARG_TARBALL=1; [ "${1#-t.}" != "${1}" ] && TARBALL_SUFFIX=${1#-t.}; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
6e313c |
-v) ARG_VERBOSE=1; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
6e313c |
-x) ARG_XTRACE=1; set -o xtrace; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
6e313c |
-a) [ -z "${2}" ] && exec cat etc/build.usage || ARCH=${2}; shift; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
6e313c |
-b) [ -z "${2}" ] && exec cat etc/build.usage || BUILD=${2}; shift; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
-r) if [ -z "${2}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
49ffbe |
exec cat build.usage;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
elif [ "${2%:*}" = "${2}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
6e313c |
ARG_RESTART=${2};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
6e313c |
ARG_RESTART=${2%:*}; ARG_RESTART_AT=${2#*:};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
a0561a |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
BUILD_PACKAGES_RESTART="$(echo ${ARG_RESTART} | sed "s/,/ /g")";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
a0561a |
if [ -z "${ARG_RESTART_AT}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
a0561a |
ARG_RESTART_AT=ALL;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
fi; shift; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
e5b9d8 |
host_toolchain|native_toolchain|runtime|lib_packages|leaf_packages|devroot|world)
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
6e313c |
BUILD_TARGETS_META="${BUILD_TARGETS_META:+${BUILD_TARGETS_META} }${1}"; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
820be1 |
*=*) set_var_unsafe "${1%%=*}" "${1#*=}"; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
*) exec cat etc/build.usage; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
e2fea1 |
esac; shift; done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
e2fea1 |
pre_setup_env; pre_prereqs; pre_subdirs; pre_build_files;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
{(
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
44046a |
if [ ${ARG_CHECK_UPDATES:-0} -eq 0 ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0bb2fe |
log_msg info "Build started by ${BUILD_USER:=${USER}}@${BUILD_HNAME:=$(hostname)} at ${BUILD_DATE_START}.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
44046a |
log_env_vars "build (global)" ${LOG_ENV_VARS};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0bb2fe |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0bb2fe |
log_msg info "Version check run started by ${BUILD_USER:=${USER}}@${BUILD_HNAME:=$(hostname)} at ${BUILD_DATE_START}.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
44046a |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
for BUILD_TARGET_LC in $(subst_tgts invariants ${BUILD_TARGETS_META:-world}); do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
BUILD_TARGET=$(echo ${BUILD_TARGET_LC} | tr a-z A-Z);
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
BUILD_PACKAGES=$(get_var_unsafe ${BUILD_TARGET}_PACKAGES);
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
if [ "${BUILD_TARGET}" != "INVARIANTS" ]\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
&& [ -n "${BUILD_PACKAGES_RESTART}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
BUILD_PACKAGES="$(lfilter "${BUILD_PACKAGES}" "${BUILD_PACKAGES_RESTART}")";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
for BUILD_PACKAGE_LC in ${BUILD_PACKAGES}; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
if [ ${ARG_CHECK_UPDATES:-0} -eq 1 ]\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
&& [ "${BUILD_PACKAGE#*.*}" = "${BUILD_PACKAGE}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
(mode_check_pkg_updates "${BUILD_PACKAGE_LC}" "${BUILD_PACKAGE}");
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
47c5cd |
continue;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
(set -o errexit -o noglob;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
parse_with_pkg_name "${BUILD_PACKAGE_LC%.*}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
for __ in ${BUILD_STEPS}; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
case ${__#*:} in
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
abstract)
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
if test_cmd pkg_${PKG_NAME}_${__%:*}; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
pkg_${PKG_NAME}_${__%:*}; exit 0;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
fi; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
always) pkg_${__%:*}; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
main) if ! is_build_script_done ${__%:*}; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
if test_cmd pkg_${PKG_NAME}_${__%:*}; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
pkg_${PKG_NAME}_${__%:*};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
pkg_${__%:*};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
fi; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
esac;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
set_build_script_done finish); BUILD_SCRIPT_RC=${?};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
case ${BUILD_SCRIPT_RC} in
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
0) log_msg succ "Finished \`${BUILD_PACKAGE_LC}' build.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
: $((BUILD_NFINI+=1)); continue; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
*) log_msg fail "Build failed in \`${BUILD_PACKAGE_LC}' (last return code ${BUILD_SCRIPT_RC}.).";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
: $((BUILD_NFAIL+=1)); break; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
esac;
|
|
lalbornoz |
340f4c |
done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
1d0876 |
if [ ${BUILD_SCRIPT_RC:-0} -ne 0 ]; then
|
|
lalbornoz |
340f4c |
break;
|
|
lalbornoz |
340f4c |
fi;
|
|
lalbornoz |
340f4c |
done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
d0a3e6 |
if [ ${BUILD_SCRIPT_RC:-0} -eq 0 ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
post_copy_etc; post_strip; post_tarballs; post_build_files;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
96b309 |
log_msg info "${BUILD_NFINI} finished, ${BUILD_NSKIP} skipped, and ${BUILD_NFAIL} failed builds in ${BUILD_NBUILT} build script(s).";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
820be1 |
log_msg info "Build time: ${BUILD_TIMES_HOURS} hour(s), ${BUILD_TIMES_MINUTES} minute(s), and ${BUILD_TIMES_SECS} second(s).";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
exit ${BUILD_SCRIPT_RC})} 2>&1 | tee ${BUILD_LOG_FNAME} & TEE_PID=${!};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
e2a4f2 |
trap "rm -f ${BUILD_STATUS_IN_PROGRESS_FNAME}; \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
e2a4f2 |
log_msg fail \"Build aborted.\"; \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
e2a4f2 |
echo kill ${TEE_PID}; \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
e2a4f2 |
kill ${TEE_PID}" HUP INT TERM USR1 USR2;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
e2a4f2 |
wait;
|
|
lalbornoz |
340f4c |
|
|
lalbornoz |
340f4c |
# vim:filetype=sh
|