|
Lucio Andrés Illanes Albornoz (arab, vxp) |
570129 |
#
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# set +o errexit -o noglob is assumed.
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
570129 |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
570129 |
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
#
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# exp_pkg_env_defaults() - set package variable defaults for single named package
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# @_pkg_name: single package name
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
#
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# Return: zero (0) on success, non-zero (>0) on failure
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
#
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
exp_pkg_env_defaults() {
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
local _pkg_name="${1}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
: ${PKG_NAME:="${_pkg_name}"};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
: ${MIDIPIX_BUILD_PWD:="$(pwd)"};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
: ${PKG_BASE_DIR:="${BUILD_WORKDIR}/${_pkg_name}-${PKG_BUILD_TYPE}-${PKG_TARGET}"};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
: ${PKG_FNAME:="${PKG_URL##*/}"};
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
: ${PKG_BUILD_STEPS:="$(ex_rtl_lfilter "${DEFAULT_BUILD_STEPS}" "${PKG_BUILD_STEPS_DISABLE}")"};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
if [ -z "${PKG_SUBDIR}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
if [ -n "${PKG_URLS_GIT}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
PKG_SUBDIR="${PKG_URLS_GIT%%=*}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
else case "${PKG_FNAME}" in
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
*.t*) PKG_SUBDIR="${PKG_FNAME%%.t*}"; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
*) PKG_SUBDIR="${_pkg_name}"; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
esac; fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
if [ -z "${PKG_BUILD_DIR}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
case "${PKG_IN_TREE:-0}" in
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
0) PKG_BUILD_DIR="obj"; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
fce0a9 |
1) PKG_BUILD_DIR="${PKG_SUBDIR}"; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
d18b1a |
esac;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
c27bea |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
PKG_BUILD_DIR="${PKG_BASE_DIR}/${PKG_BUILD_DIR}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
PKG_CONFIGURE="${PKG_BASE_DIR}/${PKG_CONFIGURE:-${PKG_SUBDIR}/configure}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
PKG_DESTDIR="${PKG_BASE_DIR}/${PKG_DESTDIR:-destdir}";
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
};
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
#
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# exp_pkg_env_set() - set package variables for single named package
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# @_group_name: build group name
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# @_pkg_name: single package name
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
#
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# Sets package variables from either defaults, defaults specific to build type,
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# build group, package to inherit from if any, or package for a single named
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# package, exports variables optionally named in ${PKG_ENV_VARS_EXTRA}, and
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# clears the package variable namespace.
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
#
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# Return: zero (0) on success, non-zero (>0) on failure
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
#
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
exp_pkg_env_set() {
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
local _group_name="${1}" _pkg_name="${2}" _var_prefixes="" _vars_set="" _vname="";
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
ex_rtl_set_vars _vars_set BUILD_TYPE "DEFAULT ${_group_name} PKG_${_pkg_name}";
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
ex_rtl_set_vars _vars_set INHERIT_FROM "PKG_${_pkg_name}";
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
_var_prefixes="$(ex_rtl_toupper "DEFAULT DEFAULT_${PKG_BUILD_TYPE} ${_group_name}")";
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
for _vname in $(ex_rtl_lfilter "${DEFAULT_BUILD_VARS}" BUILD_TYPE); do
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
if [ -n "${PKG_INHERIT_FROM}" ]; then
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
ex_rtl_set_vars _vars_set "${_vname}" \
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
"$(ex_rtl_lconcat "${_var_prefixes}" "$(ex_rtl_toupper "PKG_${PKG_INHERIT_FROM} PKG_${_pkg_name}")")"
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
else
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
ex_rtl_set_vars _vars_set "${_vname}" \
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
"$(ex_rtl_lconcat "${_var_prefixes}" "$(ex_rtl_toupper "PKG_${_pkg_name}")")";
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
ex_rtl_push_IFS :; for _vname in ${PKG_ENV_VARS_EXTRA}; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
export "${_vname}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
done; ex_rtl_pop_IFS;
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
ex_rtl_unset_vars $(ex_rtl_lfilter \
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
"$(set | awk -F= '/^PKG_/{print $1}' | sort)" \
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
"${_vars_set}");
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
};
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
#
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# ex_pkg_env() - set package variables for single named package
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# @_group_name: build group name
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# @_pkg_name: single package name
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# @_restart_at: optional comma-separated list of build steps at which to rebuild or ALL
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
#
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# Return: zero (0) on success, non-zero (>0) on failure
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
#
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
ex_pkg_env() {
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
local _group_name="${1}" _pkg_name="${2}" _restart_at="${3}" _vname="";
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
ex_rtl_fileop source_opt "vars/${_pkg_name}.vars";
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
if ! exp_pkg_env_set "${_group_name}" "${_pkg_name}"\
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
|| ! exp_pkg_env_defaults "${_pkg_name}"; then
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
return "${?}";
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
};
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
#
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# ex_pkg_state_set() - update build step status for single named package
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# @_workdir: pathname to temporary build directory
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# @_pkg_name: single package name
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# @${@}: list of build steps
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
#
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# Return: zero (0) on success, non-zero (>0) on failure
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
#
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
ex_pkg_state_set() {
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
ex_rtl_state_set "${BUILD_WORKDIR}" "${@}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
570129 |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
570129 |
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
#
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# ex_pkg_state_test() - test build step status of single named package
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# @_workdir: pathname to temporary build directory
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# @_pkg_name: single package name
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# @_build_step: build step to test status of
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# @_restart_at: optional comma-separated list of build steps at which to rebuild or ALL
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
#
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
# Return: zero (0) on success, non-zero (>0) on failure
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
#
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
ex_pkg_state_test() {
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
ex_rtl_state_test "${BUILD_WORKDIR}" "${@}";
|
|
Lucio Andrés Illanes Albornoz |
2b85d0 |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
570129 |
# vim:filetype=sh
|