From 32ad217d197203a97dfcc0076e748731d2315c0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz=20=28arab=2C=20vx?= =?UTF-8?q?p=29?= Date: Wed, 22 Nov 2017 01:32:50 +0000 Subject: subr/*: reorganised as {ex{,_{pkg,rtl,setup}},pkg}_*. --- subr/ex_setup_env.subr | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 subr/ex_setup_env.subr (limited to 'subr/ex_setup_env.subr') diff --git a/subr/ex_setup_env.subr b/subr/ex_setup_env.subr new file mode 100644 index 00000000..8907d7eb --- /dev/null +++ b/subr/ex_setup_env.subr @@ -0,0 +1,36 @@ +ex_setup_env() { + local __; + set -o noglob; + if [ -z "${DEFAULT_BUILD_CPUS}" ]\ + && [ -e /proc/cpuinfo ]; then + DEFAULT_BUILD_CPUS=$(awk '/^processor/{cpus++} END{print cpus}' /proc/cpuinfo); + fi; + : ${ARCH:=nt64}; : ${BUILD:=debug}; + if [ "${ARCH}" = nt32 ]; then + TARGET="i686-nt32-midipix"; + elif [ "${ARCH}" = nt64 ]; then + TARGET="x86_64-nt64-midipix"; + else + if [ "${BUILD}" != debug ]\ + && [ "${BUILD}" != release ]; then + ex_log_msg failexit "Error: unknown build type \`${BUILD}'."; + fi; + ex_log_msg failexit "Error: invalid architecture \`${ARCH}'."; + fi; + for __ in ${HOME}/midipix_build.vars ../midipix_build.vars ./vars/env.vars ./vars/build.vars; do + [ -e ${__} ] && . ${__}; + done; + 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; + for __ in $(export | sed -e 's/^export //' -e 's/=.*$//'); do + if ! ex_lmatch "${CLEAR_ENV_VARS_EXCEPT}" " " "${__}"; then + unset "${__}"; + fi; + done; +}; + +# vim:filetype=sh -- cgit v1.2.3