Blame subr/ex_pkg_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) 32ad21
ex_pkg_env() {
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
	local _vname;
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
	if [ -z "${PKG_URL}" ]\
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
	&& [ -z "${PKG_URLS_GIT}" ]\
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
	&& [ -z "${PKG_VERSION}" ]\
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
	&& ! ex_test_cmd "pkg_${PKG_NAME}_all"; then
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		ex_log_msg failexit "Error: package \`${PKG_NAME}' missing in build.vars.";
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		return 1;
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
	else
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		[ -z "${MIDIPIX_BUILD_PWD}" ] && MIDIPIX_BUILD_PWD="$(pwd)";
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		[ -z "${PKG_FNAME}" ] && PKG_FNAME="${PKG_URL##*/}";
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		[ -z "${PKG_TARGET}" ] && PKG_TARGET="${TARGET}";
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		case "${PKG_BASE_DIR}" in
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		?*)	;;
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		*)	PKG_BASE_DIR="${WORKDIR}/${PKG_NAME}-${PKG_BUILD_TYPE:-native}-${PKG_TARGET}";
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
			if [ -n "${ARG_RESTART}" ]\
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
			&& [ -z "${ARG_RESTART_AT}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
				ex_build_fileop rm "${PKG_BASE_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
			fi; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		esac;
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		ex_build_fileop mkdir "${PKG_BASE_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		ex_build_fileop cd "${PKG_BASE_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		PKG_DESTDIR="${PKG_BASE_DIR}/destdir";
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		case "${PKG_BUILD_TYPE}" in
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		host)	export AR="ar";
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
			export CC="gcc";
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
			export CXX="g++";
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
			export RANLIB="ranlib"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		*)	export AR="${PKG_TARGET}-ar";
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
			export CC="${PKG_TARGET}-gcc";
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
			export CXX="${PKG_TARGET}-g++";
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
			export RANLIB="${PKG_TARGET}-ranlib";
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
			[ -x "${PREFIX}/bin/${TARGET}-pkg-config" ]\
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
				&& export PKG_CONFIG="${PREFIX}/bin/${TARGET}-pkg-config";
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
			;;
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		esac;
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		export LIBTOOL="${PKG_SLIBTOOL:-slibtool}";
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		export MAKE="make LIBTOOL=${PKG_SLIBTOOL:-slibtool}";
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		case "${PKG_SUBDIR}" in
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		?*)	;;
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		*)	case "${PKG_URLS_GIT}" in
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
			?*)	PKG_SUBDIR="${PKG_URLS_GIT%%=*}"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
			*)	case "${PKG_FNAME}" in
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
				*.t*)	PKG_SUBDIR="${PKG_FNAME%%.t*}"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
				*)	PKG_SUBDIR="${PKG_NAME}"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
				esac; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
			esac; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		esac;
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		for _vname in $(ex_split : ${PKG_ENV_VARS_EXTRA}); do
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
			export "${_vname}";
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		done;
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		if [ -n "${PKG_ENV_VARS}" ]\
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		&& [ "${PKG_NO_LOG_VARS:-0}" -eq 0 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
			PKG_ENV_VARS="$(echo "${PKG_ENV_VARS}" | tr " " "\n" | sort | tr "\n" " ")";
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
			ex_log_env_vars "build" ${PKG_ENV_VARS};
Lucio Andrés Illanes Albornoz (arab, vxp) d18b1a
		fi;
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