|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
# . ./build.vars and set -o errexit -o noglob are assumed.
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
# See warning at the top of build.vars.
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
date() { command date +"${1:-${TIMESTAMP_FMT}}"; };
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
get_var_unsafe() { eval echo \${${1}}; };
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
set_var_unsafe() { eval ${1}=\"${2}\"; };
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
push_IFS() { _pI_IFS="${IFS}"; IFS="${1}"; };
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
pop_IFS() { IFS="${_pI_IFS}"; unset _pI_IFS; };
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
set_build_dir() { PKG_BUILD_DIR=${1}-${2}-${PKG_TARGET}; };
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
split() { push_IFS "${1}"; set -- ${2}; pop_IFS; echo "${*}"; };
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
test_cmd() { command -v "${1}" >/dev/null; };
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
unsplit() { push_IFS "${1}"; shift; set -- "${@}"; echo "${*}"; pop_IFS; };
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
get_vars_unsafe() {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
while [ ${#} -gt 0 ]; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
_gvu_vval="$(eval echo \${${1}})";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
[ -z "${_gvu_vval}" ] || _gvu_vval_="${_gvu_vval}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
done; echo "${_gvu_vval_}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
unset _gvu_vval _gvu_vval_;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
set_env_vars_with_sep() {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
_sevws_sep=${1}; shift; push_IFS ${_sevws_sep}; set -- ${1};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
while [ ${#} -gt 0 ]; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
export "${1}"; shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
done; unset _sevws_sep; pop_IFS;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
lfilter() {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
_lf_list="${1}"; _lf_filter="${2}"; _lf_lnew="";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
for _lf_litem in ${_lf_list}; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
for _lf_lfilter in ${_lf_filter}; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
if [ "${_lf_lfilter}" = "${_lf_litem}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
_lf_lnew="${_lf_lnew:+${_lf_lnew} }${_lf_litem}"; break;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
echo ${_lf_lnew}; unset _lf_list _lf_filter _lf_lnew _lf_litem _lf_lfilter;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
log_msg() {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
_lm_lvl=${1}; shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
if [ "${_lm_lvl#v}" != "${_lm_lvl}" ]\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
&& [ ${ARG_VERBOSE:-0} -eq 0 ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
return;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
99690f |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
case ${_lm_lvl} in
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
failexit) printf "\033[0m\033[${LOG_MSG_FAIL_COLOUR}m"; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
fail) printf "\033[0m\033[${LOG_MSG_FAIL_COLOUR}m"; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
info) printf "\033[0m\033[${LOG_MSG_INFO_COLOUR}m"; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
vnfo) printf "\033[0m\033[${LOG_MSG_INFO_COLOUR}m"; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
succ) printf "\033[0m\033[${LOG_MSG_SUCC_COLOUR}m"; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
warn) printf "\033[0m\033[${LOG_MSG_WARN_COLOUR}m"; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
varn) printf "\033[0m\033[${LOG_MSG_WARN_COLOUR}m"; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
esac;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
if [ $# -gt 1 ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
printf "==> %s %s %s\033[0m\n" "$(date "${TIMESTAMP_FMT}")" "${1}" "$*";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
printf "==> %s %s\033[0m\n" "$(date "${TIMESTAMP_FMT}")" "${1}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
fi; [ ${_lm_lvl} = failexit ] && exit 1 || unset _lm_lvl;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
install_files() {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
if [ "${1}" = "-v" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
_if_verbose="${1}"; shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
fi; _if_prefix="${1}"; shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
while [ ${#} -gt 0 ]; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
case "${1}" in
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
@*=*)
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
__ln_target="${1%=*}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
__ln_target="${__ln_target#@}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
__ln_fname="${1#*=}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
if [ -e ${__ln_fname} ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
if [ ${_if_verbose:-0} -eq 1 ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
echo build_fileop rm ${__ln_fname};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
build_fileop rm ${__ln_fname};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
build_fileop ln_symbolic ${__ln_target} ${_if_prefix:+${_if_prefix}/}${__ln_fname};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
/=*)
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
__mkdir_fname="${1#/=}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
build_fileop mkdir ${_if_prefix:+${_if_prefix}/}${__mkdir_fname};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
*)
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
__file_fname_src="${1%=*}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
__file_fname_dst="${1#*=}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
build_fileop cp ${__file_fname_src} ${_if_prefix:+${_if_prefix}/}${__file_fname_dst};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
esac; shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
done; unset _if_verbose _if_prefix;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd6eba |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
match_list() {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
_ml_cmp="${3}"; push_IFS "${2}"; set -- ${1}; pop_IFS;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
while [ ${#} -gt 0 ]; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
if [ "${1}" = "${_ml_cmp}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
unset _ml_cmp; return 0;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
fi; shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
done; unset _ml_cmp; return 1;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
02175d |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
build_fileop() {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
_bf_op=${1}; shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
if [ "${_bf_op}" = cd ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
log_msg varn "Changing working directory to \`${1}'.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
[ \( -n "${1}" \) -a \( -e "${1}" \) ] && cd -- ${1};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
elif [ "${_bf_op}" = cp ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
log_msg varn "Copying \`${1}' to \`${2}' w/ -pPR.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
[ ${#} -ge 2 ] && cp -pPR -- "${@}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
elif [ "${_bf_op}" = ln_symbolic ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
log_msg varn "Linking \`${1}' to \`${2}' w/ -fs";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
[ \( -n "${1}" \) -a \( -n "${2}" \) ] && ln -fs -- ${1} ${2};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
elif [ "${_bf_op}" = mkdir ]\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
|| [ "${_bf_op}" = rm ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
while [ ${#} -gt 0 ]; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
if [ -z "${1}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
return 1;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
elif [ "${_bf_op}" = mkdir ]\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
&& [ ! -e "${1}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
log_msg varn "Making directory \`${1}'.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
mkdir -p -- "${1}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
elif [ "${_bf_op}" = rm ]\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
&& [ -e "${1}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
log_msg varn "Removing directory or file \`${1}'.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
154865 |
rm -rf -- "${1}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
fi; shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
log_msg failexit "Error: build_fileop() called w/ invalid parameter(s) \`${@}'.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
is_build_script_done() {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
5b02e1 |
if [ "${1}" = "clean" ]\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
5b02e1 |
|| [ "${1}" = distclean ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
if match_list "${ARG_RESTART}" , ${BUILD_PACKAGE_LC} \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
&& [ -n "${ARG_RESTART_AT}" ] \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
&& match_list "${ARG_RESTART_AT}" , "${1}"; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
return 1; # Build
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
return 0; # Skip
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
elif [ "${ARG_RESTART}" = "ALL" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
return 1; # Build
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
elif match_list "${ARG_RESTART}" , ${BUILD_PACKAGE_LC}; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
if [ -n "${ARG_RESTART_AT}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
if [ "${ARG_RESTART_AT}" = "ALL" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
return 1; # Build
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
elif match_list "${ARG_RESTART_AT}" , "${1}"; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
return 1; # Build
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
return 0; # Skip
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
return 1; # Build
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
elif [ -f ${WORKDIR}/.${2:-${BUILD_PACKAGE_LC}}.${1} ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
return 0; # Skip
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
return 1; # Build
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
set_build_script_done() {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
_sbsd_script_fname=${BUILD_PACKAGE_LC};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
_sbsd_done_fname=${WORKDIR}/.${_sbsd_script_fname};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
while [ $# -ge 1 ]; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
if [ "${1#-}" != "${1}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
build_fileop rm ${_sbsd_done_fname}.${1#-};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
touch ${_sbsd_done_fname}.${1};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
log_msg info "Finished build step ${1} of \`${_sbsd_script_fname}'.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
fi; shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
done; unset _sbsd_script_fname _sbsd_done_fname;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
log_env_vars() {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
log_msg info "Variables for this ${1:-build}:"; shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
while [ ${_lev_nvar:=0} -lt ${#} ]; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
_lev_arg="$(eval echo \${${_lev_nvar}})";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
_lev_arg="${_lev_arg%%=*}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
if [ ${#_lev_arg} -gt ${_lev_arg_len_max:=0} ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
_lev_arg_len_max=${#_lev_arg};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
fi; : $((_lev_nvar+=1));
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
done; unset _lev_nvar _lev_arg;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
while [ ${#} -gt 0 ]; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
log_msg info "$(printf \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
"%${_lev_arg_len_max}.${_lev_arg_len_max}s=%s" \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
"${1%%=*}" "$(get_var_unsafe ${1#*=})")";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
done; unset _lev_arg_len_max;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
parse_with_pkg_name() {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
PKG_NAME=${1}; shift; PKG_TARGET=${TARGET};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
MIDIPIX_BUILD_PWD=$(pwd); build_fileop cd ${WORKDIR};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
for __ in vars/${PKG_NAME}.vars; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
[ -e ${MIDIPIX_BUILD_PWD}/${__} ] && . ${MIDIPIX_BUILD_PWD}/${__};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
bd97b6 |
done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
_pwpn_pkg_name_uc=$(echo ${PKG_NAME} | tr a-z A-Z);
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
if [ -z "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_URL)" ]\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
&& [ -z "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_URLS_GIT)" ]\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
&& [ -z "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_VERSION)" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
unset _pwpn_pkg_name_uc;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
log_msg failexit "Error: package \`${PKG_NAME}' missing in build.vars.";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0981c3 |
for _pwpn_vname in PREFIX ${PKG_BUILD_VARS}; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
if [ -n "$(get_var_unsafe DEFAULT_${_pwpn_vname})" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
set_var_unsafe PKG_${_pwpn_vname} "$(get_var_unsafe DEFAULT_${_pwpn_vname})";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
if [ -n "$(get_var_unsafe ${BUILD_TARGET}_${_pwpn_vname})" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
set_var_unsafe PKG_${_pwpn_vname} "$(get_var_unsafe ${BUILD_TARGET}_${_pwpn_vname})";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
if [ "${BUILD}" = "debug" ] \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
&& [ -n "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname}_DEBUG)" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
set_var_unsafe PKG_${_pwpn_vname} "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname}_DEBUG)";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
elif [ "${BUILD}" = "release" ] \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
&& [ -n "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname}_RELEASE)" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
set_var_unsafe PKG_${_pwpn_vname} "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname}_RELEASE)";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
elif [ -n "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname})" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
set_var_unsafe PKG_${_pwpn_vname} "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname})";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
done; unset _pwpn_vname;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
[ -z "${PKG_FNAME}" ] && PKG_FNAME=${PKG_URL##*/};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
[ -z "${PKG_SUBDIR}" ] && PKG_SUBDIR=${PKG_FNAME%%.tar*};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
[ -n "${PKG_ENV_VARS_EXTRA}" ] && set_env_vars_with_sep : "${PKG_ENV_VARS_EXTRA}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
for _pwpn_env_var in $(set); do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
if [ "${_pwpn_env_var#PKG_${_pwpn_pkg_name_uc}}" != "${_pwpn_env_var}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
_pwpn_env_vars="${_pwpn_env_vars:+${_pwpn_env_vars} }${_pwpn_env_var%%=*}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
if [ -n "${_pwpn_env_vars}" ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
log_env_vars "build" ${_pwpn_env_vars};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
fi; unset _pwpn_pkg_name_uc _pwpn_env_var _pwpn_env_vars;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
run_cmd_unsplit() {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
_rcu_cmd=${1}; shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
while [ ${#} -gt 0 ]; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
[ -n "${1}" ] &&\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
_rcu_cmdline="${_rcu_cmdline:+${_rcu_cmdline}:}${1}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
push_IFS :; ${_rcu_cmd} ${_rcu_cmdline}; _rcu_rc=$?; pop_IFS;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
unset _rcu_cmd _rcu_cmdline; return ${_rcu_rc};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ce047e |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
d1adc7 |
subst_tgts() {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
d1adc7 |
while [ ${#} -ge 1 ]; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
d1adc7 |
case "${1}" in
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
d1adc7 |
devroot)
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
d1adc7 |
echo ${DEVROOT_PACKAGES}; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
d1adc7 |
world) echo ${WORLD_PACKAGES}; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
d1adc7 |
*) echo ${1}; ;;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
d1adc7 |
esac; shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
d1adc7 |
done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
d1adc7 |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
d1adc7 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
59765f |
# vim:filetype=sh
|