From 8022154108dde14f47722bd1a18a475ef2a3f95d Mon Sep 17 00:00:00 2001 From: Lucio Andrés Illanes Albornoz (arab, vxp) Date: Feb 05 2017 21:24:26 +0000 Subject: build.sh, {subr,vars}/*: general cleanup. --- diff --git a/build.sh b/build.sh index 3cf89a1..4bf432b 100755 --- a/build.sh +++ b/build.sh @@ -26,9 +26,7 @@ case ${1} in ARG_RESTART=${2%:*}; ARG_RESTART_AT=${2#*:}; fi; BUILD_PACKAGES_RESTART="$(echo ${ARG_RESTART} | sed "s/,/ /g")"; - if [ -z "${ARG_RESTART_AT}" ]; then - ARG_RESTART_AT=ALL; - fi; shift; ;; + shift; ;; host_toolchain|native_toolchain|runtime|lib_packages|leaf_packages|devroot|world) BUILD_TARGETS_META="${BUILD_TARGETS_META:+${BUILD_TARGETS_META} }${1}"; ;; *=*) set_var_unsafe "${1%%=*}" "${1#*=}"; ;; @@ -53,42 +51,53 @@ for BUILD_TARGET_LC in $(subst_tgts invariants ${BUILD_TARGETS_META:-world}); do && [ -n "${BUILD_PACKAGES_RESTART}" ]; then BUILD_PACKAGES="$(lfilter "${BUILD_PACKAGES}" "${BUILD_PACKAGES_RESTART}")"; fi; - for BUILD_PACKAGE_LC in ${BUILD_PACKAGES}; do + for PKG_NAME in ${BUILD_PACKAGES}; do # # # if [ ${ARG_CHECK_UPDATES:-0} -eq 1 ]\ && [ "${BUILD_PACKAGE#*.*}" = "${BUILD_PACKAGE}" ]; then - (mode_check_pkg_updates "${BUILD_PACKAGE_LC}" "${BUILD_PACKAGE}"); + (mode_check_pkg_updates "${PKG_NAME}" "${BUILD_PACKAGE}"); continue; else - (set -o errexit -o noglob; - parse_with_pkg_name "${BUILD_PACKAGE_LC%.*}"; - if is_build_script_done finish; then - exit 0; - fi; - for __ in ${BUILD_STEPS}; do - case ${__#*:} in - abstract) - if test_cmd pkg_${PKG_NAME}_${__%:*}; then - pkg_${PKG_NAME}_${__%:*}; exit 0; - fi; ;; - always) pkg_${__%:*}; ;; - main) if ! is_build_script_done ${__%:*}; then - if test_cmd pkg_${PKG_NAME}_${__%:*}; then - pkg_${PKG_NAME}_${__%:*}; - else - pkg_${__%:*}; + unset BUILD_SCRIPT_RC; + fi; + (set -o errexit -o noglob; pkg_000000; + if [ -n "${BUILD_PACKAGES_RESTART}" ]\ + || ! is_build_script_done "${PKG_NAME}" finish; then + build_fileop cd "${WORKDIR}"; + set -- ${PKG_BUILD_STEPS:-${BUILD_STEPS}}; + while [ ${#} -gt 0 ]; do + _pkg_step_cmds=""; + case ${1#*:} in + abstract) _pkg_step_cmds="pkg_${PKG_NAME}_${1%:*}"; ;; + always) _pkg_step_cmds="pkg_${1%:*}"; ;; + main) if [ -n "${BUILD_PACKAGES_RESTART}" ]; then + if [ -z "${ARG_RESTART_AT}" ]\ + || match_list "${ARG_RESTART_AT}" , "${1%:*}"; then + _pkg_step_cmds="pkg_${PKG_NAME}_${1%:*} pkg_${1%:*}"; fi; + elif ! is_build_script_done ${PKG_NAME} ${1%:*}; then + _pkg_step_cmds="pkg_${PKG_NAME}_${1%:*} pkg_${1%:*}"; + fi; ;; + optional) + if match_list "${ARG_RESTART_AT}" "," "${1%:*}"; then + _pkg_step_cmds="pkg_${PKG_NAME}_${1%:*} pkg_${1%:*}"; fi; ;; esac; - done; - set_build_script_done finish); BUILD_SCRIPT_RC=${?}; - fi; - case ${BUILD_SCRIPT_RC} in - 0) log_msg succ "Finished \`${BUILD_PACKAGE_LC}' build."; + for __ in ${_pkg_step_cmds}; do + if test_cmd ${__}; then + ${__}; + set_build_script_done "${PKG_NAME}" "${1%:*}" ${2:+-${2%:*}}; + break; + fi; + done; + shift; done; + fi); + case ${BUILD_SCRIPT_RC:=${?}} in + 0) log_msg succ "Finished \`${PKG_NAME}' build."; : $((BUILD_NFINI+=1)); continue; ;; - *) log_msg fail "Build failed in \`${BUILD_PACKAGE_LC}' (last return code ${BUILD_SCRIPT_RC}.)."; + *) log_msg fail "Build failed in \`${PKG_NAME}' (last return code ${BUILD_SCRIPT_RC}.)."; : $((BUILD_NFAIL+=1)); break; ;; esac; done; @@ -97,8 +106,9 @@ for BUILD_TARGET_LC in $(subst_tgts invariants ${BUILD_TARGETS_META:-world}); do fi; done; if [ ${BUILD_SCRIPT_RC:-0} -eq 0 ]; then - post_copy_etc; post_strip; post_tarballs; post_build_files; + post_copy_etc; post_strip; post_tarballs; fi; +post_build_files; log_msg info "${BUILD_NFINI} finished, ${BUILD_NSKIP} skipped, and ${BUILD_NFAIL} failed builds in ${BUILD_NBUILT} build script(s)."; log_msg info "Build time: ${BUILD_TIMES_HOURS} hour(s), ${BUILD_TIMES_MINUTES} minute(s), and ${BUILD_TIMES_SECS} second(s)."; exit ${BUILD_SCRIPT_RC})} 2>&1 | tee ${BUILD_LOG_FNAME} & TEE_PID=${!}; diff --git a/subr/build.subr b/subr/build.subr index bd2e258..1341e97 100644 --- a/subr/build.subr +++ b/subr/build.subr @@ -1,129 +1,36 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. -# See warning at the top of build.vars. +# set -o errexit -o noglob are assumed. # -date() { command date +"${1:-${TIMESTAMP_FMT}}"; }; +date() { command date "+${1:-${TIMESTAMP_FMT}}"; }; get_var_unsafe() { eval echo \${${1}}; }; -set_var_unsafe() { eval ${1}=\"${2}\"; }; -push_IFS() { _pI_IFS="${IFS}"; IFS="${1}"; }; +set_var_unsafe() { [ -n "${2}" ] && eval ${1}=\"${2}\" || return 0; }; pop_IFS() { IFS="${_pI_IFS}"; unset _pI_IFS; }; +push_IFS() { _pI_IFS="${IFS}"; IFS="${1}"; }; set_build_dir() { PKG_BUILD_DIR=${1}-${2}-${PKG_TARGET}; }; -split() { push_IFS "${1}"; set -- ${2}; pop_IFS; echo "${*}"; }; test_cmd() { command -v "${1}" >/dev/null; }; -unsplit() { push_IFS "${1}"; shift; set -- "${@}"; echo "${*}"; pop_IFS; }; - -get_vars_unsafe() { - while [ ${#} -gt 0 ]; do - _gvu_vval="$(eval echo \${${1}})"; - [ -z "${_gvu_vval}" ] || _gvu_vval_="${_gvu_vval}"; - shift; - done; echo "${_gvu_vval_}"; - unset _gvu_vval _gvu_vval_; -}; - -set_env_vars_with_sep() { - _sevws_sep=${1}; shift; push_IFS ${_sevws_sep}; set -- ${1}; - while [ ${#} -gt 0 ]; do - export "${1}"; shift; - done; unset _sevws_sep; pop_IFS; -}; - -lfilter() { - _lf_list="${1}"; _lf_filter="${2}"; _lf_lnew=""; - for _lf_litem in ${_lf_list}; do - for _lf_lfilter in ${_lf_filter}; do - if [ "${_lf_lfilter}" = "${_lf_litem}" ]; then - _lf_lnew="${_lf_lnew:+${_lf_lnew} }${_lf_litem}"; break; - fi; - done; - done; - echo ${_lf_lnew}; unset _lf_list _lf_filter _lf_lnew _lf_litem _lf_lfilter; -}; - -log_msg() { - _lm_lvl=${1}; shift; - if [ "${_lm_lvl#v}" != "${_lm_lvl}" ]\ - && [ ${ARG_VERBOSE:-0} -eq 0 ]; then - return; - fi; - case ${_lm_lvl} in - failexit) printf "\033[0m\033[${LOG_MSG_FAIL_COLOUR}m"; ;; - fail) printf "\033[0m\033[${LOG_MSG_FAIL_COLOUR}m"; ;; - info) printf "\033[0m\033[${LOG_MSG_INFO_COLOUR}m"; ;; - vnfo) printf "\033[0m\033[${LOG_MSG_INFO_COLOUR}m"; ;; - succ) printf "\033[0m\033[${LOG_MSG_SUCC_COLOUR}m"; ;; - warn) printf "\033[0m\033[${LOG_MSG_WARN_COLOUR}m"; ;; - varn) printf "\033[0m\033[${LOG_MSG_WARN_COLOUR}m"; ;; - esac; - if [ $# -gt 1 ]; then - printf "==> %s %s %s\033[0m\n" "$(date "${TIMESTAMP_FMT}")" "${1}" "$*"; - else - printf "==> %s %s\033[0m\n" "$(date "${TIMESTAMP_FMT}")" "${1}"; - fi; [ ${_lm_lvl} = failexit ] && exit 1 || unset _lm_lvl; -}; - -install_files() { - if [ "${1}" = "-v" ]; then - _if_verbose="${1}"; shift; - fi; _if_prefix="${1}"; shift; - while [ ${#} -gt 0 ]; do - case "${1}" in - @*=*) - __ln_target="${1%=*}"; - __ln_target="${__ln_target#@}"; - __ln_fname="${1#*=}"; - if [ -e ${__ln_fname} ]; then - if [ ${_if_verbose:-0} -eq 1 ]; then - echo build_fileop rm ${__ln_fname}; - fi; - build_fileop rm ${__ln_fname}; - fi; - build_fileop ln_symbolic ${__ln_target} ${_if_prefix:+${_if_prefix}/}${__ln_fname}; - ;; - /=*) - __mkdir_fname="${1#/=}"; - build_fileop mkdir ${_if_prefix:+${_if_prefix}/}${__mkdir_fname}; - ;; - *) - __file_fname_src="${1%=*}"; - __file_fname_dst="${1#*=}"; - build_fileop cp ${__file_fname_src} ${_if_prefix:+${_if_prefix}/}${__file_fname_dst}; - ;; - esac; shift; - done; unset _if_verbose _if_prefix; -}; - -match_list() { - _ml_cmp="${3}"; push_IFS "${2}"; set -- ${1}; pop_IFS; - while [ ${#} -gt 0 ]; do - if [ "${1}" = "${_ml_cmp}" ]; then - unset _ml_cmp; return 0; - fi; shift; - done; unset _ml_cmp; return 1; -}; build_fileop() { - _bf_op=${1}; shift; - if [ "${_bf_op}" = cd ]; then + local _op="${1}"; shift; + if [ "${_op}" = cd ]; then log_msg varn "Changing working directory to \`${1}'."; [ \( -n "${1}" \) -a \( -e "${1}" \) ] && cd -- ${1}; - elif [ "${_bf_op}" = cp ]; then + elif [ "${_op}" = cp ]; then log_msg varn "Copying \`${1}' to \`${2}' w/ -pPR."; [ ${#} -ge 2 ] && cp -pPR -- "${@}"; - elif [ "${_bf_op}" = ln_symbolic ]; then + elif [ "${_op}" = ln_symbolic ]; then log_msg varn "Linking \`${1}' to \`${2}' w/ -fs"; [ \( -n "${1}" \) -a \( -n "${2}" \) ] && ln -fs -- ${1} ${2}; - elif [ "${_bf_op}" = mkdir ]\ - || [ "${_bf_op}" = rm ]; then + elif [ "${_op}" = mkdir ]\ + || [ "${_op}" = rm ]; then while [ ${#} -gt 0 ]; do if [ -z "${1}" ]; then return 1; - elif [ "${_bf_op}" = mkdir ]\ + elif [ "${_op}" = mkdir ]\ && [ ! -e "${1}" ]; then log_msg varn "Making directory \`${1}'."; mkdir -p -- "${1}"; - elif [ "${_bf_op}" = rm ]\ + elif [ "${_op}" = rm ]\ && [ -e "${1}" ]; then log_msg varn "Removing directory or file \`${1}'."; rm -rf -- "${1}"; @@ -134,120 +41,138 @@ build_fileop() { fi; }; -is_build_script_done() { - if [ "${1}" = "clean" ]\ - || [ "${1}" = distclean ]; then - if match_list "${ARG_RESTART}" , ${BUILD_PACKAGE_LC} \ - && [ -n "${ARG_RESTART_AT}" ] \ - && match_list "${ARG_RESTART_AT}" , "${1}"; then - return 1; # Build - else - return 0; # Skip - fi; - elif [ "${ARG_RESTART}" = "ALL" ]; then - return 1; # Build - elif match_list "${ARG_RESTART}" , ${BUILD_PACKAGE_LC}; then - if [ -n "${ARG_RESTART_AT}" ]; then - if [ "${ARG_RESTART_AT}" = "ALL" ]; then - return 1; # Build - elif match_list "${ARG_RESTART_AT}" , "${1}"; then - return 1; # Build - else - return 0; # Skip +install_files() { + local _verbose _prefix _ln_target _ln_fname _mkdir_fname \ + _file_fname_src _file_fname_dst; + if [ "${1}" = "-v" ]; then + _verbose="${1}"; shift; + fi; _prefix="${1}"; shift; + while [ ${#} -gt 0 ]; do + case "${1}" in + @*=*) + _ln_target="${1%=*}"; + _ln_target="${_ln_target#@}"; + _ln_fname="${1#*=}"; + if [ -e ${_ln_fname} ]; then + if [ ${_verbose:-0} -eq 1 ]; then + echo build_fileop rm ${_ln_fname}; fi; - else - return 1; # Build + build_fileop rm ${_ln_fname}; fi; - elif [ -f ${WORKDIR}/.${2:-${BUILD_PACKAGE_LC}}.${1} ]; then - return 0; # Skip + build_fileop ln_symbolic ${_ln_target} ${_prefix:+${_prefix}/}${_ln_fname}; + ;; + /=*) + _mkdir_fname="${1#/=}"; + build_fileop mkdir ${_prefix:+${_prefix}/}${_mkdir_fname}; + ;; + *) + _file_fname_src="${1%=*}"; + _file_fname_dst="${1#*=}"; + build_fileop cp ${_file_fname_src} ${_prefix:+${_prefix}/}${_file_fname_dst}; + ;; + esac; shift; + done; +}; + +is_build_script_done() { + local _done_fname="${WORKDIR}/.${1}.${2}"; + if [ -e "${_done_fname}" ]; then + return 0; # Skip else - return 1; # Build + return 1; # Build fi; }; set_build_script_done() { - _sbsd_script_fname=${BUILD_PACKAGE_LC}; - _sbsd_done_fname=${WORKDIR}/.${_sbsd_script_fname}; - while [ $# -ge 1 ]; do + local _pkg_fname="${1}"; + local _done_fname_pfx="${WORKDIR}/.${_pkg_fname}"; + shift; while [ ${#} -ge 1 ]; do if [ "${1#-}" != "${1}" ]; then - build_fileop rm ${_sbsd_done_fname}.${1#-}; + build_fileop rm "${_done_fname_pfx}.${1#-}"; else - touch ${_sbsd_done_fname}.${1}; - log_msg info "Finished build step ${1} of \`${_sbsd_script_fname}'."; + touch "${_done_fname_pfx}.${1}"; + log_msg info "Finished build step ${1} of package \`${_pkg_fname}'."; fi; shift; - done; unset _sbsd_script_fname _sbsd_done_fname; + done; +}; + +lfilter() { + local _list="${1}" _filter="${2}" _lnew _litem _lfilter; + for _litem in ${_list}; do + for _lfilter in ${_filter}; do + if [ "${_lfilter}" = "${_litem}" ]; then + _lnew="${_lnew:+${_lnew} }${_litem}"; break; + fi; + done; + done; + echo ${_lnew}; }; log_env_vars() { + local _nvar _arg _arg_len_max; log_msg info "Variables for this ${1:-build}:"; shift; - while [ ${_lev_nvar:=0} -lt ${#} ]; do - _lev_arg="$(eval echo \${${_lev_nvar}})"; - _lev_arg="${_lev_arg%%=*}"; - if [ ${#_lev_arg} -gt ${_lev_arg_len_max:=0} ]; then - _lev_arg_len_max=${#_lev_arg}; - fi; : $((_lev_nvar+=1)); - done; unset _lev_nvar _lev_arg; + while [ ${_nvar:=0} -lt ${#} ]; do + _arg="$(eval echo \${${_nvar}})"; + _arg="${_arg%%=*}"; + if [ ${#_arg} -gt ${_arg_len_max:=0} ]; then + _arg_len_max=${#_arg}; + fi; : $((_nvar+=1)); + done; while [ ${#} -gt 0 ]; do log_msg info "$(printf \ - "%${_lev_arg_len_max}.${_lev_arg_len_max}s=%s" \ + "%${_arg_len_max}.${_arg_len_max}s=%s" \ "${1%%=*}" "$(get_var_unsafe ${1#*=})")"; shift; - done; unset _lev_arg_len_max; + done; }; -parse_with_pkg_name() { - PKG_NAME=${1}; shift; PKG_TARGET=${TARGET}; - MIDIPIX_BUILD_PWD=$(pwd); build_fileop cd ${WORKDIR}; - for __ in vars/${PKG_NAME}.vars; do - [ -e ${MIDIPIX_BUILD_PWD}/${__} ] && . ${MIDIPIX_BUILD_PWD}/${__}; - done; - _pwpn_pkg_name_uc=$(echo ${PKG_NAME} | tr a-z A-Z); - if [ -z "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_URL)" ]\ - && [ -z "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_URLS_GIT)" ]\ - && [ -z "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_VERSION)" ]; then - unset _pwpn_pkg_name_uc; - log_msg failexit "Error: package \`${PKG_NAME}' missing in build.vars."; - else - for _pwpn_vname in PREFIX ${PKG_BUILD_VARS}; do - if [ -n "$(get_var_unsafe DEFAULT_${_pwpn_vname})" ]; then - set_var_unsafe PKG_${_pwpn_vname} "$(get_var_unsafe DEFAULT_${_pwpn_vname})"; - fi; - if [ -n "$(get_var_unsafe ${BUILD_TARGET}_${_pwpn_vname})" ]; then - set_var_unsafe PKG_${_pwpn_vname} "$(get_var_unsafe ${BUILD_TARGET}_${_pwpn_vname})"; - fi; - if [ "${BUILD}" = "debug" ] \ - && [ -n "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname}_DEBUG)" ]; then - set_var_unsafe PKG_${_pwpn_vname} "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname}_DEBUG)"; - elif [ "${BUILD}" = "release" ] \ - && [ -n "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname}_RELEASE)" ]; then - set_var_unsafe PKG_${_pwpn_vname} "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname}_RELEASE)"; - elif [ -n "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname})" ]; then - set_var_unsafe PKG_${_pwpn_vname} "$(get_var_unsafe PKG_${_pwpn_pkg_name_uc}_${_pwpn_vname})"; - fi; - done; unset _pwpn_vname; +log_msg() { + local _lvl="${1}"; shift; + if [ "${_lvl#v}" != "${_lvl}" ]\ + && [ ${ARG_VERBOSE:-0} -eq 0 ]; then + return; fi; - [ -z "${PKG_FNAME}" ] && PKG_FNAME=${PKG_URL##*/}; - [ -z "${PKG_SUBDIR}" ] && PKG_SUBDIR=${PKG_FNAME%%.tar*}; - [ -n "${PKG_ENV_VARS_EXTRA}" ] && set_env_vars_with_sep : "${PKG_ENV_VARS_EXTRA}"; - for _pwpn_env_var in $(set); do - if [ "${_pwpn_env_var#PKG_${_pwpn_pkg_name_uc}}" != "${_pwpn_env_var}" ]; then - _pwpn_env_vars="${_pwpn_env_vars:+${_pwpn_env_vars} }${_pwpn_env_var%%=*}"; - fi; - done; - if [ -n "${_pwpn_env_vars}" ]; then - log_env_vars "build" ${_pwpn_env_vars}; - fi; unset _pwpn_pkg_name_uc _pwpn_env_var _pwpn_env_vars; + case "${_lvl}" in + failexit) printf "\033[0m\033[${LOG_MSG_FAIL_COLOUR}m"; ;; + fail) printf "\033[0m\033[${LOG_MSG_FAIL_COLOUR}m"; ;; + info) printf "\033[0m\033[${LOG_MSG_INFO_COLOUR}m"; ;; + vnfo) printf "\033[0m\033[${LOG_MSG_INFO_COLOUR}m"; ;; + succ) printf "\033[0m\033[${LOG_MSG_SUCC_COLOUR}m"; ;; + warn) printf "\033[0m\033[${LOG_MSG_WARN_COLOUR}m"; ;; + varn) printf "\033[0m\033[${LOG_MSG_WARN_COLOUR}m"; ;; + esac; + if [ ${#} -gt 1 ]; then + printf "==> %s %s %s\033[0m\n" "$(date)" "${1}" "$*"; + else + printf "==> %s %s\033[0m\n" "$(date)" "${1}"; + fi; [ ${_lvl} = failexit ] && exit 1 || return 0; +}; + +match_list() { + local _cmp="${3}"; push_IFS "${2}"; set -- ${1}; pop_IFS; + while [ ${#} -gt 0 ]; do + if [ "${1}" = "${_cmp}" ]; then + return 0; + fi; shift; + done; return 1; }; run_cmd_unsplit() { - _rcu_cmd=${1}; shift; + local _cmd="${1}" _cmdline _rc; shift; while [ ${#} -gt 0 ]; do [ -n "${1}" ] &&\ - _rcu_cmdline="${_rcu_cmdline:+${_rcu_cmdline}:}${1}"; + _cmdline="${_cmdline:+${_cmdline}:}${1}"; shift; done; - push_IFS :; ${_rcu_cmd} ${_rcu_cmdline}; _rcu_rc=$?; pop_IFS; - unset _rcu_cmd _rcu_cmdline; return ${_rcu_rc}; + push_IFS :; ${_cmd} ${_cmdline}; _rc=$?; pop_IFS; + return ${_rc}; +}; + +set_env_vars_with_sep() { + local _sep="${1}"; shift; push_IFS ${_sep}; set -- ${1}; + while [ ${#} -gt 0 ]; do + export "${1}"; shift; + done; pop_IFS; }; subst_tgts() { diff --git a/subr/mode_check_updates.subr b/subr/mode_check_updates.subr index 312b81e..51cf707 100644 --- a/subr/mode_check_updates.subr +++ b/subr/mode_check_updates.subr @@ -1,6 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. -# See warning at the top of build.vars. +# set -o errexit -o noglob are assumed. # modep_cpu_get_fnames() { diff --git a/subr/pkg_000000.subr b/subr/pkg_000000.subr new file mode 100644 index 0000000..f531eca --- /dev/null +++ b/subr/pkg_000000.subr @@ -0,0 +1,39 @@ +# +# set -o errexit -o noglob are assumed. +# + +pkg_000000() { + local _pkg_name_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; + for _vname in PREFIX ${PKG_BUILD_VARS}; do + _build_uc="$(echo ${BUILD} | tr a-z A-Z)"; + for __ in "DEFAULT_${_vname}" \ + "${BUILD_TARGET}_${_vname}" \ + "PKG_${_pkg_name_uc}_${_vname}" \ + "PKG_${_pkg_name_uc}_${_vname}_${_build_uc}"; do + set_var_unsafe "PKG_${_vname}" "$(get_var_unsafe ${__})"; + 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%%.tar*}"; + [ -z "${PKG_TARGET}" ] && PKG_TARGET="${TARGET}"; + [ -z "${MIDIPIX_BUILD_PWD}" ] && MIDIPIX_BUILD_PWD="$(pwd)"; + fi; + for __ in $(set); do + if [ "${__#PKG_${_pkg_name_uc}}" != "${__}" ]; then + _log_env_vars="${_log_env_vars:+${_log_env_vars} }${__%%=*}"; + fi; + done; + if [ -n "${_log_env_vars}" ]; then + log_env_vars "build" ${_log_env_vars}; + fi; +}; + +# vim:filetype=sh diff --git a/subr/pkg_all.subr b/subr/pkg_all.subr deleted file mode 100644 index df96e00..0000000 --- a/subr/pkg_all.subr +++ /dev/null @@ -1,10 +0,0 @@ -# -# . ./build.vars and set -o errexit -o noglob are assumed. -# See warning at the top of build.vars. -# - -pkg_all() { - :; -}; - -# vim:filetype=sh diff --git a/subr/pkg_autoconf.subr b/subr/pkg_autoconf.subr index 6390dc9..5260bf1 100644 --- a/subr/pkg_autoconf.subr +++ b/subr/pkg_autoconf.subr @@ -1,9 +1,9 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. -# See warning at the top of build.vars. +# set -o errexit -o noglob are assumed. # pkg_autoconf() { + local __; if [ -e ${PKG_SUBDIR}/configure -o \ -e ${PKG_SUBDIR}/configure.ac -o \ -e ${PKG_SUBDIR}/configure.in -o \ @@ -36,7 +36,6 @@ pkg_autoconf() { build_fileop cp ${MIDIPIX_BUILD_PWD}/etc/config.cache ${__}/; done; fi; - set_build_script_done autoconf -patch; }; # vim:filetype=sh diff --git a/subr/pkg_build.subr b/subr/pkg_build.subr index 58a9e55..9ef158a 100644 --- a/subr/pkg_build.subr +++ b/subr/pkg_build.subr @@ -1,6 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. -# See warning at the top of build.vars. +# set -o errexit -o noglob are assumed. # pkg_build() { @@ -21,7 +20,6 @@ pkg_build() { "${PKG_LDFLAGS_BUILD_EXTRA:+LDFLAGS+=${PKG_LDFLAGS_BUILD_EXTRA}}"; unset __no_autoconf; fi; - set_build_script_done build -install; }; # vim:filetype=sh diff --git a/subr/pkg_build_dir.subr b/subr/pkg_build_dir.subr index 7d50075..3285521 100644 --- a/subr/pkg_build_dir.subr +++ b/subr/pkg_build_dir.subr @@ -1,6 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. -# See warning at the top of build.vars. +# set -o errexit -o noglob are assumed. # pkg_build_dir() { @@ -10,7 +9,6 @@ pkg_build_dir() { if [ ! -d "${PKG_BUILD_DIR}" ]; then build_fileop mkdir ${PKG_BUILD_DIR}; fi; - set_build_script_done build_dir -patch_pre; }; # vim:filetype=sh diff --git a/subr/pkg_clean.subr b/subr/pkg_clean.subr index bd0e1d9..4cfaa15 100644 --- a/subr/pkg_clean.subr +++ b/subr/pkg_clean.subr @@ -1,11 +1,9 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. -# See warning at the top of build.vars. +# set -o errexit -o noglob are assumed. # pkg_clean() { make clean; - set_build_script_done clean -build; }; # vim:filetype=sh diff --git a/subr/pkg_configure.subr b/subr/pkg_configure.subr index 598c236..b631a42 100644 --- a/subr/pkg_configure.subr +++ b/subr/pkg_configure.subr @@ -1,6 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. -# See warning at the top of build.vars. +# set -o errexit -o noglob are assumed. # pkg_configure() { @@ -13,7 +12,6 @@ pkg_configure() { ${PKG_CONFIGURE} \ ${PKG_CONFIGURE_ARGS} ${PKG_CONFIGURE_ARGS_EXTRA} ${PKG_CONFIGURE_ARGS_EXTRA_DEBUG}; fi; - set_build_script_done configure clean -build; }; # vim:filetype=sh diff --git a/subr/pkg_disabled.subr b/subr/pkg_disabled.subr index 9fb3f2f..43cef71 100644 --- a/subr/pkg_disabled.subr +++ b/subr/pkg_disabled.subr @@ -1,6 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. -# See warning at the top of build.vars. +# set -o errexit -o noglob are assumed. # pkg_disabled() { diff --git a/subr/pkg_distclean.subr b/subr/pkg_distclean.subr index ed38072..f721a9f 100644 --- a/subr/pkg_distclean.subr +++ b/subr/pkg_distclean.subr @@ -1,6 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. -# See warning at the top of build.vars. +# set -o errexit -o noglob are assumed. # pkg_distclean() { @@ -8,7 +7,6 @@ pkg_distclean() { build_fileop rm ${PKG_BUILD_DIR}; build_fileop mkdir ${PKG_BUILD_DIR}; fi; - set_build_script_done distclean -configure; }; # vim:filetype=sh diff --git a/subr/pkg_extract.subr b/subr/pkg_extract.subr index f63cefa..95c32d5 100644 --- a/subr/pkg_extract.subr +++ b/subr/pkg_extract.subr @@ -1,6 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. -# See warning at the top of build.vars. +# set -o errexit -o noglob are assumed. # pkg_extract() { @@ -29,7 +28,6 @@ pkg_extract() { pkg_${PKG_NAME}_extract_post; fi; fi; - set_build_script_done extract -build_dir; }; # vim:filetype=sh diff --git a/subr/pkg_fetch.subr b/subr/pkg_fetch.subr index 5c2fee7..fd78a3c 100644 --- a/subr/pkg_fetch.subr +++ b/subr/pkg_fetch.subr @@ -1,70 +1,67 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. -# See warning at the top of build.vars. +# set -o errexit -o noglob are assumed. # # N.B. URLs ($1) may contain `?' or '&' characters. pkgp_fetch() { - _f_url="${1}"; _f_sha256sum_src="${2}"; + local _url="${1}" _sha256sum_src="${2}"; if [ -z "${3}" ]; then - _f_url_dst="${DLCACHEDIR}/$(basename "${_f_url}")"; + _url_dst="${DLCACHEDIR}/$(basename "${_url}")"; else - _f_url_dst="${DLCACHEDIR}/${3}"; + _url_dst="${DLCACHEDIR}/${3}"; fi; if [ ${ARG_OFFLINE:-0} -eq 1 ]\ - || [ -e ${_f_url_dst}.fetched ]; then - unset _f_url _f_sha256sum_src _f_url_dst; + || [ -e ${_url_dst}.fetched ]; then return 0; else - wget ${WGET_ARGS} -c -O ${_f_url_dst} "${_f_url}"; + wget ${WGET_ARGS} -c -O ${_url_dst} "${_url}"; fi; - if [ -n "${_f_sha256sum_src}" ]; then - set -- $(openssl dgst -sha256 ${_f_url_dst}); shift $((${#}-1)); - if [ "${_f_sha256sum_dst:=${1}}" != "${_f_sha256sum_src}" ]; then + if [ -n "${_sha256sum_src}" ]; then + set -- $(openssl dgst -sha256 ${_url_dst}); shift $((${#}-1)); + if [ "${_sha256sum_dst:=${1}}" != "${_sha256sum_src}" ]; then if [ ${ARG_IGNORE_SHA256SUMS:-0} -eq 0 ]; then - log_msg failexit "Error: hash mismatch for URL \`${_f_url}' (is: ${_f_sha256sum_dst}, should be: ${_f_sha256sum_src}.)"; + log_msg failexit "Error: hash mismatch for URL \`${_url}' (is: ${_sha256sum_dst}, should be: ${_sha256sum_src}.)"; else - log_msg warn "Warning: hash mismatch for URL \`${_f_url}' (is: ${_f_sha256sum_dst}, should be: ${_f_sha256sum_src}.)"; + log_msg warn "Warning: hash mismatch for URL \`${_url}' (is: ${_sha256sum_dst}, should be: ${_sha256sum_src}.)"; fi; fi; fi; - touch ${_f_url_dst}.fetched; - unset _f_url _f_url_dst _f_sha256sum_src _f_sha256sum_dst; + touch ${_url_dst}.fetched; }; pkgp_fetch_git() { - _fg_subdir="${1}"; _fg_url="${2}"; _fg_branch="${3}"; + local _subdir="${1}" _url="${2}" _branch="${3}"; if [ ${ARG_OFFLINE:-0} -eq 0 ]; then - if [ -e "${DLCACHEDIR}/${_fg_subdir}" ]; then - build_fileop cd ${DLCACHEDIR}/${_fg_subdir} &&\ - git pull origin ${_fg_branch:-main} &&\ + if [ -e "${DLCACHEDIR}/${_subdir}" ]; then + build_fileop cd ${DLCACHEDIR}/${_subdir} &&\ + git pull origin ${_branch:-main} &&\ build_fileop cd ${OLDPWD}; else - git clone ${_fg_url} ${DLCACHEDIR}/${_fg_subdir}; - if [ -n "${_fg_branch}" -a \ - \( -z "${_fg_branch#main}" \) -a \ - \( -z "${_fg_branch#master}" \) ]; then - build_fileop cd ${DLCACHEDIR}/${_fg_subdir} &&\ - git checkout -b ${_fg_branch} &&\ + git clone ${_url} ${DLCACHEDIR}/${_subdir}; + if [ -n "${_branch}" -a \ + \( -z "${_branch#main}" \) -a \ + \( -z "${_branch#master}" \) ]; then + build_fileop cd ${DLCACHEDIR}/${_subdir} &&\ + git checkout -b ${_branch} &&\ build_fileop cd ${OLDPWD}; fi; fi; fi; - build_fileop rm ${_fg_subdir}; - build_fileop cp ${DLCACHEDIR}/${_fg_subdir} .; + build_fileop rm ${_subdir}; + build_fileop cp ${DLCACHEDIR}/${_subdir} .; }; pkgp_fetch_urls_git() { - for _ppfu_url_spec in "${@}"; do - _ppfu_subdir=${_ppfu_url_spec%=*}; - _ppfu_url=${_ppfu_url_spec#*=}; - _ppfu_url=${_ppfu_url%@*}; - if [ "${_ppfu_url_spec#*@}" != "${_ppfu_url_spec}" ]; then - _ppfu_git_branch=${_ppfu_url_spec#*@}; + local _url_spec _subdir _url _git_branch; + for _url_spec in "${@}"; do + _subdir=${_url_spec%=*}; + _url=${_url_spec#*=}; + _url=${_url%@*}; + if [ "${_url_spec#*@}" != "${_url_spec}" ]; then + _git_branch=${_url_spec#*@}; fi; - pkgp_fetch_git ${_ppfu_subdir} ${_ppfu_url} ${_ppfu_git_branch}; + pkgp_fetch_git ${_subdir} ${_url} ${_git_branch}; done; - unset _ppfu_url_spec _ppfu_subdir _ppfu_url _ppfu_git_branch; }; pkg_fetch() { @@ -81,7 +78,6 @@ pkg_fetch() { if [ -n "${PKG_URLS_GIT}" ]; then pkgp_fetch_urls_git ${PKG_URLS_GIT}; fi; - set_build_script_done fetch -extract; fi; }; diff --git a/subr/pkg_finish.subr b/subr/pkg_finish.subr new file mode 100644 index 0000000..609f2b6 --- /dev/null +++ b/subr/pkg_finish.subr @@ -0,0 +1,9 @@ +# +# set -o errexit -o noglob are assumed. +# + +pkg_finish() { + :; +}; + +# vim:filetype=sh diff --git a/subr/pkg_install.subr b/subr/pkg_install.subr index ad451e8..673dd92 100644 --- a/subr/pkg_install.subr +++ b/subr/pkg_install.subr @@ -1,9 +1,9 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. -# See warning at the top of build.vars. +# set -o errexit -o noglob are assumed. # pkgp_install_clean_lib() { + local __; if [ -d ${PKG_PREFIX}/lib ]; then for __ in $(find ${PKG_PREFIX}/lib -type f -name \*.la); do build_fileop rm ${__}; @@ -12,28 +12,29 @@ pkgp_install_clean_lib() { }; pkgp_install_dlltool() { + local _so_fname _so_name; if [ "${PKG_BUILD_TYPE}" != "host" ] \ && test_cmd perk \ && test_cmd ${PKG_TARGET}-dlltool; then - for __so_fname in \ + for _so_fname in \ $(find \( -name "*.so" \ -or -name "*.so.[0-9]" \ -or -name "*.so.[0-9].[0-9]" \ -or -name "*.so.[0-9].[0-9].[0-9]" \) -printf '%P\n'); do - if [ \( -e ${__so_fname%.so}.lib.a \) -o \ - \( ! -e ${PKG_PREFIX}/lib/$(basename ${__so_fname}) \) ]; + if [ \( -e ${_so_fname%.so}.lib.a \) -o \ + \( ! -e ${PKG_PREFIX}/lib/$(basename ${_so_fname}) \) ]; then continue; else - __so_name="${__so_fname%.so}"; - echo perk -epdlltool ${__so_fname} \> ${__so_fname%.so}.def; - perk -epdlltool ${__so_fname} > ${__so_fname%.so}.def; - echo ${PKG_TARGET}-dlltool -l ${__so_fname%.so}.lib.a \ - -D ${__so_fname} -d ${__so_fname%.so}.def; - ${PKG_TARGET}-dlltool -l ${__so_fname%.so}.lib.a \ - -D ${__so_fname} -d ${__so_fname%.so}.def; - build_fileop cp ${__so_fname%.so}.lib.a "${PKG_PREFIX}/lib"; + _so_name="${_so_fname%.so}"; + echo perk -epdlltool ${_so_fname} \> ${_so_fname%.so}.def; + perk -epdlltool ${_so_fname} > ${_so_fname%.so}.def; + echo ${PKG_TARGET}-dlltool -l ${_so_fname%.so}.lib.a \ + -D ${_so_fname} -d ${_so_fname%.so}.def; + ${PKG_TARGET}-dlltool -l ${_so_fname%.so}.lib.a \ + -D ${_so_fname} -d ${_so_fname%.so}.def; + build_fileop cp ${_so_fname%.so}.lib.a "${PKG_PREFIX}/lib"; fi; done; fi; @@ -73,7 +74,6 @@ pkg_install() { (install_files -v ${PKG_PREFIX} ${PKG_INSTALL_FILES}); fi; pkgp_install_dlltool; - set_build_script_done install -finish; }; # vim:filetype=sh diff --git a/subr/pkg_patch.subr b/subr/pkg_patch.subr index 089c0c1..63e1b45 100644 --- a/subr/pkg_patch.subr +++ b/subr/pkg_patch.subr @@ -1,30 +1,26 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. -# See warning at the top of build.vars. +# set -o errexit -o noglob are assumed. # pkg_patch() { + local _patch_fname; if [ -d ${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME} ]; then set +o noglob; - for __patch_fname in ${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}/*.patch; do - patch -b -d ${PKG_SUBDIR} -p1 < ${__patch_fname}; + for _patch_fname in ${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}/*.patch; do + patch -b -d ${PKG_SUBDIR} -p1 < ${_patch_fname}; done; set -o noglob; fi; - for __patch_fname in \ + for _patch_fname in \ ${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}.local.patch \ ${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}.local@${BUILD_HNAME}.patch \ ${WORKDIR}/chainport/${PKG_SUBDIR}.midipix.patch \ ${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}.local.patch \ ${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}.local@${BUILD_HNAME}.patch; do - if [ -r "${__patch_fname}" ]; then - patch -b -d ${PKG_SUBDIR} -p1 < ${__patch_fname}; + if [ -r "${_patch_fname}" ]; then + patch -b -d ${PKG_SUBDIR} -p1 < ${_patch_fname}; fi; - done; unset __patch_fname; - if test_cmd pkg_${PKG_NAME}_patch_post; then - pkg_${PKG_NAME}_patch_post; - fi; - set_build_script_done patch -setup; + done; }; # vim:filetype=sh diff --git a/subr/pkg_patch_pre.subr b/subr/pkg_patch_pre.subr index 2671d32..566299a 100644 --- a/subr/pkg_patch_pre.subr +++ b/subr/pkg_patch_pre.subr @@ -1,9 +1,9 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. -# See warning at the top of build.vars. +# set -o errexit -o noglob are assumed. # pkg_patch_pre() { + local __; for __ in \ ${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}_pre.local.patch \ ${MIDIPIX_BUILD_PWD}/../${PKG_SUBDIR}_pre.local@${BUILD_HNAME}.patch \ @@ -13,11 +13,10 @@ pkg_patch_pre() { if [ -r "${__}" ]; then patch -b -d ${PKG_SUBDIR} -p1 < ${__}; fi; - done; unset __; + done; if test_cmd pkg_${PKG_NAME}_patch_pre_post; then pkg_${PKG_NAME}_patch_pre_post; fi; - set_build_script_done patch_pre -autoconf; }; # vim:filetype=sh diff --git a/subr/pkg_setup_env.subr b/subr/pkg_setup_env.subr index 9faf387..34dfa1f 100644 --- a/subr/pkg_setup_env.subr +++ b/subr/pkg_setup_env.subr @@ -1,6 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. -# See warning at the top of build.vars. +# set -o errexit -o noglob are assumed. # pkg_setup_env() { @@ -30,7 +29,6 @@ pkg_setup_env() { export MAKE="make LIBTOOL=${PKG_SLIBTOOL:-slibtool}"; fi; build_fileop cd ${PKG_BUILD_DIR}; - set_build_script_done setup distclean -configure; }; # vim:filetype=sh diff --git a/subr/post_build_files.subr b/subr/post_build_files.subr index 0f629eb..6c74a7c 100644 --- a/subr/post_build_files.subr +++ b/subr/post_build_files.subr @@ -1,5 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # post_build_files() { diff --git a/subr/post_copy_etc.subr b/subr/post_copy_etc.subr index fe48521..9681e14 100644 --- a/subr/post_copy_etc.subr +++ b/subr/post_copy_etc.subr @@ -1,5 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # post_copy_etc() { diff --git a/subr/post_strip.subr b/subr/post_strip.subr index 68b8e2e..5225021 100644 --- a/subr/post_strip.subr +++ b/subr/post_strip.subr @@ -1,8 +1,9 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # post_strip() { + local __; if [ ${BUILD_SCRIPT_RC:-0} -eq 0 ]\ && [ "${BUILD}" = release ]; then for __ in $(find ${PREFIX_NATIVE}/bin -perm -0100 \( -type f -or -type l \)); do diff --git a/subr/post_tarballs.subr b/subr/post_tarballs.subr index d55d2a4..245d3a6 100644 --- a/subr/post_tarballs.subr +++ b/subr/post_tarballs.subr @@ -1,5 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # postp_tarball_dist() { diff --git a/subr/pre_build_files.subr b/subr/pre_build_files.subr index dc65759..700ea74 100644 --- a/subr/pre_build_files.subr +++ b/subr/pre_build_files.subr @@ -1,5 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # pre_build_files() { diff --git a/subr/pre_prereqs.subr b/subr/pre_prereqs.subr index c5a965b..f048365 100644 --- a/subr/pre_prereqs.subr +++ b/subr/pre_prereqs.subr @@ -1,8 +1,9 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # pre_prereqs() { + local __ _exit; for __ in ${CHECK_PATH_VARS}; do if [ -z "${___:=$(get_var_unsafe "${__}")}" ]; then log_msg failexit "Error: variable \`${__}' is empty or unset."; @@ -14,25 +15,23 @@ pre_prereqs() { if [ "${__#/}" != "${__}" ]; then if [ ! -e "${__}" ]; then log_msg fail "Error: missing prerequisite file \`${__}'."; - __exit=1; + _exit=1; fi; else if ! test_cmd "${__}"; then log_msg fail "Error: missing prerequisite command \`${__}'."; - __exit=1; + _exit=1; fi; fi; done; for __ in ${CHECK_PREREQ_PERL_MODULES}; do if ! perl -M"${__}" -e "" 2>/dev/null; then log_msg fail "Error: missing prerequisite Perl module \`${__}'."; - __exit=1; + _exit=1; fi; done; - if [ ${__exit:-0} = 1 ]; then + if [ ${_exit:-0} = 1 ]; then exit 1; - elif [ -n "${__exit}" ]; then - unset __exit; fi; }; diff --git a/subr/pre_setup_env.subr b/subr/pre_setup_env.subr index c454393..0f2c944 100644 --- a/subr/pre_setup_env.subr +++ b/subr/pre_setup_env.subr @@ -1,8 +1,9 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # pre_setup_env() { + local __; if [ -z "${BUILD_CPUS}" ]\ && [ -e /proc/cpuinfo ]; then BUILD_CPUS=$(awk '/^processor/{cpus++} END{print cpus}' /proc/cpuinfo); diff --git a/subr/pre_subdirs.subr b/subr/pre_subdirs.subr index 383ab55..92980b8 100644 --- a/subr/pre_subdirs.subr +++ b/subr/pre_subdirs.subr @@ -1,8 +1,9 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # pre_subdirs() { + local __; if [ ${ARG_CLEAN:-0} -eq 1 ]; then log_msg info "-c specified, cleaning prefix..."; for __ in ${CLEAR_PREFIX_DIRS}; do diff --git a/vars/apr.vars b/vars/apr.vars index 055e8c3..6342e35 100644 --- a/vars/apr.vars +++ b/vars/apr.vars @@ -1,5 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # pkg_apr_install_post() { diff --git a/vars/apr_util.vars b/vars/apr_util.vars index f6681b8..8356448 100644 --- a/vars/apr_util.vars +++ b/vars/apr_util.vars @@ -1,5 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # pkg_apr_util_install_post() { diff --git a/vars/build.vars b/vars/build.vars index 7440b89..ab8a7d7 100644 --- a/vars/build.vars +++ b/vars/build.vars @@ -40,7 +40,7 @@ fi; : ${BUILD_LOG_FNAME:=${PREFIX}/build.log}; : ${BUILD_LOG_LAST_FNAME:=${PREFIX}/build.log.last}; : ${BUILD_STATUS_IN_PROGRESS_FNAME:=${PREFIX}/BUILD_IN_PROGRESS}; -: ${BUILD_STEPS:="all:abstract disabled:always fetch:main extract:main build_dir:always patch_pre:main autoconf:main patch:main setup_env:always distclean:main configure:main clean:main build:main install:main"}; +: ${BUILD_STEPS:="all:abstract disabled:always fetch:main extract:main build_dir:always patch_pre:main autoconf:main patch:main setup_env:always distclean:optional configure:main clean:optional build:main install:main finish:always"}; : ${CHECK_PREREQ_CMDS:="aclocal autoconf autopoint awk basename bunzip2 find flex gcc git groff gunzip install ld libtool lzma make makeinfo msgfmt nl nroff openssl paste patch python sed sha256sum sort tar tee tic tr uname wget xz"}; : ${CHECK_PREREQ_FILES:="/usr/include/gmpxx.h /usr/include/mpc.h /usr/include/mpfr.h"}; : ${CHECK_PREREQ_FILES_DYNAMIC:='/usr/share/groff/$(groff -v 2>/dev/null | awk '\''/^GNU groff version /{print $NF}'\'')/tmac/e.tmac'}; @@ -48,7 +48,7 @@ fi; : ${CHECK_PATH_VARS:="PREFIX PREFIX_NATIVE PREFIX_CROSS DLCACHEDIR WORKDIR"}; : ${CHECK_UPDATES_SKIP:="gmp mpfr mpc binutils binutils_host pkgconf_host psxtypes pemagine dalist ntcon ntapi psxscl psxscl_strace ntctty ptycon pkgconf libevent libressl"}; : ${CHECK_UPDATES_SHOW_NEW:=6}; -: ${CLEAR_ENV_VARS_EXCEPT:="ARG_TARBALL ARG_VERBOSE HOME PATH SHELL TERM USER"}; +: ${CLEAR_ENV_VARS_EXCEPT:="ARG_VERBOSE HOME PATH SHELL TERM USER"}; : ${CLEAR_PREFIX_DIRS:="bin i686-nt32-midipix include lib lib64 libexec minipix native share tmp x86_64-nt64-midipix"}; : ${DEFAULT_MAKEFLAGS_BUILD:=-j${BUILD_CPUS:=1}}; : ${GITROOT:=git://midipix.org}; @@ -58,7 +58,7 @@ fi; : ${LOG_MSG_INFO_COLOUR:=93}; : ${LOG_MSG_SUCC_COLOUR:=92}; : ${LOG_MSG_WARN_COLOUR:=96}; -: ${PKG_BUILD_VARS:="BUILD_CMDLINE BUILD_DIR BUILD_TYPE CFLAGS_BUILD_EXTRA CFLAGS_CONFIGURE CFLAGS_CONFIGURE_EXTRA CFLAGS_INSTALL_EXTRA CONFIG_CACHE_EXTRA CONFIGURE CONFIGURE_ARGS CONFIGURE_ARGS_EXTRA DISABLED ENV_VARS_EXTRA FNAME INSTALL_FILES INSTALL_TARGET INSTALL_TARGET_EXTRA LDFLAGS_BUILD_EXTRA LDFLAGS_CONFIGURE LDFLAGS_CONFIGURE_EXTRA LDFLAGS_INSTALL_EXTRA MAKEFLAGS_BUILD MAKEFLAGS_BUILD_EXTRA MAKEFLAGS_INSTALL MAKEFLAGS_INSTALL_EXTRA NO_CLEAN NO_MAKE_BUILD NO_MAKE_INSTALL PREFIX_EXTRA SHA256SUM SLIBTOOL SUBDIR SUBDIR_CREATE TARGET URL URL_FNAME URL_TYPE URLS_GIT VERSION"}; +: ${PKG_BUILD_VARS:="BUILD_CMDLINE BUILD_DIR BUILD_STEPS BUILD_TYPE CFLAGS_BUILD_EXTRA CFLAGS_CONFIGURE CFLAGS_CONFIGURE_EXTRA CFLAGS_INSTALL_EXTRA CONFIG_CACHE_EXTRA CONFIGURE CONFIGURE_ARGS CONFIGURE_ARGS_EXTRA DISABLED ENV_VARS_EXTRA FNAME INSTALL_FILES INSTALL_TARGET INSTALL_TARGET_EXTRA LDFLAGS_BUILD_EXTRA LDFLAGS_CONFIGURE LDFLAGS_CONFIGURE_EXTRA LDFLAGS_INSTALL_EXTRA MAKEFLAGS_BUILD MAKEFLAGS_BUILD_EXTRA MAKEFLAGS_INSTALL MAKEFLAGS_INSTALL_EXTRA NO_CLEAN NO_MAKE_BUILD NO_MAKE_INSTALL PREFIX_EXTRA SHA256SUM SLIBTOOL SUBDIR SUBDIR_CREATE TARGET URL URL_FNAME URL_TYPE URLS_GIT VERSION"}; : ${TARBALL_FNAME_PREFIX:=midipix-${ARCH}-${BUILD}.}; : ${TARBALL_SIGN_GPG_KEY:=}; : ${TARBALL_CROSS_FNAME_PREFIX:=midipix-${ARCH}-${BUILD}_cross.}; @@ -115,6 +115,7 @@ HOST_TOOLCHAIN_PREFIX="${PREFIX_CROSS}"; : ${PKG_GCC_STAGE1_CROSS_X86_64_W64_MINGW32_TARGET:=x86_64-w64-mingw32}; : ${PKG_GCC_STAGE1_VERSION:=4.6.4}; : ${PKG_PSXSTUB_URLS_GIT:="psxstub=${GITROOT}/psxstub"}; +: ${PKG_PSXSTUB_BUILD_STEPS:="fetch:main install:main"}; : ${PKG_PSXSTUB_SUBDIR:=psxstub}; : ${PKG_MUSL_NO_COMPLEX_VERSION:=1.1.12}; : ${PKG_GCC_RUNTIME_VERSION:=4.6.4}; diff --git a/vars/chainport.vars b/vars/chainport.vars index b1c0a1b..aa82e22 100644 --- a/vars/chainport.vars +++ b/vars/chainport.vars @@ -1,5 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # pkg_chainport_build() { diff --git a/vars/check_updates.vars b/vars/check_updates.vars index 3dc88fd..8c923b7 100644 --- a/vars/check_updates.vars +++ b/vars/check_updates.vars @@ -1,5 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # pkg_apk_tools_check_updates() { diff --git a/vars/clang_host.vars b/vars/clang_host.vars index 199a863..56793f9 100644 --- a/vars/clang_host.vars +++ b/vars/clang_host.vars @@ -1,5 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # pkg_clang_host_configure_pre() { diff --git a/vars/cmake.vars b/vars/cmake.vars index 160c8fc..bbcfacb 100644 --- a/vars/cmake.vars +++ b/vars/cmake.vars @@ -1,5 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # pkg_cmake_configure() { @@ -17,21 +17,22 @@ pkg_cmake_configure() { }; pkg_cmake_build() { + local _prefix; build_fileop rm ../cmake-${PKG_VERSION}-native-${PKG_TARGET}; build_fileop mkdir ../cmake-${PKG_VERSION}-native-${PKG_TARGET}; build_fileop cd ${WORKDIR}/cmake-${PKG_VERSION}-native-${PKG_TARGET}; rm -f config.cache; log_msg info "Calling cmake..."; - _pcb_prefix=${PREFIX}; + _prefix=${PREFIX}; env CFLAGS="-L${PKG_PREFIX}/lib --sysroot=${PKG_PREFIX}" \ PREFIX="" cmake \ -DBZIP2_INCLUDE_DIR=${PKG_PREFIX}/include \ -DBZIP2_LIBRARIES=${PKG_PREFIX}/lib/libbz2.a \ - -DCMAKE_AR=${_pcb_prefix}/bin/${AR} \ - -DCMAKE_C_COMPILER=${_pcb_prefix}/bin/${CC} \ - -DCMAKE_CXX_COMPILER=${_pcb_prefix}/bin/${PKG_TARGET}-g++ \ + -DCMAKE_AR=${_prefix}/bin/${AR} \ + -DCMAKE_C_COMPILER=${_prefix}/bin/${CC} \ + -DCMAKE_CXX_COMPILER=${_prefix}/bin/${PKG_TARGET}-g++ \ -DCMAKE_INSTALL_PREFIX= \ - -DCMAKE_RANLIB=${_pcb_prefix}/bin/${RANLIB} \ + -DCMAKE_RANLIB=${_prefix}/bin/${RANLIB} \ -DCMAKE_SYSTEM_NAME=Midipix \ -DCMAKE_USE_SYSTEM_BZIP2=ON \ -DCMAKE_USE_SYSTEM_CURL=ON \ @@ -53,7 +54,6 @@ pkg_cmake_build() { -DZLIB_INCLUDE_DIR=${PKG_PREFIX}/include \ -DZLIB_LIBRARY=${PKG_PREFIX}/lib/libz.a \ ../cmake-${PKG_VERSION}; - unset _pcb_prefix; log_msg info "Calling make..."; make ${DEFAULT_MAKEFLAGS_BUILD}; }; diff --git a/vars/cparser.vars b/vars/cparser.vars index ad4559a..253a688 100644 --- a/vars/cparser.vars +++ b/vars/cparser.vars @@ -1,5 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # pkg_cparser_configure_pre() { diff --git a/vars/gcc.vars b/vars/gcc.vars index 9d5f82b..69d02b2 100644 --- a/vars/gcc.vars +++ b/vars/gcc.vars @@ -1,10 +1,11 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # Order: stage1, runtime, libstdcpp_v3, full, native # Order: stage1_x86_64_w64_mingw32, native_x86_64_w64_mingw32 # pkgp_gcc_setup_env() { + local __; export MAKE="make LIBTOOL=slibtool"; export cbb_ldflags_for_target=--sysroot=${PKG_PREFIX} \ cbb_sysroot_for_libgcc=${PKG_PREFIX} \ @@ -63,7 +64,7 @@ pkgp_gcc_configure() { --enable-threads=posix \ --target=${PKG_TARGET} \ --with-fpmath=sse; - set_build_script_done configure clean -build; + set_build_script_done ${PKG_NAME} configure -build; }; pkg_gcc_stage1_cross_x86_64_w64_mingw32_all() { @@ -75,6 +76,7 @@ pkg_gcc_stage1_native_x86_64_w64_mingw32_all() { }; pkg_gcc_stage1_all() { + local __; case ${PKG_NAME} in gcc_stage1) PKG_GCC_VERSION="${PKG_GCC_STAGE1_VERSION}"; @@ -90,12 +92,12 @@ pkg_gcc_stage1_all() { ;; esac; # GCC, stage1. - if ! is_build_script_done fetch; then + if ! is_build_script_done ${PKG_NAME} fetch; then pkg_fetch -git "cbb-gcc-${PKG_GCC_VERSION}=${GITROOT}/cbb/cbb-gcc-${PKG_GCC_VERSION}"; - set_build_script_done fetch -configure; + set_build_script_done ${PKG_NAME} fetch -configure; fi; pkgp_gcc_setup_env ${PKG_GCC_VERSION}; - if ! is_build_script_done configure; then + if ! is_build_script_done ${PKG_NAME} configure; then build_fileop mkdir ${PKG_PREFIX}/include; [ \! -d ${PKG_PREFIX}/usr ] && \ build_fileop ln_symbolic . ${PKG_PREFIX}/usr; @@ -128,15 +130,11 @@ pkg_gcc_stage1_all() { else build_fileop cd ${PKG_BUILD_DIR}; fi; - if ! is_build_script_done clean; then - make ${MAKEFLAGS} clean; - set_build_script_done clean -build; - fi; - if ! is_build_script_done build; then + if ! is_build_script_done ${PKG_NAME} build; then make ${MAKEFLAGS} all-gcc; - set_build_script_done build -install; + set_build_script_done ${PKG_NAME} build -install; fi; - if ! is_build_script_done install; then + if ! is_build_script_done ${PKG_NAME} install; then case ${PKG_NAME} in gcc_stage1) make ${MAKEFLAGS} install-gcc; ;; @@ -150,8 +148,9 @@ pkg_gcc_stage1_all() { build_fileop ln_symbolic ${PREFIX}/libexec/gcc/${PKG_TARGET}/${PKG_GCC_VERSION}/liblto_plugin.dll.a \ build_fileop ln_symbolic ${PREFIX}/libexec/gcc/${PKG_TARGET}/${PKG_GCC_VERSION}/liblto_plugin.so; fi; - set_build_script_done install finish; + set_build_script_done ${PKG_NAME} install finish; fi; + exit 0; }; pkg_gcc_runtime_all() { @@ -159,14 +158,15 @@ pkg_gcc_runtime_all() { set_build_dir cbb-gcc-${PKG_GCC_RUNTIME_VERSION} cross; build_fileop cd ${PKG_BUILD_DIR}; # GCC, compiler runtime. - if ! is_build_script_done build; then + if ! is_build_script_done ${PKG_NAME} build; then make ${MAKEFLAGS} all-target-libgcc; - set_build_script_done build -install; + set_build_script_done ${PKG_NAME} build -install; fi; - if ! is_build_script_done install; then + if ! is_build_script_done ${PKG_NAME} install; then make ${MAKEFLAGS} install-target-libgcc; - set_build_script_done install finish; + set_build_script_done ${PKG_NAME} install finish; fi; + exit 0; }; pkg_gcc_libstdcpp_v3_all() { @@ -174,14 +174,15 @@ pkg_gcc_libstdcpp_v3_all() { set_build_dir cbb-gcc-${PKG_GCC_LIBSTDCPP_V3_VERSION} cross; build_fileop cd ${PKG_BUILD_DIR}; # GCC, libstdc++-v3. - if ! is_build_script_done build; then + if ! is_build_script_done ${PKG_NAME} build; then make ${MAKEFLAGS} all-target-libstdc++-v3; - set_build_script_done build -install; + set_build_script_done ${PKG_NAME} build -install; fi; - if ! is_build_script_done install; then + if ! is_build_script_done ${PKG_NAME} install; then make ${MAKEFLAGS} install-target-libstdc++-v3; - set_build_script_done install finish; + set_build_script_done ${PKG_NAME} install finish; fi; + exit 0; }; pkg_gcc_full_all() { @@ -189,14 +190,15 @@ pkg_gcc_full_all() { set_build_dir cbb-gcc-${PKG_GCC_FULL_VERSION} cross; build_fileop cd ${PKG_BUILD_DIR}; # GCC, everything else. - if ! is_build_script_done build; then + if ! is_build_script_done ${PKG_NAME} build; then make ${MAKEFLAGS}; - set_build_script_done build -install; + set_build_script_done ${PKG_NAME} build -install; fi; - if ! is_build_script_done install; then + if ! is_build_script_done ${PKG_NAME} install; then make ${MAKEFLAGS} install; - set_build_script_done install finish; + set_build_script_done ${PKG_NAME} install finish; fi; + exit 0; }; pkg_gcc_native_all() { @@ -205,7 +207,7 @@ pkg_gcc_native_all() { # GCC, native. set_build_dir cbb-gcc-${PKG_GCC_VERSION} native; pkgp_gcc_setup_env ${PKG_GCC_VERSION}; - if ! is_build_script_done configure; then + if ! is_build_script_done ${PKG_NAME} configure; then build_fileop mkdir ${PKG_PREFIX}/${PKG_TARGET}; if [ \! -d ${PKG_PREFIX}/${PKG_TARGET}/usr ]; then build_fileop ln_symbolic . ${PKG_PREFIX}/${PKG_TARGET}/usr; @@ -227,21 +229,18 @@ pkg_gcc_native_all() { else build_fileop cd ${PKG_BUILD_DIR}; fi; - if ! is_build_script_done clean; then - make ${MAKEFLAGS} clean; - set_build_script_done clean -build; - fi; - if ! is_build_script_done build; then + if ! is_build_script_done ${PKG_NAME} build; then make ${MAKEFLAGS} all-gcc; make ${MAKEFLAGS} all-target-libgcc; make ${MAKEFLAGS} all-target-libstdc++-v3; make ${MAKEFLAGS} all; - set_build_script_done build -install; + set_build_script_done ${PKG_NAME} build -install; fi; - if ! is_build_script_done install; then + if ! is_build_script_done ${PKG_NAME} install; then make ${MAKEFLAGS} DESTDIR=${PKG_PREFIX} install; - set_build_script_done install finish; + set_build_script_done ${PKG_NAME} install finish; fi; + exit 0; }; # vim:filetype=sh diff --git a/vars/git.vars b/vars/git.vars index 3948b91..d9d9a4b 100644 --- a/vars/git.vars +++ b/vars/git.vars @@ -1,12 +1,13 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # pkg_git_install_post() { + local __ _new; for __ in $(find ${PKG_PREFIX}/share/man -name Git*::* -type f); do - __new="$(echo ${__} | sed "s/::/./g")"; - echo mv -f ${__} ${__new}; - mv -f ${__} ${__new}; + _new="$(echo ${__} | sed "s/::/./g")"; + echo mv -f ${__} ${_new}; + mv -f ${__} ${_new}; done; }; diff --git a/vars/libfirm.vars b/vars/libfirm.vars index b41a53d..c9f2f33 100644 --- a/vars/libfirm.vars +++ b/vars/libfirm.vars @@ -1,5 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # pkg_libfirm_configure_pre() { diff --git a/vars/libxml2.vars b/vars/libxml2.vars index f326480..4d4f269 100644 --- a/vars/libxml2.vars +++ b/vars/libxml2.vars @@ -1,5 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # pkg_libxml2_install_post() { diff --git a/vars/llvm_host.vars b/vars/llvm_host.vars index 8734115..c13d31d 100644 --- a/vars/llvm_host.vars +++ b/vars/llvm_host.vars @@ -1,5 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # pkg_llvm_host_configure() { diff --git a/vars/mingw_w64.vars b/vars/mingw_w64.vars index 69b4286..0fd445c 100644 --- a/vars/mingw_w64.vars +++ b/vars/mingw_w64.vars @@ -1,8 +1,9 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # pkg_mingw_w64_configure() { + local _configure_args; if [ "${ARCH}" = nt32 ]; then _configure_args="--host=i686-nt32-midipix"; else diff --git a/vars/musl.vars b/vars/musl.vars index ed7444f..1c50fc7 100644 --- a/vars/musl.vars +++ b/vars/musl.vars @@ -1,5 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # Order: no_complex, native, full # @@ -20,6 +20,7 @@ pkgp_musl_configure() { }; pkg_musl_no_complex_all() { + local _install; PKG_MUSL_VERSION="${PKG_MUSL_NO_COMPLEX_VERSION}"; # Git clone what we need. pkg_fetch -git "lazy=${GITROOT}/lazy"; @@ -27,37 +28,35 @@ pkg_musl_no_complex_all() { # Musl: build (no-complex) _install=install_no_complex; set_build_dir musl-${PKG_MUSL_VERSION}-${2} cross; - if ! is_build_script_done fetch; then + if ! is_build_script_done ${PKG_NAME} fetch; then pkg_fetch http://www.musl-libc.org/releases/musl-${PKG_MUSL_VERSION}.tar.gz \ ${PKG_MUSL_NO_COMPLEX_SHA256SUM}; build_fileop rm mmglue; pkg_fetch -git "mmglue=${GITROOT}/mmglue"; - set_build_script_done fetch -extract; + set_build_script_done ${PKG_NAME} fetch -extract; fi; - if ! is_build_script_done extract; then + if ! is_build_script_done ${PKG_NAME} extract; then build_fileop rm musl-${PKG_MUSL_VERSION}; tar -xf ${DLCACHEDIR}/musl-${PKG_MUSL_VERSION}.tar.gz; set +o noglob; build_fileop cp mmglue/* musl-${PKG_MUSL_VERSION}/; set -o noglob; - set_build_script_done extract -configure; + set_build_script_done ${PKG_NAME} extract -configure; fi; - if ! is_build_script_done configure; then + if ! is_build_script_done ${PKG_NAME} configure; then pkgp_musl_configure; - set_build_script_done configure clean -build; + set_build_script_done ${PKG_NAME} configure -build; else build_fileop cd ${PKG_BUILD_DIR}; fi; - if ! is_build_script_done clean; then - make ${MAKEFLAGS} clean; - set_build_script_done clean -build; - fi; - if ! is_build_script_done build; then + if ! is_build_script_done ${PKG_NAME} build; then ./lazy -e ${_install} \ -x build; - set_build_script_done build finish; + set_build_script_done ${PKG_NAME} build finish; fi; + exit 0; }; pkg_musl_native_all() { + local _install; PKG_MUSL_VERSION="${PKG_MUSL_NATIVE_VERSION}"; # Git clone what we need. pkg_fetch -git "lazy=${GITROOT}/lazy"; @@ -65,25 +64,23 @@ pkg_musl_native_all() { # Musl: build (full) _install=install; set_build_dir musl-${PKG_MUSL_VERSION} native; - if ! is_build_script_done configure; then + if ! is_build_script_done ${PKG_NAME} configure; then pkgp_musl_configure; - set_build_script_done configure clean -build; + set_build_script_done ${PKG_NAME} configure -build; else build_fileop cd ${PKG_BUILD_DIR}; fi; - if ! is_build_script_done clean; then - make ${MAKEFLAGS} clean; - set_build_script_done clean -build; - fi; - if ! is_build_script_done build; then + if ! is_build_script_done ${PKG_NAME} build; then ./lazy -e ${_install} \ -x build; build_fileop ln_symbolic ../lib/libc.so ${PKG_PREFIX}/bin/ldd; - set_build_script_done build finish; + set_build_script_done ${PKG_NAME} build finish; fi; + exit 0; }; pkg_musl_full_all() { + local _install; PKG_MUSL_VERSION="${PKG_MUSL_FULL_VERSION}"; # Git clone what we need. pkg_fetch -git "lazy=${GITROOT}/lazy"; @@ -91,21 +88,18 @@ pkg_musl_full_all() { # Musl: build (full) _install=install; set_build_dir musl-${PKG_MUSL_VERSION} cross; - if ! is_build_script_done configure; then + if ! is_build_script_done ${PKG_NAME} configure; then pkgp_musl_configure; - set_build_script_done configure clean -build; + set_build_script_done ${PKG_NAME} configure -build; else build_fileop cd ${PKG_BUILD_DIR}; fi; - if ! is_build_script_done clean; then - make ${MAKEFLAGS} clean; - set_build_script_done clean -build; - fi; - if ! is_build_script_done build; then + if ! is_build_script_done ${PKG_NAME} build; then ./lazy -e ${_install} \ -x build; - set_build_script_done build finish; + set_build_script_done ${PKG_NAME} build finish; fi; + exit 0; }; # vim:filetype=sh diff --git a/vars/ncursesw.vars b/vars/ncursesw.vars index 03118da..4f40409 100644 --- a/vars/ncursesw.vars +++ b/vars/ncursesw.vars @@ -1,8 +1,9 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # pkg_ncursesw_install_post() { + local __; for __ in \ bin/captoinfo bin/clear bin/infocmp bin/infotocap bin/ncursesw6-config \ bin/reset bin/tabs bin/tic bin/toe bin/tput bin/tset \ diff --git a/vars/nginx.vars b/vars/nginx.vars index 154c73b..09cb201 100644 --- a/vars/nginx.vars +++ b/vars/nginx.vars @@ -1,12 +1,11 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # pkg_nginx_configure() { export CFLAGS="${PKG_CFLAGS_CONFIGURE} -I${PKG_PREFIX}/include -pipe -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror"; export LDFLAGS="${PKG_LDFLAGS_CONFIGURE} -L${PKG_PREFIX}/lib"; build_fileop mkdir objs/src objs/src/core objs/src/event objs/src/event/modules objs/src/http objs/src/http/modules objs/src/os/unix; - set_build_script_done configure clean -build; }; # vim:filetype=sh diff --git a/vars/perl.vars b/vars/perl.vars index 3d021fa..486975b 100644 --- a/vars/perl.vars +++ b/vars/perl.vars @@ -1,23 +1,23 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # pkg_perl_extract_post() { - for _ppep_fname_src in $(find perl-cross -type f \ + local _fname_src _fname_dst _cflag; + for _fname_src in $(find perl-cross -type f \ -not -path perl-cross/.git/\* -not -name .gitignore); do - _ppep_fname_dst=perl-${PKG_VERSION}${_ppep_fname_src#perl-cross}; - if [ -f ${_ppep_fname_dst} ]; then - mv -- ${_ppep_fname_dst} ${_ppep_fname_dst}.orig; + _fname_dst=perl-${PKG_VERSION}${_fname_src#perl-cross}; + if [ -f ${_fname_dst} ]; then + mv -- ${_fname_dst} ${_fname_dst}.orig; fi; - if [ ! -d "$(dirname ${_ppep_fname_dst})" ]; then - mkdir -p -- $(dirname ${_ppep_fname_dst}); + if [ ! -d "$(dirname ${_fname_dst})" ]; then + mkdir -p -- $(dirname ${_fname_dst}); fi; - build_fileop cp ${_ppep_fname_src} ${_ppep_fname_dst}; + build_fileop cp ${_fname_src} ${_fname_dst}; done; - for _ppep_cflag in ${PKG_CFLAGS_CONFIGURE}; do - PKG_CONFIGURE_ARGS="${PKG_CONFIGURE_ARGS:+${PKG_CONFIGURE_ARGS} }-A ccflags=${_ppep_cflag}"; + for _cflag in ${PKG_CFLAGS_CONFIGURE}; do + PKG_CONFIGURE_ARGS="${PKG_CONFIGURE_ARGS:+${PKG_CONFIGURE_ARGS} }-A ccflags=${_cflag}"; done; - unset _ppep_fname_src _ppep_fname_dst _ppep_cflag; }; # vim:filetype=sh diff --git a/vars/pkgconf_host.vars b/vars/pkgconf_host.vars index 3435a2c..ee07fc7 100644 --- a/vars/pkgconf_host.vars +++ b/vars/pkgconf_host.vars @@ -1,5 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # pkg_pkgconf_host_install_post() { diff --git a/vars/psxstub.vars b/vars/psxstub.vars index a476bd1..fcf018c 100644 --- a/vars/psxstub.vars +++ b/vars/psxstub.vars @@ -1,18 +1,14 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # -pkg_psxstub_all() { - pkg_fetch; - if ! is_build_script_done install; then - if [ "${TARGET}" = i686-nt32-midipix ] \ - || [ "${TARGET}" = x86_64-nt64-midipix ]; then - build_fileop cd psxstub; - make ${MAKEFLAGS} DESTDIR=${PKG_PREFIX} TARGET=${TARGET} install; - if [ -e ${PKG_PREFIX}/lib/libpsxscl.a ]; then - build_fileop rm ${PKG_PREFIX}/lib/libpsxscl.a; - fi; - set_build_script_done install finish; +pkg_psxstub_install() { + if [ "${TARGET}" = i686-nt32-midipix ] \ + || [ "${TARGET}" = x86_64-nt64-midipix ]; then + build_fileop cd psxstub; + make ${MAKEFLAGS} DESTDIR=${PKG_PREFIX} TARGET=${TARGET} install; + if [ -e ${PKG_PREFIX}/lib/libpsxscl.a ]; then + build_fileop rm ${PKG_PREFIX}/lib/libpsxscl.a; fi; fi; }; diff --git a/vars/python3.vars b/vars/python3.vars index 1c0d8d7..2077d53 100644 --- a/vars/python3.vars +++ b/vars/python3.vars @@ -1,5 +1,5 @@ # -# . ./build.vars and set -o errexit -o noglob are assumed. +# set -o errexit -o noglob are assumed. # pkg_python3_configure_pre() {