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) 32ad21
exp_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) 32ad21
	_pkg_name_uc="$(ex_toupper "${_pkg_name}")";
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
	_build_uc="$(ex_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) 32ad21
			if [ -n "$(ex_get_var_unsafe "${_vname_src}")" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
				ex_set_var_unsafe "PKG_${_vname_dst}" "$(ex_get_var_unsafe ${_vname_src})";
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
				if ! ex_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) 32ad21
ex_pkg_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) 32ad21
		exp_pkg_vars "${PKG_NAME_PARENT}";
Lucio Andrés Illanes Albornoz (arab, vxp) 49b460
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
	exp_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