diff options
author | Lucía Andrea Illanes Albornoz <lucia@luciaillanes.de> | 2023-02-17 19:29:28 +0100 |
---|---|---|
committer | Lucía Andrea Illanes Albornoz <lucia@luciaillanes.de> | 2023-02-17 19:29:28 +0100 |
commit | e9fa0774ed2e7e030a68f5b0ae51fe6dd69fe492 (patch) | |
tree | 37e46c2578bd8f4f435073db01abc514976da8a8 /subr.pkg/pkg_configure_autotools.subr | |
parent | 56495632fc8bf612766a9c431e37ff27a903e8c6 (diff) | |
download | midipix_build-e9fa0774ed2e7e030a68f5b0ae51fe6dd69fe492.tar.bz2 midipix_build-e9fa0774ed2e7e030a68f5b0ae51fe6dd69fe492.tar.xz |
Make everything a bit faster.
0) Issues several prayers and sacrifices to Enki under threat of a terrible deluge sent down by Ellil
1) Convert fork-write/read exprs to be non-forking
2) Pass mostly everything by reference
3) Don't bother cleaning the variable namespace because Bourne shell is an abomination
4) Removes broken ./pkgtool.sh -s, --restart-at, --update-diff & ./build.sh --dump-{in,on-abort}
5) Cleanup
Diffstat (limited to 'subr.pkg/pkg_configure_autotools.subr')
-rw-r--r-- | subr.pkg/pkg_configure_autotools.subr | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/subr.pkg/pkg_configure_autotools.subr b/subr.pkg/pkg_configure_autotools.subr new file mode 100644 index 00000000..c5753dc5 --- /dev/null +++ b/subr.pkg/pkg_configure_autotools.subr @@ -0,0 +1,114 @@ +# +# set +o errexit -o noglob -o nounset is assumed. +# + +pkg_configure_autotools() { + local _pca_group_name="${1}" _pca_pkg_name="${2}" _pca_restart_at="${3}" \ + _pca_config_cache="" _pca_config_guest_fname="" _pca_fname="" \ + _pca_subdir_tgt=""; + + if [ "${PKG_CONFIGURE_TYPE:+1}" = 1 ]\ + && [ "${PKG_CONFIGURE_TYPE}" != "autotools" ]; then + return 0; + fi; + + if [ "${PKG_AUTOCONF_CONFIG_GUESS:-midipix}" = "midipix" ]; then + _pca_config_guest_fname="config.guess"; + else + _pca_config_guest_fname=""; + fi; + + if rtl_exists_any "${PKG_BASE_DIR}/${PKG_SUBDIR}" \ + ${_pca_config_guest_fname:+"${_pca_config_guest_fname}"} \ + "configure.ac" "configure.in" "configure"; + then + rtl_export_vars PKG_CONFIG "${PKG_PKG_CONFIG:-}" PKG_CONFIG_LIBDIR "${PKG_PKG_CONFIG_LIBDIR:-}"; + + if [ "${PKG_FORCE_AUTORECONF:-0}" -eq 1 ]\ + && ! (cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && autoreconf -fiv); then + return 1; + fi; + + if [ -e "${PKG_BASE_DIR}/${PKG_SUBDIR}/configure.ac" ]\ + && [ ! -e "${PKG_BASE_DIR}/${PKG_SUBDIR}/configure" ]; then + for _pca_fname in bootstrap bootstrap.sh autogen.sh; do + if [ -e "${PKG_BASE_DIR}/${PKG_SUBDIR}/${_pca_fname}" ]; then + for _pca_subdir_tgt in \ + "${PKG_BASE_DIR}/${PKG_SUBDIR}/build-aux" \ + "${PKG_BASE_DIR}/${PKG_SUBDIR}"; + do if [ -e "${_pca_subdir_tgt}" ]; then + if ! rtl_fileop install -m 0700 \ + "${MIDIPIX_BUILD_PWD}/etc/config.sub" \ + "${_pca_subdir_tgt}/config.sub"; then + return 1; + fi; + + if [ "${PKG_AUTOCONF_CONFIG_GUESS:-midipix}" = "midipix" ]; then + if ! rtl_fileop install -m 0700 \ + "${MIDIPIX_BUILD_PWD}/etc/config.guess"\ + "${_pca_subdir_tgt}/config.guess"; then + return 1; + else + break; + fi; + fi; + fi; + done; + + if ! (rtl_fileop cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && \ + /bin/sh "${_pca_fname}"); then + return 1; + else + break; + fi; + fi; + done; + + if ! (rtl_fileop cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && autoconf); then + return 1; + fi; + fi; + + for _pca_fname in $(find "${PKG_BASE_DIR}/${PKG_SUBDIR}" -name config.sub); do + if ! rtl_fileop mv "${_pca_fname}" "${_pca_fname}.orig"\ + || ! rtl_fileop install -m 0700 "${MIDIPIX_BUILD_PWD}/etc/config.sub" "${_pca_fname}"; then + return 1; + fi; + done; + + if [ "${PKG_AUTOCONF_CONFIG_GUESS:-midipix}" = "midipix" ]; then + for _pca_fname in $(find "${PKG_BASE_DIR}/${PKG_SUBDIR}" -name config.guess); do + if ! rtl_fileop mv "${_pca_fname}" "${_pca_fname}.orig"\ + || ! rtl_fileop install -m 0700 "${MIDIPIX_BUILD_PWD}/etc/config.guess" "${_pca_fname}"; then + return 1; + fi; + done; + fi; + + if [ "${PKG_BUILD_TYPE}" != host ]; then + if ! rtl_fileop touch "${PKG_BUILD_DIR}/config.cache"; then + return 1; + else + for _pca_config_cache in \ + "${PKG_CONFIG_CACHE:-}" \ + "${PKG_CONFIG_CACHE_LOCAL:-}" \ + "${PKG_CONFIG_CACHE_EXTRA:-}"; + do if [ "${_pca_config_cache:+1}" = 1 ]\ + && ! printf "%s\n" "${_pca_config_cache}" |\ + tr " " "\n" >> "${PKG_BUILD_DIR}/config.cache"; then + return 1; + fi; + done; + + if ! sed -i"" "s,%PREFIX%,${PKG_PREFIX},g" "${PKG_BUILD_DIR}/config.cache"; then + return 1; + fi; + fi; + fi; + rtl_export_vars -u PKG_CONFIG "${PKG_PKG_CONFIG:-}" PKG_CONFIG_LIBDIR "${PKG_PKG_CONFIG_LIBDIR:-}"; + fi; + + return 0; +}; + +# vim:filetype=sh |