Conan_Kudo / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone

Blame subr/pre_setup_env.subr

Lucio Andrés Illanes Albornoz (arab, vxp) e2fea1
#
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
# set -o errexit -o noglob are assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) e2fea1
#
Lucio Andrés Illanes Albornoz (arab, vxp) e2fea1
Lucio Andrés Illanes Albornoz (arab, vxp) e2fea1
pre_setup_env() {
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
	local __;
Lucio Andrés Illanes Albornoz (arab, vxp) d01c02
	if [ -z "${DEFAULT_BUILD_CPUS}" ]\
Lucio Andrés Illanes Albornoz (arab, vxp) e2fea1
	&& [ -e /proc/cpuinfo ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) d01c02
		DEFAULT_BUILD_CPUS=$(awk '/^processor/{cpus++} END{print cpus}' /proc/cpuinfo);
Lucio Andrés Illanes Albornoz (arab, vxp) e2fea1
	fi;
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) 49b460
		TARGET="i686-nt32-midipix";
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
	elif [ "${ARCH}" = nt64 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
		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 (arab, vxp) 49b460
			log_msg failexit "Error: unknown build type \`${BUILD}'.";
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
		log_msg failexit "Error: invalid architecture \`${ARCH}'.";
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
	for __ in ${HOME}/midipix_build.vars ../midipix_build.vars ./vars/env.vars ./vars/build.vars; do
Lucio Andrés Illanes Albornoz (arab, vxp) e2fea1
		[ -e ${__} ] && . ${__};
Lucio Andrés Illanes Albornoz (arab, vxp) e2fea1
	done;
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
	export PATH="${PREFIX}/bin${PATH:+:${PATH}}";
Lucio Andrés Illanes Albornoz (arab, vxp) f3562b
	if [ ${ARG_IPV4_ONLY:-0} -eq 1 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) d01c02
		DEFAULT_WGET_ARGS="-4${DEFAULT_WGET_ARGS:+ ${DEFAULT_WGET_ARGS}}";
Lucio Andrés Illanes Albornoz (arab, vxp) f3562b
	elif [ ${ARG_IPV6_ONLY:-0} -eq 1 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) d01c02
		DEFAULT_WGET_ARGS="-6${DEFAULT_WGET_ARGS:+ ${DEFAULT_WGET_ARGS}}";
Lucio Andrés Illanes Albornoz (arab, vxp) f3562b
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) e2fea1
	for __ in $(export | sed -e 's/^export //' -e 's/=.*$//'); do
Lucio Andrés Illanes Albornoz (arab, vxp) 51fbc3
		if ! lmatch "${CLEAR_ENV_VARS_EXCEPT}" " " "${__}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) e2fea1
			unset "${__}";
Lucio Andrés Illanes Albornoz (arab, vxp) e2fea1
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) e2fea1
	done;
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