Conan_Kudo / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone
Blob Blame History Raw
#
# set -o errexit -o noglob are assumed.
#

pkgp_setup_pkg_vars() {
	local _pkg_name="${1}" _pkg_name_uc _build_uc _vname __;
	_pkg_name_uc="$(toupper "${_pkg_name}")";
	_build_uc="$(toupper "${BUILD}")";
	for _vname in PREFIX ${PKG_BUILD_VARS}; do
		for __ in "DEFAULT_${_vname}"				\
			  "${BUILD_TARGET}_${_vname}"			\
			  "PKG_${_pkg_name_uc}_${_vname}"		\
			  "PKG_${_pkg_name_uc}_${_vname}_${_build_uc}"; do
			if [ -n "$(get_var_unsafe "${__}")" ]; then
				set_var_unsafe "PKG_${_vname}" "$(get_var_unsafe ${__})";
				if ! lmatch "${PKG_ENV_VARS}" " " "${__}"; then
					PKG_ENV_VARS="${PKG_ENV_VARS:+${PKG_ENV_VARS} }${__}";
				fi;
			fi;
		done;
	done;
};

pkg_setup_vars() {
	local __;
	for __ in vars/${PKG_NAME}.vars; do
		[ \( -e "${__}" \) -o \( -L "${__}" \) ]\
			&& { . "${__}"; };
	done;
	if [ -n "${PKG_NAME_PARENT}" ]; then
		pkgp_setup_pkg_vars "${PKG_NAME_PARENT}";
	fi;
	pkgp_setup_pkg_vars "${PKG_NAME}";
};

# vim:filetype=sh