Blob Blame History Raw
build_fini() {
: $((BUILD_TIMES_SECS=$(ex_rtl_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 "${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}" ]; then
ex_rtl_fileop rm ${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME};
fi;
};
build_init() {
local __="" _env_vars="" _env_vars_except="" _env_var="";
set -o noglob; umask 022;
if [ -z "${DEFAULT_BUILD_CPUS}" ]\
&& [ -e /proc/cpuinfo ]; then
DEFAULT_BUILD_CPUS=$(awk '/^processor/{cpus++} END{print cpus}' /proc/cpuinfo);
fi;
if [ "${ARG_PARALLEL}" = auto ]; then
ARG_PARALLEL="${DEFAULT_BUILD_CPUS}";
fi;
: ${ARCH:=nt64}; : ${BUILD:=debug};
if [ "${ARCH}" = nt32 ]; then
DEFAULT_TARGET="i686-nt32-midipix";
elif [ "${ARCH}" = nt64 ]; then
DEFAULT_TARGET="x86_64-nt64-midipix";
else
if [ "${BUILD}" != debug ]\
&& [ "${BUILD}" != release ]; then
ex_rtl_log_msg failexit "Error: unknown build type \`${BUILD}'.";
fi;
ex_rtl_log_msg failexit "Error: invalid architecture \`${ARCH}'.";
fi;
for __ in ${HOME}/midipix_build.vars ${HOME}/.midipix_build.vars ../midipix_build.vars ./vars/env.vars ./vars/midipix.vars ./vars/build.vars; do
[ -e ${__} ] && . ${__};
done;
if [ "${ARG_AS_NEEDED:-0}" -eq 1 ]\
&& [ -e "${PREFIX}/build.gitref" ]\
&& [ "$(git rev-parse HEAD)" = "$(cat "${PREFIX}/build.gitref")" ]; then
ex_rtl_log_msg info "Git repository has not changed since last build and --as-needed was specified.";
exit 0;
fi;
export PATH="${PREFIX}/bin${PATH:+:${PATH}}";
if [ ${ARG_IPV4_ONLY:-0} -eq 1 ]; then
DEFAULT_WGET_ARGS="-4${DEFAULT_WGET_ARGS:+ ${DEFAULT_WGET_ARGS}}";
elif [ ${ARG_IPV6_ONLY:-0} -eq 1 ]; then
DEFAULT_WGET_ARGS="-6${DEFAULT_WGET_ARGS:+ ${DEFAULT_WGET_ARGS}}";
fi;
_env_vars="$(export | sed -e 's/^export //' -e 's/=.*$//')";
_env_vars_except="${DEFAULT_CLEAR_ENV_VARS_EXCEPT}";
for _env_var in ${_env_vars}; do
if [ "${_env_var#DEFAULT_}" != "${_env_var}" ]\
|| [ "${_env_var#PKG_}" != "${_env_var}" ]; then
_env_vars_except="${_env_vars_except:+${_env_vars_except} }${_env_var}";
fi;
done;
ex_rtl_unset_vars $(ex_rtl_lfilter_not "${_env_vars}" "${_env_vars_except}");
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}${PREFIX}/lib";
ex_rtl_fileop mkdir "${BUILD_DLCACHEDIR}" "${BUILD_WORKDIR}";
if [ "${ARG_RPM:-0}" -eq 1 ]; then
ex_rtl_fileop mkdir "${PREFIX_RPM}";
fi;
if [ -e "${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}" ]; then
ex_rtl_log_msg failexit "Error: another build targeting this architecture and build type is currently in progress.";
else
touch "${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}";
fi;
if [ -e "${DEFAULT_BUILD_LOG_FNAME}" ]; then
ex_rtl_fileop mv "${DEFAULT_BUILD_LOG_FNAME}" "${DEFAULT_BUILD_LOG_LAST_FNAME}";
fi;
ex_rtl_fileop touch "${DEFAULT_BUILD_LOG_FNAME}";
BUILD_IS_PARENT=1;
BUILD_DATE_START="$(ex_rtl_date %Y-%m-%d-%H-%M-%S)";
BUILD_NFINI="${BUILD_NSKIP:=${BUILD_NFAIL:=${BUILD_NBUILT:=0}}}";
BUILD_TIMES_SECS="$(ex_rtl_date %s)";
BUILD_PKGS_FAILED="";
trap "rm -f "${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}"; \
ex_rtl_log_msg failexit \"Build aborted.\";" \
HUP INT TERM USR1 USR2;
trap "rm -f "${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}";" \
EXIT;
};
# vim:filetype=sh