|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
buildp_ast() {
|
|
Lucio Andrés Illanes Albornoz |
6c3660 |
local _param="${1}" _pids_killed="";
|
|
Lucio Andrés Illanes Albornoz |
6c3660 |
rm -f "${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}";
|
|
Lucio Andrés Illanes Albornoz |
6c3660 |
case "${_param}" in
|
|
Lucio Andrés Illanes Albornoz |
6c3660 |
abort) ex_rtl_log_msg failexit "Build aborted."; ;;
|
|
Lucio Andrés Illanes Albornoz |
6c3660 |
esac;
|
|
Lucio Andrés Illanes Albornoz |
a5a093 |
ex_rtl_kill_tree "${$}";
|
|
Lucio Andrés Illanes Albornoz |
a5a093 |
if [ -n "${_pids_killed}" ]; then
|
|
Lucio Andrés Illanes Albornoz |
a5a093 |
ex_rtl_log_msg vnfo "Killed PIDs ${_pids_killed}";
|
|
Lucio Andrés Illanes Albornoz |
a5a093 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
6c3660 |
};
|
|
Lucio Andrés Illanes Albornoz |
6c3660 |
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
buildp_init_args() {
|
|
Lucio Andrés Illanes Albornoz |
ebda8b |
local _last_pkg=""; _status="";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
if [ "${ARG_AS_NEEDED:-0}" -eq 1 ]\
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
&& [ -e "${PREFIX}/build.gitref" ]\
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
&& [ "$(git rev-parse HEAD)" = "$(cat "${PREFIX}/build.gitref")" ]; then
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
_status="Git repository has not changed since last build and --as-needed was specified.";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
ebda8b |
if [ -n "${ARG_RESTART}" ]; then
|
|
Lucio Andrés Illanes Albornoz |
ebda8b |
if [ "${ARG_RESTART#\*\*}" != "${ARG_RESTART}" ]; then
|
|
Lucio Andrés Illanes Albornoz |
ebda8b |
ARG_RESTART="${ARG_RESTART#\*\*}"; ARG_RESTART_RECURSIVE=2;
|
|
Lucio Andrés Illanes Albornoz |
ebda8b |
elif [ "${ARG_RESTART#\*}" != "${ARG_RESTART}" ]; then
|
|
Lucio Andrés Illanes Albornoz |
ebda8b |
ARG_RESTART="${ARG_RESTART#\*}"; ARG_RESTART_RECURSIVE=1;
|
|
Lucio Andrés Illanes Albornoz |
ebda8b |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
case "${ARG_RESTART}" in
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
ALL) ARG_RESTART_AT=ALL; ;;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
LAST) ARG_RESTART_AT=""; ;;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
"") ;;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
*:*) ARG_RESTART_AT="${ARG_RESTART#*:}"; ARG_RESTART="${ARG_RESTART%:*}"; ;;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
*) ARG_RESTART="$(echo "${ARG_RESTART}" | sed "s/,/ /g")"; ARG_RESTART_AT=ALL; ;;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
esac;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
if [ "${ARG_RESTART}" = "LAST" ]; then
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
if [ -n "${DEFAULT_BUILD_LAST_FAILED_PKG_FNAME}" ]\
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
&& [ -e "${DEFAULT_BUILD_LAST_FAILED_PKG_FNAME}" ]; then
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
_last_pkg="$(cat "${DEFAULT_BUILD_LAST_FAILED_PKG_FNAME}")";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
ex_rtl_fileop rm "${DEFAULT_BUILD_LAST_FAILED_PKG_FNAME}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
ex_rtl_state_clear "${BUILD_WORKDIR}" "${_last_pkg}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
ex_rtl_log_set_vnfo_lvl "${ARG_VERBOSE:-0}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
BUILD_IS_PARENT=1;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
BUILD_DATE_START="$(ex_rtl_date %Y-%m-%d-%H-%M-%S)";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
BUILD_NFINI="${BUILD_NSKIP:=${BUILD_NFAIL:=${BUILD_NBUILT:=0}}}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
BUILD_PKGS_FAILED="";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
BUILD_TIMES_SECS="$(ex_rtl_date %s)";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
if [ "${ARG_FETCH_FORCE}" = "ipv4" ]; then
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
DEFAULT_GIT_ARGS="-4${DEFAULT_GIT_ARGS:+ ${DEFAULT_GIT_ARGS}}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
DEFAULT_WGET_ARGS="-4${DEFAULT_WGET_ARGS:+ ${DEFAULT_WGET_ARGS}}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
elif [ "${ARG_FETCH_FORCE}" = "ipv6" ]; then
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
DEFAULT_GIT_ARGS="-6${DEFAULT_GIT_ARGS:+ ${DEFAULT_GIT_ARGS}}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
DEFAULT_WGET_ARGS="-6${DEFAULT_WGET_ARGS:+ ${DEFAULT_WGET_ARGS}}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
return 0;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
buildp_init_clean_prefix() {
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
if ex_rtl_lmatch "${ARG_CLEAN_BUILDS}" , prefix; then
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
ex_rtl_log_msg info "-C prefix specified, cleaning prefix...";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
for _pname in ${DEFAULT_CLEAR_PREFIX_PATHS}; do
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
ex_rtl_fileop rm "${PREFIX}/${_pname}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
done;
|
|
Lucio Andrés Illanes Albornoz |
6c3660 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
return 0;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
};
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
buildp_init_env() {
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
local _rc=0 _vname="" _vname_val=""; _status="";
|
|
Lucio Andrés Illanes Albornoz |
e30e0a |
case "${ARG_PARALLEL}" in
|
|
Lucio Andrés Illanes Albornoz |
e30e0a |
auto)
|
|
Lucio Andrés Illanes Albornoz |
e30e0a |
if [ "${DEFAULT_BUILD_CPUS}" -gt 1 ]; then
|
|
Lucio Andrés Illanes Albornoz |
e30e0a |
ARG_PARALLEL=$((${DEFAULT_BUILD_CPUS}/2));
|
|
Lucio Andrés Illanes Albornoz |
e30e0a |
else
|
|
Lucio Andrés Illanes Albornoz |
e30e0a |
ARG_PARALLEL="${DEFAULT_BUILD_CPUS}";
|
|
Lucio Andrés Illanes Albornoz |
e30e0a |
fi; ;;
|
|
Lucio Andrés Illanes Albornoz |
e30e0a |
*[^0-9]*)
|
|
Lucio Andrés Illanes Albornoz |
e30e0a |
_rc=9; _status="Error: invalid jobs count \`${ARG_PARALLEL}'."; ;;
|
|
Lucio Andrés Illanes Albornoz |
e30e0a |
esac;
|
|
Lucio Andrés Illanes Albornoz |
e30e0a |
if [ "${_rc}" -eq 0 ]; then
|
|
Lucio Andrés Illanes Albornoz |
e30e0a |
ex_rtl_clean_env "${DEFAULT_CLEAR_ENV_VARS_EXCEPT}";
|
|
Lucio Andrés Illanes Albornoz |
e30e0a |
if ex_rtl_check_path_vars "${DEFAULT_CHECK_PATH_VARS}"; then
|
|
Lucio Andrés Illanes Albornoz |
e30e0a |
export PATH="${PREFIX}/bin${PATH:+:${PATH}}";
|
|
Lucio Andrés Illanes Albornoz |
e30e0a |
else
|
|
Lucio Andrés Illanes Albornoz |
e30e0a |
: $((_rc+=(10-1)));
|
|
Lucio Andrés Illanes Albornoz |
e30e0a |
fi;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
return "${_rc}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
};
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
buildp_init_exec() {
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
_status=""
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
trap "buildp_ast abort" HUP INT TERM USR1 USR2; trap "buildp_ast exit" EXIT; umask 022;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
return 0;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
};
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
buildp_init_files() {
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
local _log_last_fname="" _log_last_ts="" _rc=0; _status=""
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
ex_rtl_fileop mkdir "${BUILD_DLCACHEDIR}" "${BUILD_WORKDIR}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
if ex_rtl_lmatch "${ARG_DIST}" , rpm; then
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
ex_rtl_fileop mkdir "${PREFIX_RPM}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
if [ -e "${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}" ]; then
|
|
Lucio Andrés Illanes Albornoz |
e30e0a |
_rc=12; _status="Error: another build targeting this architecture and build type is currently in progress.";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
else
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
touch "${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
if [ -e "${DEFAULT_BUILD_LOG_FNAME}" ]; then
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
_log_last_ts="$(stat -c %Y "${DEFAULT_BUILD_LOG_FNAME}")";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
_log_last_ts="$(awk 'BEGIN {printf(strftime("%Y-%m-%d-%H-%M-%S", '"${_log_last_ts}"'))}')";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
_log_last_fname="${DEFAULT_BUILD_LOG_FNAME}.${_log_last_ts}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
ex_rtl_fileop mv "${DEFAULT_BUILD_LOG_FNAME}" "${_log_last_fname}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
ex_rtl_fileop ln_symbolic "${_log_last_fname}" "${DEFAULT_BUILD_LOG_LAST_FNAME}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
ex_rtl_fileop touch "${DEFAULT_BUILD_LOG_FNAME}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
return "${_rc}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
};
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
buildp_init_getopts() {
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
local _opt="" _shiftfl=0; _status="";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
while [ "${#}" -gt 0 ]; do
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
case "${1}" in
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
--as-needed) ARG_AS_NEEDED=1; _shiftfl=1; ;;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
--debug-minipx) ARG_DEBUG_MINIPIX=1; _shiftfl=1; ;;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
-v*) _opt="${1#-}"; while [ -n "${_opt}" ]; do
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
: $((ARG_VERBOSE+=1)); _opt="${_opt#?}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
done; _shiftfl=1; ;;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
*) _shiftfl=0; ;;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
esac;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
if [ "${_shiftfl}" -gt 0 ]; then
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
shift "${_shiftfl}"; continue;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
elif getopts a:b:C:D:FhPr:R _opt; then
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
case "${_opt}" in
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
a) ARCH="${OPTARG}"; ;;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
b) BUILD="${OPTARG}"; ;;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
C) ARG_CLEAN_BUILDS="${OPTARG}"; ;;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
D) ARG_DIST="${OPTARG}"; ;;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
F) ARG_FETCH_FORCE=1; ;;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
h) cat etc/build.usage; exit 0; ;;
|
|
Lucio Andrés Illanes Albornoz |
e30e0a |
P) ARG_PARALLEL="${1#-P}"; ARG_PARALLEL="${ARG_PARALLEL:-auto}"; ;;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
r) ARG_RESTART="${OPTARG}"; ;;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
R) ARG_RELAXED=1; ;;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
*) cat etc/build.usage; exit 1; ;;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
esac; shift $((${OPTIND}-1));
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
else
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
break;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
done;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
while [ ${#} -gt 0 ]; do
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
case "${1}" in
|
|
Lucio Andrés Illanes Albornoz |
ae3ff0 |
*=*) ex_rtl_set_var_unsafe "${1%%=*}" "${1#*=}"; ;;
|
|
Lucio Andrés Illanes Albornoz |
ae3ff0 |
[^a-zA-Z]*) _rc=1; _status="Error: build group names must start with [a-zA-Z]."; ;;
|
|
Lucio Andrés Illanes Albornoz |
ae3ff0 |
*[^_a-zA-Z]*) _rc=2; _status="Error: build group names must not contain [^_a-zA-Z]."; ;;
|
|
Lucio Andrés Illanes Albornoz |
ae3ff0 |
*) BUILD_GROUPS="${BUILD_GROUPS:+${BUILD_GROUPS} }${1}"; ;;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
esac; shift; done;
|
|
Lucio Andrés Illanes Albornoz |
ae3ff0 |
return "${_rc}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
};
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
buildp_init_prereqs() {
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
local _rc=0; _status="";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
if ! which \
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
awk bunzip2 cat chmod cp date find git grep \
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
gunzip gzip hostname install kill ln lzip make \
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
mkdir mkfifo mv openssl paste patch pgrep pkill \
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
printf readlink rm sed seq shuf sort stat tail \
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
tar test touch tr wget xz >/dev/null; then
|
|
Lucio Andrés Illanes Albornoz |
ae3ff0 |
_rc=3; _status="Error: missing prerequisite package(s).";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
elif ! awk -V 2>/dev/null | grep -q "^GNU Awk "; then
|
|
Lucio Andrés Illanes Albornoz |
ae3ff0 |
_rc=4; _status="Error: awk(1) in \$PATH must be GNU Awk.";
|
|
Lucio Andrés Illanes Albornoz |
ae3ff0 |
elif ! sed --version 2>/dev/null | grep -q "^GNU sed "; then
|
|
Lucio Andrés Illanes Albornoz |
ae3ff0 |
_rc=5; _status="Error: sed(1) in \$PATH must be GNU sed.";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
return "${_rc}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
};
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
buildp_init_type() {
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
local _rc=0; _status="";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
49b460 |
: ${ARCH:=nt64}; : ${BUILD:=debug};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
49b460 |
if [ "${ARCH}" = nt32 ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
DEFAULT_TARGET="i686-nt32-midipix";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
49b460 |
elif [ "${ARCH}" = nt64 ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
DEFAULT_TARGET="x86_64-nt64-midipix";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
49b460 |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
49b460 |
if [ "${BUILD}" != debug ]\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
49b460 |
&& [ "${BUILD}" != release ]; then
|
|
Lucio Andrés Illanes Albornoz |
ae3ff0 |
_rc=6; _status="Error: unknown build type \`${BUILD}'.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
49b460 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
ae3ff0 |
_rc=7; _status="Error: invalid architecture \`${ARCH}'.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
49b460 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
return "${_rc}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
};
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
buildp_init_vars() {
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
local _fname="" _rc=0; _status="";
|
|
Lucio Andrés Illanes Albornoz |
b6e66a |
if [ -z "${DEFAULT_BUILD_CPUS}" ]; then
|
|
Lucio Andrés Illanes Albornoz |
b6e66a |
if [ -e /proc/cpuinfo ]; then
|
|
Lucio Andrés Illanes Albornoz |
b6e66a |
DEFAULT_BUILD_CPUS="$(awk '/^processor/{cpus++} END{print cpus}' /proc/cpuinfo)";
|
|
Lucio Andrés Illanes Albornoz |
b6e66a |
else
|
|
Lucio Andrés Illanes Albornoz |
b6e66a |
DEFAULT_BUILD_CPUS=1;
|
|
Lucio Andrés Illanes Albornoz |
b6e66a |
fi;
|
|
Lucio Andrés Illanes Albornoz |
b6e66a |
fi;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
for _fname in \
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
${HOME}/midipix_build.vars \
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
${HOME}/.midipix_build.vars \
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
../midipix_build.vars \
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
./vars/env.vars; do
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
[ -e ${_fname} ] && . ${_fname};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
e2fea1 |
done;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
for _fname in $(find ./groups -name *.group | sort); do
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
. "${_fname}"; _fname="${_fname##*/}"; _fname="${_fname%.group}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
if [ "${_fname#[0-9][0-9][0-9].*}" != "${_fname}" ]\
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
&& [ "${_fname#*[1-9].*}" = "${_fname}" ]\
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
&& [ "${_fname}" != "999.invariants.group" ]; then
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
GROUPS_DEFAULT="${GROUPS_DEFAULT:+${GROUPS_DEFAULT} }${_fname#*.}";
|
|
Lucio Andrés Illanes Albornoz |
12508d |
fi;
|
|
Lucio Andrés Illanes Albornoz |
12508d |
done;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
if [ -z "${PREFIX}" ]; then
|
|
Lucio Andrés Illanes Albornoz |
ae3ff0 |
_rc=8; _status="Error: \${PREFIX} empty or unset.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
9ad97c |
fi;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
return "${_rc}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
};
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
build_fini() {
|
|
Lucio Andrés Illanes Albornoz |
ae3ff0 |
: $((BUILD_TIMES_SECS=$(ex_rtl_date %s)-${BUILD_TIMES_SECS}));
|
|
Lucio Andrés Illanes Albornoz |
ae3ff0 |
: $((BUILD_TIMES_HOURS=${BUILD_TIMES_SECS}/3600));
|
|
Lucio Andrés Illanes Albornoz |
ae3ff0 |
: $((BUILD_TIMES_MINUTES=(${BUILD_TIMES_SECS}%3600)/60));
|
|
Lucio Andrés Illanes Albornoz |
ae3ff0 |
: $((BUILD_TIMES_SECS=(${BUILD_TIMES_SECS}%3600)%60));
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
if [ -f "${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}" ]; then
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
ex_rtl_fileop rm ${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
64e589 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
};
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
build_init() {
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
local _rc=0 _status="";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
if ! buildp_init_exec \
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
|| ! buildp_init_getopts "${@}" \
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
|| ! buildp_init_prereqs \
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
|| ! buildp_init_type \
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
|| ! buildp_init_vars \
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
|| ! buildp_init_env \
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
|| ! buildp_init_args \
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
|| ! buildp_init_files \
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
|| ! buildp_init_clean_prefix; then
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
_rc="${?}"; ex_rtl_log_msg fail "${_status}"; exit "${_rc}";
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
elif [ -n "${_status}" ]; then
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
ex_rtl_log_msg info "${_status}"; exit 0;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
else
|
|
Lucio Andrés Illanes Albornoz |
c3bcd7 |
return "${_rc}";
|
|
Lucio Andrés Illanes Albornoz |
ed4109 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
e2fea1 |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
e2fea1 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
e2fea1 |
# vim:filetype=sh
|