| |
| |
| |
| |
| pkg_setup_env() { |
| local _pkg_name_uc _pkg_name_parent_uc \ |
| _vars_fname _vname _build_uc __ _log_env_vars; |
| _pkg_name_uc="$(echo ${PKG_NAME} | tr a-z A-Z)"; |
| for _vars_fname in vars/${PKG_NAME}.vars; do |
| [ -e "${_vars_fname}" ] && . "${_vars_fname}"; |
| done; |
| _build_uc="$(echo ${BUILD} | tr a-z A-Z)"; |
| if [ -n "${PKG_NAME_PARENT}" ]; then |
| _pkg_name_parent_uc="$(echo ${PKG_NAME_PARENT} | tr a-z A-Z)"; |
| for _vname in PREFIX ${PKG_BUILD_VARS}; do |
| for __ in "DEFAULT_${_vname}" \ |
| "${BUILD_TARGET}_${_vname}" \ |
| "PKG_${_pkg_name_parent_uc}_${_vname}" \ |
| "PKG_${_pkg_name_parent_uc}_${_vname}_${_build_uc}"; do |
| if [ -n "$(get_var_unsafe "${__}")" ]; then |
| set_var_unsafe "PKG_${_vname}" "$(get_var_unsafe ${__})"; |
| if ! lmatch "${_log_env_vars}" " " "${__}"; then |
| _log_env_vars="${_log_env_vars:+${_log_env_vars} }${__}"; |
| fi; |
| fi; |
| done; |
| done; |
| fi; |
| 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 "${_log_env_vars}" " " "${__}"; then |
| _log_env_vars="${_log_env_vars:+${_log_env_vars} }${__}"; |
| fi; |
| fi; |
| done; |
| done; |
| if [ -z "${PKG_URL}" -a -z "${PKG_URLS_GIT}" -a -z "${PKG_VERSION}" ]; then |
| log_msg failexit "Error: package \`${PKG_NAME}' missing in build.vars."; |
| else |
| [ -n "${PKG_ENV_VARS_EXTRA}" ] && set_env_vars_with_sep : "${PKG_ENV_VARS_EXTRA}"; |
| [ -z "${PKG_FNAME}" ] && PKG_FNAME="${PKG_URL##*/}"; |
| [ -z "${PKG_SUBDIR}" ] && PKG_SUBDIR="${PKG_FNAME%%.t*}"; |
| [ -z "${PKG_TARGET}" ] && PKG_TARGET="${TARGET}"; |
| [ -z "${MIDIPIX_BUILD_PWD}" ] && MIDIPIX_BUILD_PWD="$(pwd)"; |
| if [ -z "${PKG_BUILD_DIR}" ]; then |
| set_build_dir "${PKG_SUBDIR}" "${PKG_BUILD_TYPE:-native}"; |
| fi; |
| if [ "${PKG_BUILD_TYPE}" = "host" ]; then |
| export AR="ar"; |
| export CC="gcc"; |
| export CXX="g++"; |
| export RANLIB="ranlib"; |
| else |
| export AR="${PKG_TARGET}-ar"; |
| export CC="${PKG_TARGET}-gcc"; |
| export CXX="${PKG_TARGET}-g++"; |
| export RANLIB="${PKG_TARGET}-ranlib"; |
| fi; |
| if [ "${PKG_SLIBTOOL}" != "default" ]; then |
| export LIBTOOL="${PKG_SLIBTOOL:-slibtool}"; |
| export MAKE="make LIBTOOL=${PKG_SLIBTOOL:-slibtool}"; |
| fi; |
| fi; |
| if [ -n "${_log_env_vars}" ]; then |
| _log_env_vars="$(echo "${_log_env_vars}" | tr " " "\n" | sort | tr "\n" " ")"; |
| log_env_vars "build" ${_log_env_vars}; |
| fi; |
| }; |
| |
| |