Conan_Kudo / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone

Blame subr/pkg_setup_env.subr

Lucio Andrés Illanes Albornoz (arab, vxp) 570129
#
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
# set -o errexit -o noglob are assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
#
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz (arab, vxp) 7fe25d
pkg_setup_env() {
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
	if [ -z "${PKG_URL}" ]\
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
	&& [ -z "${PKG_URLS_GIT}" ]\
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
	&& [ -z "${PKG_VERSION}" ]\
Lucio Andrés Illanes Albornoz (arab, vxp) 946146
	&& ! test_cmd "pkg_${PKG_NAME}_all"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 8ee843
		log_msg failexit "Error: package \`${PKG_NAME}' missing in build.vars.";
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
	elif [ "${PKG_DISABLED:-0}" -eq 1 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
		log_msg vnfo "Skipping disabled package \`${PKG_NAME}.'";
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
		exit 0;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	else
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
		[ -z "${MIDIPIX_BUILD_PWD}" ] && MIDIPIX_BUILD_PWD="$(pwd)";
Lucio Andrés Illanes Albornoz (arab, vxp) 8ee843
		[ -n "${PKG_ENV_VARS_EXTRA}" ] && set_env_vars_with_sep : "${PKG_ENV_VARS_EXTRA}";
Lucio Andrés Illanes Albornoz (arab, vxp) 8ee843
		[ -z "${PKG_FNAME}" ] && PKG_FNAME="${PKG_URL##*/}";
Lucio Andrés Illanes Albornoz (arab, vxp) 8ee843
		[ -z "${PKG_TARGET}" ] && PKG_TARGET="${TARGET}";
Lucio Andrés Illanes Albornoz (arab, vxp) 981a63
		case "${PKG_BASE_DIR}" in
Lucio Andrés Illanes Albornoz (arab, vxp) 981a63
		?*)	;;
Lucio Andrés Illanes Albornoz (arab, vxp) 981a63
		*)	PKG_BASE_DIR="${WORKDIR}/${PKG_NAME}-${PKG_BUILD_TYPE:-native}-${PKG_TARGET}";
Lucio Andrés Illanes Albornoz (arab, vxp) 981a63
			if [ -n "${ARG_RESTART}" ]\
Lucio Andrés Illanes Albornoz (arab, vxp) 981a63
			&& [ -z "${ARG_RESTART_AT}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 981a63
				build_fileop rm "${PKG_BASE_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) 981a63
			fi; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 981a63
		esac;
Lucio Andrés Illanes Albornoz (arab, vxp) 022f7e
		PKG_DESTDIR="${PKG_BASE_DIR}/destdir";
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
		case "${PKG_BUILD_TYPE}" in
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
		host)	export AR="ar";
Lucio Andrés Illanes Albornoz (arab, vxp) d5afb4
			export CC="gcc";
Lucio Andrés Illanes Albornoz (arab, vxp) d5afb4
			export CXX="g++";
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
			export RANLIB="ranlib";
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
			export MAKE="make LIBTOOL=${PKG_SLIBTOOL:-slibtool}";
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
			export LIBTOOL="${PKG_SLIBTOOL:-slibtool}"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
		*)	export AR="${PKG_TARGET}-ar";
Lucio Andrés Illanes Albornoz (arab, vxp) d5afb4
			export CC="${PKG_TARGET}-gcc";
Lucio Andrés Illanes Albornoz (arab, vxp) d5afb4
			export CXX="${PKG_TARGET}-g++";
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
			export RANLIB="${PKG_TARGET}-ranlib";
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
			export MAKE="make LIBTOOL=${PKG_SLIBTOOL:-slibtool}";
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
			export LIBTOOL="${PKG_SLIBTOOL:-slibtool}"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
		esac;
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
		case "${PKG_SUBDIR}" in
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
		?*)	;;
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
		*)	case "${PKG_URLS_GIT}" in
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
			?*)	PKG_SUBDIR="${PKG_URLS_GIT%%=*}"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
			*)	case "${PKG_FNAME}" in
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
				*.t*)	PKG_SUBDIR="${PKG_FNAME%%.t*}"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
				*)	PKG_SUBDIR="${PKG_NAME}"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
				esac; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
			esac; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
		esac;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
	if [ -n "${PKG_ENV_VARS}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
		PKG_ENV_VARS="$(echo "${PKG_ENV_VARS}" | tr " " "\n" | sort | tr "\n" " ")";
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
		log_env_vars "build" ${PKG_ENV_VARS};
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
# vim:filetype=sh