|
lalbornoz |
340f4c |
#!/bin/sh
|
|
lalbornoz |
340f4c |
|
|
lalbornoz |
340f4c |
{
|
|
lalbornoz |
340f4c |
unset AR ARFLAGS CC CFLAGS CXX CXXFLAGS LD LDFLAGS;
|
|
lalbornoz |
340f4c |
. ./build.vars; . ./build.subr;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
c49754 |
check_prereqs git make openssl sed tar tr wget;
|
|
lalbornoz |
340f4c |
log_msg info "Build started by ${USER}@$(hostname).";
|
|
lalbornoz |
340f4c |
#trap
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
29df05 |
(set -o errexit; mkdir -p ${PREFIX} ${WORKDIR});
|
|
lalbornoz |
340f4c |
BUILD_NFINI=${BUILD_NSKIP:=${BUILD_NFAIL:=${_nbuild:=0}}};
|
|
lalbornoz |
340f4c |
for BUILD_LVL in 0 1 2; do
|
|
lalbornoz |
340f4c |
for BUILD_SCRIPT_FNAME in ${BUILD_LVL}[0-9][0-9].*.build; do
|
|
lalbornoz |
340f4c |
if [ -n "${DEBUG_SCRIPT}" ]\
|
|
lalbornoz |
340f4c |
&& [ "x${DEBUG_SCRIPT}" != "x${BUILD_SCRIPT_FNAME}" ]; then
|
|
lalbornoz |
340f4c |
continue;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
29df05 |
elif [ ! -f ${BUILD_SCRIPT_FNAME} ]; then
|
|
lalbornoz |
340f4c |
continue;
|
|
lalbornoz |
340f4c |
else
|
|
lalbornoz |
340f4c |
unset BUILD_SCRIPT_RC; : $((_nbuild+=1));
|
|
lalbornoz |
340f4c |
log_msg info "Invoking build script \`${BUILD_SCRIPT_FNAME}'";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
29df05 |
(set -o errexit -- $(split . ${BUILD_SCRIPT_FNAME%.build}); \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
29df05 |
SCRIPT_FNAME=${BUILD_SCRIPT_FNAME}; _pwd=$(pwd); \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
29df05 |
cd ${WORKDIR}; . ${_pwd}/build.subr; \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
29df05 |
. ${_pwd}/${BUILD_SCRIPT_FNAME});
|
|
lalbornoz |
340f4c |
case ${BUILD_SCRIPT_RC:=${?}} in
|
|
lalbornoz |
340f4c |
0) log_msg succ "Finished build script \`${BUILD_SCRIPT_FNAME}'.";
|
|
lalbornoz |
340f4c |
: $((BUILD_NFINI+=1)); continue; ;;
|
|
lalbornoz |
340f4c |
212) log_msg info "Skipped build script \`${BUILD_SCRIPT_FNAME}' (already built.)";
|
|
lalbornoz |
340f4c |
: $((BUILD_NSKIP+=1)); BUILD_SCRIPT_RC=0; continue; ;;
|
|
lalbornoz |
340f4c |
*) log_msg fail "Build failed in build script \`${BUILD_SCRIPT_FNAME}' (last return code ${BUILD_SCRIPT_RC}.).";
|
|
lalbornoz |
340f4c |
: $((BUILD_NFAIL+=1)); break; ;;
|
|
lalbornoz |
340f4c |
esac;
|
|
lalbornoz |
340f4c |
fi;
|
|
lalbornoz |
340f4c |
done;
|
|
lalbornoz |
340f4c |
if [ ${BUILD_SCRIPT_RC:-0} != 0 ]; then
|
|
lalbornoz |
340f4c |
break;
|
|
lalbornoz |
340f4c |
fi;
|
|
lalbornoz |
340f4c |
done;
|
|
lalbornoz |
340f4c |
log_msg info "${BUILD_NFINI} finished, ${BUILD_NSKIP} skipped, and ${BUILD_NFAIL} failed builds in ${_nbuild} build script(s).";
|
|
lalbornoz |
340f4c |
exit ${BUILD_SCRIPT_RC};
|
|
lalbornoz |
340f4c |
} 2>&1 | tee build.log;
|
|
lalbornoz |
340f4c |
|
|
lalbornoz |
340f4c |
# vim:filetype=sh
|