diff options
author | Lucio Andrés Illanes Albornoz (arab, vxp) <lucio@lucioillanes.de> | 2017-11-19 14:21:25 +0000 |
---|---|---|
committer | Lucio Andrés Illanes Albornoz (arab, vxp) <lucio@lucioillanes.de> | 2017-11-20 14:46:55 +0000 |
commit | 49b46005e7f7ebebcf6b43d451918c5462ac28d4 (patch) | |
tree | d226c2bb06d084911b70118e466e23a2de45ae0a /subr | |
parent | d27197213a39dd05dee64788ce185f6805207292 (diff) | |
download | midipix_build-49b46005e7f7ebebcf6b43d451918c5462ac28d4.tar.bz2 midipix_build-49b46005e7f7ebebcf6b43d451918c5462ac28d4.tar.xz |
vars/{build,env}.vars: diet, pt. II.
vars/build.vars: install w/ `DESTDIR=<prefix> PREFIX= prefix=' by default.
vars/build.vars:cmake: build w/ -g0 -O2.
vars/cmake.vars: build using cmake_host.
vars/pkgconf_host.vars: remove & don't install ${PREFIX}/bin/pkg-config link to avoid confusing host packages.
vars/{apr_util,chainport}.vars: replaced w/ corresponding ${PKG_BUILD_STEPS}.
patches/perl-5.22.1.local.patch: pass -L. -lperl when linking.
patches/smallbasic.local.patch: don't call pcre-config.
subr/pkg_autoconf.subr, vars/{lib{caca,udns},toilet}.vars: always install config.sub after bootstrap.
subr/pkg_disabled.subr: always silently finish disabled packages.
subr/pkg_setup_{env,vars}.subr: split.
subr/pkg_{build,install}.subr: always pass LIBTOOL=${PKG_SLIBTOOL:=slibtool}.
subr/pkg_{{build,work}_dir,extract,setup_env}.subr: infer ${PKG_BUILD_DIR} from ${PKG_SUBDIR} given the absence of configure{,.{ac,in}}.
Diffstat (limited to 'subr')
-rw-r--r-- | subr/build.subr | 35 | ||||
-rw-r--r-- | subr/pkg_autoconf.subr | 10 | ||||
-rw-r--r-- | subr/pkg_build.subr | 5 | ||||
-rw-r--r-- | subr/pkg_build_dir.subr | 11 | ||||
-rw-r--r-- | subr/pkg_disabled.subr | 5 | ||||
-rw-r--r-- | subr/pkg_extract.subr | 17 | ||||
-rw-r--r-- | subr/pkg_install.subr | 6 | ||||
-rw-r--r-- | subr/pkg_setup_env.subr | 85 | ||||
-rw-r--r-- | subr/pkg_setup_vars.subr | 36 | ||||
-rw-r--r-- | subr/pkg_work_dir.subr | 12 | ||||
-rw-r--r-- | subr/post_tarballs.subr | 18 | ||||
-rw-r--r-- | subr/pre_setup_env.subr | 15 |
12 files changed, 148 insertions, 107 deletions
diff --git a/subr/build.subr b/subr/build.subr index 14c932e2..d6e72898 100644 --- a/subr/build.subr +++ b/subr/build.subr @@ -11,6 +11,7 @@ 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}"; }; test_cmd() { command -v "${1}" >/dev/null; }; +toupper() { echo "${1}" | tr a-z A-Z; }; build_fileop() { local _op="${1}"; shift; @@ -119,15 +120,26 @@ set_build_script_done() { }; lfilter() { - local _list="${1}" _filter="${2}" _lnew _litem _lfilter; + [ "x${1}" = "x-not" ] && { local _notfl=1; shift; } + local _list="${1}" _filter="${2}" _lnew _litem _lfilter _filterfl; + [ -z "${_filter}" ] && { echo "${_list}"; return 0; }; for _litem in ${_list}; do + _filterfl=0; for _lfilter in ${_filter}; do - if [ "${_lfilter}" = "${_litem}" ]; then + if [ "${_notfl:-0}" -eq 0 ]\ + && [ "${_lfilter}" = "${_litem}" ]; then _lnew="${_lnew:+${_lnew} }${_litem}"; break; - fi; + elif [ "${_notfl:-0}" -eq 1 ]\ + && [ "${_lfilter}" = "${_litem}" ]; then + _filterfl=1; break; + fi; done; + if [ "${_notfl:-0}" -eq 1 ]\ + && [ "${_filterfl:-0}" -eq 0 ]; then + _lnew="${_lnew:+${_lnew} }${_litem}"; + fi; done; - echo ${_lnew}; + echo "${_lnew}"; }; lmatch() { @@ -198,15 +210,14 @@ set_env_vars_with_sep() { }; subst_tgts() { + local _pkgs; while [ ${#} -ge 1 ]; do - case "${1}" in - dev) - echo "${DEV_PACKAGES}"; ;; - devroot) - echo "${DEVROOT_PACKAGES}"; ;; - world) echo "${WORLD_PACKAGES}"; ;; - *) echo "${1}"; ;; - esac; shift; + _pkgs="$(get_var_unsafe "$(toupper "${1}")_TARGET")"; + if [ -n "${_pkgs}" ]; then + echo "${_pkgs}"; + else + echo "${1}"; + fi; shift; done; }; diff --git a/subr/pkg_autoconf.subr b/subr/pkg_autoconf.subr index 810ec5a7..fd201282 100644 --- a/subr/pkg_autoconf.subr +++ b/subr/pkg_autoconf.subr @@ -8,11 +8,6 @@ pkg_autoconf() { -e "${WORKDIR}/${PKG_SUBDIR}/configure.ac" -o \ -e "${WORKDIR}/${PKG_SUBDIR}/configure.in" -o \ -e "${WORKDIR}/${PKG_SUBDIR}/config.guess" ]; then - find "${WORKDIR}/${PKG_SUBDIR}" -name config.sub \ - -exec echo mv -- {} {}.orig \; \ - -exec mv -- {} {}.orig \; \ - -exec echo install -m 0700 "${MIDIPIX_BUILD_PWD}/etc/config.sub" {} \; \ - -exec install -m 0700 "${MIDIPIX_BUILD_PWD}/etc/config.sub" {} \;; if [ -e "${WORKDIR}/${PKG_SUBDIR}/configure.ac" ]\ && [ ! -e "${WORKDIR}/${PKG_SUBDIR}/configure" ]; then for __ in bootstrap bootstrap.sh autogen.sh ""; do @@ -36,6 +31,11 @@ pkg_autoconf() { fi; done; fi; + find "${WORKDIR}/${PKG_SUBDIR}" -name config.sub \ + -exec echo mv -- {} {}.orig \; \ + -exec mv -- {} {}.orig \; \ + -exec echo install -m 0700 "${MIDIPIX_BUILD_PWD}/etc/config.sub" {} \; \ + -exec install -m 0700 "${MIDIPIX_BUILD_PWD}/etc/config.sub" {} \;; if [ "${PKG_BUILD_TYPE}" != host ]; then for __ in ${PKG_BUILD_DIR} ${PKG_CONFIG_CACHE_EXTRA}; do build_fileop cp "${MIDIPIX_BUILD_PWD}/etc/config.cache" "${WORKDIR}/${__}/"; diff --git a/subr/pkg_build.subr b/subr/pkg_build.subr index 16ac1331..4cb29d29 100644 --- a/subr/pkg_build.subr +++ b/subr/pkg_build.subr @@ -9,7 +9,7 @@ pkg_build() { fi; if [ -n "${PKG_BUILD_CMDLINE}" ]; then ${PKG_BUILD_CMDLINE}; - elif [ ${PKG_NO_MAKE_BUILD:-0} -eq 0 ]; then + else # N.B. We only specify CC= here if the current package does not use GNU # autoconf as it often abuses it by appending -std={gnu99,...} to it # instead of amending CFLAGS. @@ -21,7 +21,8 @@ pkg_build() { "${CFLAGS_FOR_BUILD:+CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD}}" \ "${PKG_CFLAGS_BUILD_EXTRA:+CFLAGS+=${PKG_CFLAGS_BUILD_EXTRA}}" \ "${PKG_LDFLAGS_BUILD:+LDFLAGS=${PKG_LDFLAGS_BUILD}}" \ - "${PKG_LDFLAGS_BUILD_EXTRA:+LDFLAGS+=${PKG_LDFLAGS_BUILD_EXTRA}}"; + "${PKG_LDFLAGS_BUILD_EXTRA:+LDFLAGS+=${PKG_LDFLAGS_BUILD_EXTRA}}"\ + "LIBTOOL=${PKG_SLIBTOOL:-slibtool}"; fi; }; diff --git a/subr/pkg_build_dir.subr b/subr/pkg_build_dir.subr index 7d8a95fd..e9104ab2 100644 --- a/subr/pkg_build_dir.subr +++ b/subr/pkg_build_dir.subr @@ -3,10 +3,15 @@ # pkg_build_dir() { - if [ ! -d "${WORKDIR}/${PKG_BUILD_DIR}" ]; then - build_fileop mkdir "${WORKDIR}/${PKG_BUILD_DIR}"; + if [ -z "${PKG_BUILD_DIR}" ]; then + if [ -e "${WORKDIR}/${PKG_SUBDIR}/configure" ]\ + || [ -e "${WORKDIR}/${PKG_SUBDIR}/configure.ac" ]\ + || [ -e "${WORKDIR}/${PKG_SUBDIR}/configure.in" ]; then + set_build_dir "${PKG_SUBDIR}" "${PKG_BUILD_TYPE:-native}"; + else + PKG_BUILD_DIR="${PKG_SUBDIR}"; + fi; fi; - build_fileop cd "${WORKDIR}/${PKG_BUILD_DIR}"; }; # vim:filetype=sh diff --git a/subr/pkg_disabled.subr b/subr/pkg_disabled.subr index 3b5a3081..f9580c64 100644 --- a/subr/pkg_disabled.subr +++ b/subr/pkg_disabled.subr @@ -3,7 +3,10 @@ # pkg_disabled() { - if [ "${PKG_DISABLED:-0}" -eq 1 ]; then + local _pkg_name_uc; + _pkg_name_uc="$(toupper "${PKG_NAME}")"; + if [ "$(get_var_unsafe PKG_${_pkg_name_uc}_DISABLED)" = "1" ]; then + log_msg vnfo "Skipping disabled package \`${PKG_NAME}.'"; exit 0; fi; }; diff --git a/subr/pkg_extract.subr b/subr/pkg_extract.subr index f6982937..f6ddff2e 100644 --- a/subr/pkg_extract.subr +++ b/subr/pkg_extract.subr @@ -6,23 +6,20 @@ pkg_extract() { if [ -n "${PKG_URL}" ]\ && [ "${PKG_URL_TYPE:-wget}" = wget ]; then build_fileop rm "${WORKDIR}/${PKG_SUBDIR}"; - if [ "${PKG_SUBDIR_CREATE:-0}" -eq 1 ]; then - build_fileop mkdir "${WORKDIR}/${PKG_SUBDIR}"; - fi; if [ "${PKG_FNAME##*.tar.}" = "bz2" ]; then - bunzip2 -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}${PKG_SUBDIR_CREATE:+/${PKG_SUBDIR}}" -xf -; + bunzip2 -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}" -xf -; elif [ "${PKG_FNAME##*.tar.}" = "gz" ]; then - gunzip -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}${PKG_SUBDIR_CREATE:+/${PKG_SUBDIR}}" -xf -; + gunzip -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}" -xf -; elif [ "${PKG_FNAME##*.tar.}" = "xz" ]; then - xz -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}${PKG_SUBDIR_CREATE:+/${PKG_SUBDIR}}" -xf -; + xz -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}" -xf -; elif [ "${PKG_FNAME##*.t}" = "bz2" ]; then - bunzip2 -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}${PKG_SUBDIR_CREATE:+/${PKG_SUBDIR}}" -xf -; + bunzip2 -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}" -xf -; elif [ "${PKG_FNAME##*.t}" = "gz" ]; then - gunzip -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}${PKG_SUBDIR_CREATE:+/${PKG_SUBDIR}}" -xf -; + gunzip -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}" -xf -; elif [ "${PKG_FNAME##*.t}" = "xz" ]; then - xz -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}${PKG_SUBDIR_CREATE:+/${PKG_SUBDIR}}" -xf -; + xz -d < "${DLCACHEDIR}/${PKG_FNAME}" | tar -C "${WORKDIR}" -xf -; else - tar -C "${WORKDIR}${PKG_SUBDIR_CREATE:+/${PKG_SUBDIR}}" -xf "${DLCACHEDIR}/${PKG_FNAME}"; + tar -C "${WORKDIR}" -xf "${DLCACHEDIR}/${PKG_FNAME}"; fi; fi; }; diff --git a/subr/pkg_install.subr b/subr/pkg_install.subr index fc76098e..8e4a5b7a 100644 --- a/subr/pkg_install.subr +++ b/subr/pkg_install.subr @@ -88,6 +88,7 @@ pkg_install() { "${PKG_LDFLAGS_INSTALL:+LDFLAGS=${PKG_LDFLAGS_INSTALL}}" \ "${PKG_LDFLAGS_INSTALL_EXTRA:+LDFLAGS+=${PKG_LDFLAGS_INSTALL_EXTRA}}" \ "${PKG_RANLIB_INSTALL:+RANLIB=${PKG_RANLIB_INSTALL}}" \ + "LIBTOOL=${PKG_SLIBTOOL:-slibtool}" \ ${PKG_INSTALL_TARGET:=install}; if [ -n "${PKG_PREFIX_EXTRA}" ]; then run_cmd_unsplit make \ @@ -99,6 +100,7 @@ pkg_install() { "${PKG_LDFLAGS_INSTALL:+LDFLAGS=${PKG_LDFLAGS_INSTALL}}" \ "${PKG_LDFLAGS_INSTALL_EXTRA:+LDFLAGS+=${PKG_LDFLAGS_INSTALL_EXTRA}}" \ "${PKG_RANLIB_INSTALL:+RANLIB=${PKG_RANLIB_INSTALL}}" \ + "LIBTOOL=${PKG_SLIBTOOL:-slibtool}" \ ${PKG_INSTALL_TARGET_EXTRA:=install} \ DESTDIR=${PKG_PREFIX_EXTRA}; fi; @@ -107,7 +109,9 @@ pkg_install() { if [ -n "${PKG_INSTALL_FILES}" ]; then (install_files -v ${PKG_PREFIX} ${PKG_INSTALL_FILES}); fi; - pkgp_install_libs; + if [ "${PKG_NO_INSTALL_LIBS:-0}" -eq 0 ]; then + pkgp_install_libs; + fi; pkgp_install_pkgconfig; }; diff --git a/subr/pkg_setup_env.subr b/subr/pkg_setup_env.subr index 591edfdc..43d1160c 100644 --- a/subr/pkg_setup_env.subr +++ b/subr/pkg_setup_env.subr @@ -3,79 +3,38 @@ # 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 + if [ -z "${PKG_URL}" ]\ + && [ -z "${PKG_URLS_GIT}" ]\ + && [ -z "${PKG_VERSION}" ]; then log_msg failexit "Error: package \`${PKG_NAME}' missing in build.vars."; else + [ -z "${MIDIPIX_BUILD_PWD}" ] && MIDIPIX_BUILD_PWD="$(pwd)"; [ -n "${PKG_ENV_VARS_EXTRA}" ] && set_env_vars_with_sep : "${PKG_ENV_VARS_EXTRA}"; [ -z "${PKG_FNAME}" ] && PKG_FNAME="${PKG_URL##*/}"; [ -z "${PKG_TARGET}" ] && PKG_TARGET="${TARGET}"; - [ -z "${MIDIPIX_BUILD_PWD}" ] && MIDIPIX_BUILD_PWD="$(pwd)"; - if [ -z "${PKG_SUBDIR}" ]; then - if [ -n "${PKG_URLS_GIT}" ]; then - PKG_SUBDIR="${PKG_URLS_GIT%%=*}"; - else - PKG_SUBDIR="${PKG_FNAME%%.t*}"; - fi; - fi; - 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"; + case "${PKG_BUILD_TYPE}" in + host) export AR="ar"; export CC="gcc"; export CXX="g++"; - export RANLIB="ranlib"; - else - export AR="${PKG_TARGET}-ar"; + export RANLIB="ranlib"; ;; + *) export AR="${PKG_TARGET}-ar"; export CC="${PKG_TARGET}-gcc"; export CXX="${PKG_TARGET}-g++"; - export RANLIB="${PKG_TARGET}-ranlib"; + export RANLIB="${PKG_TARGET}-ranlib"; ;; + esac; + case "${PKG_SUBDIR}" in + ?*) ;; + *) case "${PKG_URLS_GIT}" in + ?*) PKG_SUBDIR="${PKG_URLS_GIT%%=*}"; ;; + *) PKG_SUBDIR="${PKG_FNAME%%.t*}"; ;; + esac; ;; + esac; + export LIBTOOL="${PKG_SLIBTOOL:-slibtool}"; + export MAKE="make LIBTOOL=${PKG_SLIBTOOL:-slibtool}"; + if [ -n "${PKG_ENV_VARS}" ]; then + PKG_ENV_VARS="$(echo "${PKG_ENV_VARS}" | tr " " "\n" | sort | tr "\n" " ")"; + log_env_vars "build" ${PKG_ENV_VARS}; 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; }; diff --git a/subr/pkg_setup_vars.subr b/subr/pkg_setup_vars.subr new file mode 100644 index 00000000..07b91fcb --- /dev/null +++ b/subr/pkg_setup_vars.subr @@ -0,0 +1,36 @@ +# +# 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 diff --git a/subr/pkg_work_dir.subr b/subr/pkg_work_dir.subr new file mode 100644 index 00000000..20b9ce17 --- /dev/null +++ b/subr/pkg_work_dir.subr @@ -0,0 +1,12 @@ +# +# set -o errexit -o noglob are assumed. +# + +pkg_work_dir() { + if [ ! -d "${WORKDIR}/${PKG_BUILD_DIR}" ]; then + build_fileop mkdir "${WORKDIR}/${PKG_BUILD_DIR}"; + fi; + build_fileop cd "${WORKDIR}/${PKG_BUILD_DIR}"; +}; + +# vim:filetype=sh diff --git a/subr/post_tarballs.subr b/subr/post_tarballs.subr index 4769dce8..2082366b 100644 --- a/subr/post_tarballs.subr +++ b/subr/post_tarballs.subr @@ -25,10 +25,10 @@ postp_tarball_toolchain() { tar -cpf - bin include lib lib64 libexec share "${TARGET}" |\ "${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_CROSS_FNAME}"; log_msg info "Finished building toolchain tarball."; - if [ -x "$(which gpg 2>/dev/null)" -a -n "${TARBALL_CROSS_SIGN_GPG_KEY}" ] &&\ - gpg --list-keys "${TARBALL_CROSS_SIGN_GPG_KEY}" >/dev/null 2>&1; then + if [ -x "$(which gpg 2>/dev/null)" -a -n "${TARBALL_SIGN_GPG_KEY}" ] && \ + gpg --list-keys "${TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then gpg --armor --passphrase-file /dev/null \ - --local-user "${TARBALL_CROSS_SIGN_GPG_KEY}" --sign "${TARBALL_CROSS_FNAME}"; + --local-user "${TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_CROSS_FNAME}"; log_msg info "Signed toolchain tarball."; fi; }; @@ -39,10 +39,10 @@ postp_tarball_minipix() { midipix_shortcut.vbs midipix.sh README |\ "${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_MINIPIX_FNAME}"; log_msg info "Finished building binary Minipix distribution tarball."; - if [ -x "$(which gpg 2>/dev/null)" -a -n "${TARBALL_MINIPIX_SIGN_GPG_KEY}" ] &&\ - gpg --list-keys "${TARBALL_MINIPIX_SIGN_GPG_KEY}" >/dev/null 2>&1; then + if [ -x "$(which gpg 2>/dev/null)" -a -n "${TARBALL_SIGN_GPG_KEY}" ] && \ + gpg --list-keys "${TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then gpg --armor --passphrase-file /dev/null \ - --local-user "${TARBALL_MINIPIX_SIGN_GPG_KEY}" --sign "${TARBALL_MINIPIX_FNAME}"; + --local-user "${TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_MINIPIX_FNAME}"; log_msg info "Signed binary Minipix distribution tarball."; fi; }; @@ -57,10 +57,10 @@ postp_tarball_src() { -not -path tmp/ptycon/.git) |\ "${TARBALL_COMPRESS_CMD}" ${TARBALL_COMPRESS_ARGS} -c > "${TARBALL_SRC_FNAME}"; log_msg info "Finished building source tarball."; - if [ -x "$(which gpg 2>/dev/null)" -a -n "${TARBALL_SRC_SIGN_GPG_KEY}" ] &&\ - gpg --list-keys "${TARBALL_SRC_SIGN_GPG_KEY}" >/dev/null 2>&1; then + if [ -x "$(which gpg 2>/dev/null)" -a -n "${TARBALL_SIGN_GPG_KEY}" ] && \ + gpg --list-keys "${TARBALL_SIGN_GPG_KEY}" >/dev/null 2>&1; then gpg --armor --passphrase-file /dev/null \ - --local-user "${TARBALL_SRC_SIGN_GPG_KEY}" --sign "${TARBALL_SRC_FNAME}"; + --local-user "${TARBALL_SIGN_GPG_KEY}" --sign "${TARBALL_SRC_FNAME}"; log_msg info "Signed source tarball."; fi; }; diff --git a/subr/pre_setup_env.subr b/subr/pre_setup_env.subr index d5de2772..8bef5820 100644 --- a/subr/pre_setup_env.subr +++ b/subr/pre_setup_env.subr @@ -8,9 +8,22 @@ pre_setup_env() { && [ -e /proc/cpuinfo ]; then BUILD_CPUS=$(awk '/^processor/{cpus++} END{print cpus}' /proc/cpuinfo); fi; - for __ in ${HOME}/midipix_build.vars ../midipix_build.vars ./vars/build.vars; do + : ${ARCH:=nt64}; : ${BUILD:=debug}; + if [ "${ARCH}" = nt32 ]; then + TARGET="i686-nt32-midipix"; + elif [ "${ARCH}" = nt64 ]; then + TARGET="x86_64-nt64-midipix"; + else + if [ "${BUILD}" != debug ]\ + && [ "${BUILD}" != release ]; then + log_msg failexit "Error: unknown build type \`${BUILD}'."; + fi; + log_msg failexit "Error: invalid architecture \`${ARCH}'."; + fi; + for __ in ${HOME}/midipix_build.vars ../midipix_build.vars ./vars/env.vars ./vars/build.vars; do [ -e ${__} ] && . ${__}; done; + export PATH="${PREFIX}/bin${PATH:+:${PATH}}"; if [ ${ARG_IPV4_ONLY:-0} -eq 1 ]; then WGET_ARGS="-4${WGET_ARGS:+ ${WGET_ARGS}}"; elif [ ${ARG_IPV6_ONLY:-0} -eq 1 ]; then |