Blame subr/pkg_setup_vars.subr

Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
#
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
# set -o errexit -o noglob are assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
#
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
pkgp_setup_pkg_vars() {
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
	local _pkg_name="${1}" _pkg_name_uc _build_uc _vname_dst _vname_src;
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
	_pkg_name_uc="$(toupper "${_pkg_name}")";
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
	_build_uc="$(toupper "${BUILD}")";
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
	for _vname_dst in PREFIX ${PKG_BUILD_VARS}; do
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
		for _vname_src in					\
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
				"DEFAULT_${_vname_dst}"			\
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
				"${BUILD_TARGET}_${_vname_dst}"		\
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
				"PKG_${_pkg_name_uc}_${_vname_dst}"	\
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
				"PKG_${_pkg_name_uc}_${_vname_dst}_${_build_uc}"; do
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
			if [ -n "$(get_var_unsafe "${_vname_src}")" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
				set_var_unsafe "PKG_${_vname_dst}" "$(get_var_unsafe ${_vname_src})";
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
				if ! lmatch "${PKG_ENV_VARS}" " " "${_vname_src}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
					PKG_ENV_VARS="${PKG_ENV_VARS:+${PKG_ENV_VARS} }${_vname_src}";
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
				fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
			fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
		done;
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
	done;
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
};
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
pkg_setup_vars() {
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
	local _vars_path;
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
	for _vars_path in vars/${PKG_NAME}.vars; do
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
		if [ -e "${_vars_path}" ]\
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
		|| [ -L "${_vars_path}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
			. "${_vars_path}";
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
	done;
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
	if [ -n "${PKG_NAME_PARENT}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
		pkgp_setup_pkg_vars "${PKG_NAME_PARENT}";
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
	pkgp_setup_pkg_vars "${PKG_NAME}";
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
};
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
# vim:filetype=sh