blob: 7683ccf07cae2e0705131b7d0d00775ce5cad467 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
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 ../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
|