diff options
author | Lucía Andrea Illanes Albornoz <lucia@luciaillanes.de> | 2023-03-27 09:57:12 +0200 |
---|---|---|
committer | Lucía Andrea Illanes Albornoz <lucia@luciaillanes.de> | 2023-03-27 09:57:12 +0200 |
commit | 01b00593bbae331b4fe7904542b3623e8f3331e2 (patch) | |
tree | fb7c5fe8a86a934a7412f98271efc8ce6c563320 | |
parent | b7cca31d9092af8b11c038504eb7246b25fcaea4 (diff) | |
download | midipix_build-01b00593bbae331b4fe7904542b3623e8f3331e2.tar.bz2 midipix_build-01b00593bbae331b4fe7904542b3623e8f3331e2.tar.xz |
Generalise subr.pkg/pkg_configure_autotools.subr code.
-rw-r--r-- | etc/README.md | 2 | ||||
-rw-r--r-- | midipix.env | 2 | ||||
-rw-r--r-- | subr.ex/ex_rtl_configure.subr | 350 | ||||
-rw-r--r-- | subr.ex/ex_rtl_make.subr | 184 | ||||
-rw-r--r-- | subr.ex/ex_rtl_run.subr | 400 | ||||
-rw-r--r-- | subr.pkg/pkg_build.subr | 2 | ||||
-rw-r--r-- | subr.pkg/pkg_build_clean.subr | 2 | ||||
-rw-r--r-- | subr.pkg/pkg_configure.subr | 4 | ||||
-rw-r--r-- | subr.pkg/pkg_configure_autotools.subr | 117 | ||||
-rw-r--r-- | subr.pkg/pkg_install_make.subr | 2 |
10 files changed, 559 insertions, 506 deletions
diff --git a/etc/README.md b/etc/README.md index 1d0acfe9..16d779fd 100644 --- a/etc/README.md +++ b/etc/README.md @@ -714,7 +714,7 @@ VERSION`` and/or ``URLS_GIT``, respectively. | Package variable name | Type | Description |
| ---------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| AR | CmdName | Toolchain library archive editor ``ar(1)`` |
-| AUTOCONF_CONFIG_GUESS | String | Either of ``midipix`` (copy Midipix ``config.guess`` from ``etc/config.guess``) or ``keep``; defaults to ``midipix`` |
+| AUTOCONF_CONFIG_GUESS | String | Either of ``copy`` (copy ``config.guess`` from ``etc/config.guess``) or ``keep``; defaults to ``copy`` |
| BASE_DIR | DirName(Abs) | Package build root directory beneath ``${BUILD_WORKDIR}`` |
| BUILD_DIR | DirName(Unit) | Package build directory beneath ``${PKG_BASE_DIR}`` |
| BUILD_STAGES_DISABLE | List( ) | Build stages to disable during package build |
diff --git a/midipix.env b/midipix.env index 06bb55f1..51097869 100644 --- a/midipix.env +++ b/midipix.env @@ -174,7 +174,7 @@ rtl_get_var_unsafe \$DEFAULT_LDFLAGS_RUNTIME -u "DEFAULT_LDFLAGS_${BUILD_KIND}_R # # Default command & tool flags & variables -: ${DEFAULT_AUTOCONF_CONFIG_GUESS:="midipix"}; +: ${DEFAULT_AUTOCONF_CONFIG_GUESS:="copy"}; : ${DEFAULT_CMAKE_LISTFILE:="CMakeLists.txt"}; : ${DEFAULT_GITROOT:=git://midipix.org}; : ${DEFAULT_GITROOT_HEAD:=git://midipix.org}; diff --git a/subr.ex/ex_rtl_configure.subr b/subr.ex/ex_rtl_configure.subr new file mode 100644 index 00000000..f68a0ecb --- /dev/null +++ b/subr.ex/ex_rtl_configure.subr @@ -0,0 +1,350 @@ +# +# Copyright (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Lucía Andrea Illanes Albornoz <lucia@luciaillanes.de> +# set +o errexit -o noglob -o nounset is assumed. +# +# Package {configure,make} command execution +# + +# +# ex_rtl_configure() - run configure script +# @_ar: ar(1) command name or pathname +# @_cc: C compiler command name or pathname +# @_configure: configure script command name or pathname +# @_cxx: C++ compiler command name or pathname +# @_ld: ld(1) command name or pathname +# @_libtool: libtool(1) command name or pathname or "none" +# @_pkg_config: pkg-config(1) command name or pathname +# @_python: python command name or pathname +# @_ranlib: ranlib(1) command name or pathname +# @--: (ignored) +# @_flags: configure script flags as a whitespace-separated list +# @_flags_extra: extra configure script flags as a whitespace-separated likst +# @_flags_list: configure script flags as a :-separated list +# @_flags_extra_list: extra configure script flags as a :-separated list +# @--: (ignored) +# @_cflags: $CFLAGS +# @_cflags_extra: extra $CFLAGS +# @_cppflags: $CPPFLAGS +# @_cppflags_extra: extra $CPPFLAGS +# @_cxxflags: $CXXFLAGS +# @_cxxflags_extra: extra $CXXFLAGS +# @_ldflags: $LDFLAGS +# @_ldflags_extra: extra $LDFLAGS +# @_pkg_config_libdir: pkg-config(1) search directory +# +# Returns: zero (0) on success, non-zero (>0) on failure +# +ex_rtl_configure() { + local _erc_ar="${1}" _erc_cc="${2}" _erc_configure="${3}" _erc_cxx="${4}" _erc_ld="${5}" \ + _erc_libtool="${6}" _erc_pkg_config="${7}" _erc_python="${8}" _erc_ranlib="${9}" \ + _erc_ignored="${10}" \ + _erc_flags="${11}" _erc_flags_extra="${12}" \ + _erc_flags_list="${13}" _erc_flags_extra_list="${14}" \ + _erc_ignored="${15}" \ + _erc_cflags="${16}" _erc_cflags_extra="${17}" _erc_cppflags="${18}" \ + _erc_cppflags_extra="${19}" _erc_cxxflags="${20}" _erc_cxxflags_extra="${21}" \ + _erc_ldflags="${22}" _erc_ldflags_extra="${23}" _erc_pkg_config_libdir="${24}" \ + _erc_rc=0; + + case "${_erc_libtool:-}" in + none) _erc_libtool=""; ;; + esac; + + [ "${_erc_cflags_extra:+1}" = 1 ] && _erc_cflags="${_erc_cflags:+${_erc_cflags} }${_erc_cflags_extra}"; + [ "${_erc_cppflags_extra:+1}" = 1 ] && _erc_cppflags="${_erc_cppflags:+${_erc_cppflags} }${_erc_cppflags_extra}"; + [ "${_erc_cxxflags_extra:+1}" = 1 ] && _erc_cxxflags="${_erc_cxxflags:+${_erc_cxxflags} }${_erc_cxxflags_extra}"; + [ "${_erc_ldflags_extra:+1}" = 1 ] && _erc_ldflags="${_erc_ldflags:+${_erc_ldflags} }${_erc_ldflags_extra}"; + +( + if [ "${_erc_libtool:+1}" = 1 ]; then + export MAKE="make LIBTOOL=${_erc_libtool}"; + fi; + + [ "${_erc_ar:+1}" = 1 ] && export AR="${_erc_ar}"; + [ "${_erc_cc:+1}" = 1 ] && export CC="${_erc_cc}"; + [ "${_erc_cxx:+1}" = 1 ] && export CXX="${_erc_cxx}"; + [ "${_erc_ld:+1}" = 1 ] && export LD="${_erc_ld}"; + [ "${_erc_libtool:+1}" = 1 ] && export LIBTOOL="${_erc_libtool}"; + [ "${_erc_pkg_config:+1}" = 1 ] && export PKG_CONFIG="${_erc_pkg_config}"; + [ "${_erc_python:+1}" = 1 ] && export PYTHON="${_erc_python}"; + [ "${_erc_ranlib:+1}" = 1 ] && export RANLIB="${_erc_ranlib}"; + + [ "${_erc_cflags:+1}" = 1 ] && export CFLAGS="${_erc_cflags}"; + [ "${_erc_cppflags:+1}" = 1 ] && export CPPFLAGS="${_erc_cppflags}"; + [ "${_erc_cxxflags:+1}" = 1 ] && export CXXFLAGS="${_erc_cxxflags}"; + [ "${_erc_ldflags:+1}" = 1 ] && export LDFLAGS="${_erc_ldflags}"; + [ "${_erc_pkg_config_libdir:+1}" = 1 ] && export PKG_CONFIG_LIBDIR="${_erc_pkg_config_libdir}"; + + if [ "${_erc_flags_list:+1}" = 1 ]; then + rtl_run_cmdlineV ":" "${_erc_configure}" \ + "${_erc_flags_list}" \ + "${_erc_flags_extra_list:-}" \ + ; + exit "${?}"; + elif [ "${_erc_flags_extra_list:+1}" = 1 ]; then + rtl_run_cmdlineV ":" "${_erc_configure}" \ + ${_erc_flags:-} \ + "${_erc_flags_extra_list:-}" \ + ; + exit "${?}"; + else + rtl_run_cmdlineV ":" "${_erc_configure}" \ + ${_erc_flags:-} \ + ${_erc_flags_extra:-} \ + ; + exit "${?}"; + fi; +); + _erc_rc="${?}"; + + return "${_erc_rc}"; +}; + +# +# ex_rtl_configure_cmake() - run configure script +# @_ar: ar(1) command name or pathname +# @_cc: C compiler command name or pathname +# @_ccache: ccache(1) command name or pathname or "" +# @_cmake: CMake command name or pathname +# @_cxx: C++ compiler command name or pathname +# @_ld: ld(1) command name or pathname +# @_pkg_config: pkg-config(1) command name or pathname +# @_python: python command name or pathname +# @_ranlib: ranlib(1) command name or pathname +# @--: (ignored) +# @_build_type: CMake build type (host, cross, native) +# @_cmake_args: additional CMake arguments as a whitespace-separated list +# @_cmake_args_extra: additional CMake extra arguments as a whitespace-separated likst +# @_prefix: build prefix pathname +# @_subdir: CMake build directory pathname +# @_system_name: CMake system name +# @_system_processor: CMake system processor +# @--: (ignored) +# @_cflags: $CFLAGS +# @_cflags_extra: extra $CFLAGS +# @_cppflags: $CPPFLAGS +# @_cppflags_extra: extra $CPPFLAGS +# @_cxxflags: $CXXFLAGS +# @_cxxflags_extra: extra $CXXFLAGS +# @_ldflags: $LDFLAGS +# @_ldflags_extra: extra $LDFLAGS +# @_pkg_config_libdir: pkg-config(1) search directory +# +# Returns: zero (0) on success, non-zero (>0) on failure +# +ex_rtl_configure_cmake() { + local _ercc_ar="${1}" _ercc_cc="${2}" _ercc_ccache="${3}" _ercc_cmake="${4}" \ + _ercc_cxx="${5}" _ercc_ld="${6}" _ercc_pkg_config="${7}" _ercc_python="${8}" \ + _ercc_ranlib="${9}" \ + _ercc_ignored="${10}" \ + _ercc_build_type="${11}" \ + _ercc_cmake_args="${12}" _ercc_cmake_args_extra="${13}" \ + _ercc_prefix="${14}" _ercc_subdir="${15}" \ + _ercc_system_name="${16}" _ercc_system_processor="${17}" \ + _ercc_ignored="${18}" \ + _ercc_cflags="${19}" _ercc_cflags_extra="${20}" _ercc_cppflags="${21}" \ + _ercc_cppflags_extra="${22}" _ercc_cxxflags="${23}" _ercc_cxxflags_extra="${24}" \ + _ercc_ldflags="${25}" _ercc_ldflags_extra="${26}" _ercc_pkg_config_libdir="${27}" \ + _ercc_cmd_name="" _ercc_cmake_args_auto="" _ercc_rc=0 _ercc_vname="" _ercc_vval="" + + [ "${_ercc_cflags_extra:+1}" = 1 ] && _ercc_cflags="${_ercc_cflags:+${_ercc_cflags} }${_ercc_cflags_extra}"; + [ "${_ercc_cppflags_extra:+1}" = 1 ] && _ercc_cppflags="${_ercc_cppflags:+${_ercc_cppflags} }${_ercc_cppflags_extra}"; + [ "${_ercc_cxxflags_extra:+1}" = 1 ] && _ercc_cxxflags="${_ercc_cxxflags:+${_ercc_cxxflags} }${_ercc_cxxflags_extra}"; + [ "${_ercc_ldflags_extra:+1}" = 1 ] && _ercc_ldflags="${_ercc_ldflags:+${_ercc_ldflags} }${_ercc_ldflags_extra}"; + +( + [ "${_ercc_pkg_config:+1}" = 1 ] && export PKG_CONFIG="${_ercc_pkg_config}"; + [ "${_ercc_pkg_config_libdir:+1}" = 1 ] && export PKG_CONFIG_LIBDIR="${_ercc_pkg_config_libdir}"; + [ "${_ercc_python:+1}" = 1 ] && export PYTHON="${_ercc_python}"; + + for _ercc_vname in ar cc cxx ld pkg_config ranlib; do + case "${_ercc_vname}" in + cc|cxx) + _ercc_vname="_ercc_${_ercc_vname}"; + if [ "${_ercc_ccache:+1}" = 1 ]; then + eval ${_ercc_vname}="\${${_ercc_vname}#${_ercc_ccache} }"; + fi; + ;; + + *) + _ercc_vname="_ercc_${_ercc_vname}"; + ;; + esac; + + if eval [ '"${'"${_ercc_vname}"':+1}"' = 1 ]\ + && eval [ '"${'"${_ercc_vname}"'#/}"' = '"${'"${_ercc_vname}"'}"' ]; then + eval _ercc_cmd_name="\${${_ercc_vname}% *}"; + eval _ercc_vval="\${${_ercc_vname}#* }"; + eval ${_ercc_vname}='$(which "${_ercc_cmd_name}")' || return 1; + fi; + done; + + rtl_lconcat \$_ercc_cmake_args_auto "-DCMAKE_AR=${_ercc_ar}" ":"; + rtl_lconcat \$_ercc_cmake_args_auto "-DCMAKE_BUILD_TYPE=${_ercc_build_type}" ":"; + rtl_lconcat \$_ercc_cmake_args_auto "-DCMAKE_C_COMPILER=${_ercc_cc}" ":"; + if [ "${_ercc_ccache:+1}" = 1 ]; then + rtl_lconcat \$_ercc_cmake_args_auto "-DCMAKE_C_COMPILER_LAUNCHER=${_ercc_ccache}" ":"; + fi; + rtl_lconcat \$_ercc_cmake_args_auto "-DCMAKE_C_FLAGS=${_ercc_cflags}" ":"; + rtl_lconcat \$_ercc_cmake_args_auto "-DCMAKE_CPP_FLAGS=${_ercc_cppflags}" ":"; + rtl_lconcat \$_ercc_cmake_args_auto "-DCMAKE_CXX_COMPILER=${_ercc_cxx}" ":"; + if [ "${_ercc_ccache:+1}" = 1 ]; then + rtl_lconcat \$_ercc_cmake_args_auto "-DCMAKE_CXX_COMPILER_LAUNCHER=${_ercc_ccache}" ":"; + fi; + rtl_lconcat \$_ercc_cmake_args_auto "-DCMAKE_CXX_FLAGS=${_ercc_cxxflags}" ":"; + rtl_lconcat \$_ercc_cmake_args_auto "-DCMAKE_EXE_LINKER_FLAGS=${_ercc_ldflags}" ":"; + rtl_lconcat \$_ercc_cmake_args_auto "-DCMAKE_FIND_ROOT_PATH=${_ercc_prefix}" ":"; + rtl_lconcat \$_ercc_cmake_args_auto "-DCMAKE_INSTALL_PREFIX=" ":"; + rtl_lconcat \$_ercc_cmake_args_auto "-DCMAKE_LINKER=${_ercc_ld}" ":"; + rtl_lconcat \$_ercc_cmake_args_auto "-DCMAKE_MODULE_LINKER_FLAGS=${_ercc_ldflags}" ":"; + rtl_lconcat \$_ercc_cmake_args_auto "-DCMAKE_RANLIB=${_ercc_ranlib}" ":"; + rtl_lconcat \$_ercc_cmake_args_auto "-DCMAKE_SHARED_LINKER_FLAGS=${_ercc_ldflags}" ":"; + rtl_lconcat \$_ercc_cmake_args_auto "-DCMAKE_SYSTEM_PROCESSOR=${_ercc_system_processor}" ":"; + rtl_lconcat \$_ercc_cmake_args_auto "-DPKG_CONFIG_EXECUTABLE=${_ercc_pkg_config}" ":"; + + case "${_ercc_build_type}" in + native) + rtl_lconcat \$_ercc_cmake_args_auto "-DCMAKE_SYSROOT=${_ercc_prefix}" ":"; + rtl_lconcat \$_ercc_cmake_args_auto "-DCMAKE_SYSTEM_NAME=${_ercc_system_name}" ":"; + ;; + esac; + + rtl_run_cmdlineV ":" "${_ercc_cmake}" \ + "${_ercc_cmake_args_auto}" \ + ${_ercc_cmake_args:-} \ + ${_ercc_cmake_args_extra:-} \ + "${_ercc_subdir}"; + exit "${?}"; +); + _ercc_rc="${?}"; + + return "${_ercc_rc}"; +}; + +# +# ex_rtl_configure_prepare() - prepare configure script for running +# @_build_type: build type (host, native) +# @_builddir: build directory pathname +# @_config_cache: optional configuration cache directives +# @_config_cache_local: optional local configuration cache directives +# @_config_cache_extra: optional extra configuration cache directives +# @_config_guess_fname: config.guess file pathname +# @_config_sub_global_fname: global config.sub file pathname +# @_copy_config_guess: copy config.guess (copy) or keep local config.guess (keep) +# @_force_autoreconf: 1 to force reconfiguration if already configured, 0 otherwise +# @_subdir: subdirectory pathname +# @_pkg_config: pkg-config(1) command name or pathname +# @_pkg_config_libdir: pkg-config(1) search directory +# @_prefix: prefix pathname +# +# Returns: zero (0) on success, non-zero (>0) on failure +# +ex_rtl_configure_prepare() { + local _ercp_build_type="${1}" _ercp_builddir="${2}" _ercp_config_cache="${3}" \ + _ercp_config_cache_local="${4}" _ercp_config_cache_extra="${5}" \ + _ercp_config_guess_fname="${6}" _ercp_config_sub_global_fname="${7}" \ + _ercp_copy_config_guess=="${8}" _ercp_force_autoreconf="${9}" \ + _ercp_subdir="${10}" _ercp_pkg_config="${11}" _ercp_pkg_config_libdir="${12}" \ + _ercp_prefix="${13}"; + + if rtl_exists_any "${_ercp_subdir}" \ + "configure.ac" \ + "configure.in" \ + "configure"; + then + rtl_export_vars \ + PKG_CONFIG "${_ercp_pkg_config}" \ + PKG_CONFIG_LIBDIR "${_ercp_pkg_config_libdir}"; + + if [ "${_ercp_force_autoreconf:-0}" -eq 1 ]\ + && ! (cd "${_ercp_subdir}" && autoreconf -fiv); then + return 1; + fi; + + if [ -e "${_ercp_subdir}/configure.ac" ]\ + && [ ! -e "${_ercp_subdir}/configure" ]; then + for _ercp_fname in bootstrap bootstrap.sh autogen.sh; do + if [ -e "${_ercp_subdir}/${_ercp_fname}" ]; then + for _ercp_subdir_tgt in \ + "${_ercp_subdir}/build-aux" \ + "${_ercp_subdir}"; + do if [ -e "${_ercp_subdir_tgt}" ]; then + if ! rtl_fileop install -m 0700 \ + "${_ercp_config_sub_global_fname}" \ + "${_ercp_subdir_tgt}/config.sub"; then + return 1; + fi; + + if [ "${_ercp_copy_config_guess}" = "copy" ]; then + if ! rtl_fileop install -m 0700 \ + "${_ercp_config_guess_fname}" \ + "${_ercp_subdir_tgt}/config.guess"; then + return 1; + else + break; + fi; + fi; + fi; + done; + + if ! (rtl_fileop cd "${_ercp_subdir}" && \ + /bin/sh "${_ercp_fname}"); then + return 1; + else + break; + fi; + fi; + done; + + if ! (rtl_fileop cd "${_ercp_subdir}" && autoconf); then + return 1; + fi; + fi; + + for _ercp_fname in $(find "${_ercp_subdir}" -name config.sub); do + if ! rtl_fileop mv "${_ercp_fname}" "${_ercp_fname}.orig"\ + || ! rtl_fileop install -m 0700 "${_ercp_config_sub_global_fname}" "${_ercp_fname}"; then + return 1; + fi; + done; + + if [ "${_ercp_copy_config_guess}" = "copy" ]; then + for _ercp_fname in $(find "${_ercp_subdir}" -name config.guess); do + if ! rtl_fileop mv "${_ercp_fname}" "${_ercp_fname}.orig"\ + || ! rtl_fileop install -m 0700 "${_ercp_config_guess_fname}" "${_ercp_fname}"; then + return 1; + fi; + done; + fi; + + if [ "${_ercp_build_type}" != host ]; then + if ! rtl_fileop touch "${_ercp_builddir}/config.cache"; then + return 1; + else + for _ercp_config_cache in \ + "${_ercp_config_cache:-}" \ + "${_ercp_config_cache_local:-}" \ + "${_ercp_config_cache_extra:-}"; + do + if [ "${_ercp_config_cache:+1}" = 1 ]\ + && ! printf "%s\n" "${_ercp_config_cache}" |\ + tr " " "\n" >> "${_ercp_builddir}/config.cache"; then + return 1; + fi; + done; + + if ! sed -i"" "s,%PREFIX%,${_ercp_prefix},g" "${_ercp_builddir}/config.cache"; then + return 1; + fi; + fi; + fi; + + rtl_export_vars -u \ + PKG_CONFIG "${_ercp_pkg_config}" \ + PKG_CONFIG_LIBDIR "${_ercp_pkg_config_libdir}"; + fi; + + return 0; +}; + +# vim:filetype=sh textwidth=0 diff --git a/subr.ex/ex_rtl_make.subr b/subr.ex/ex_rtl_make.subr new file mode 100644 index 00000000..6867dfad --- /dev/null +++ b/subr.ex/ex_rtl_make.subr @@ -0,0 +1,184 @@ +# +# Copyright (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Lucía Andrea Illanes Albornoz <lucia@luciaillanes.de> +# set +o errexit -o noglob -o nounset is assumed. +# +# Package make command execution +# + +# +# ex_rtl_make() - run make(1) +# @_ar: ar(1) command name or pathname +# @_cc: C compiler command name or pathname +# @_cxx: C++ compiler command name or pathname +# @_ld: ld(1) command name or pathname +# @_libtool: libtool(1) command name or pathname or "none" +# @_make: make(1) command name or pathname +# @_pkg_config: pkg-config(1) command name or pathname +# @_ranlib: ranlib(1) command name or pathname +# @--: (ignored) +# @_set_ccfl: 1 if CC=... is to be passed to make(1), 0 if CC=... is not to be passed to make(1) +# @_subdir: make(1) -C argument +# @--: (ignored) +# @_makeflags: make(1) flags as a whitespace-separated list +# @_makeflags_extra: extra make(1) flags as a whitespace-separated likst +# @_makeflags_list: make(1) flags as a :-separated list +# @_makeflags_extra_list: extra make(1) flags as a :-separated list +# @_makeflags_loadavg: make(1) -l load argument +# @_makeflags_parallelise: make(1) -j jobs argument +# @_makeflags_verbosity: make(1) Makefile verbosity arguments or "none" +# @--: (ignored) +# @_cflags: $CFLAGS +# @_cflags_extra: extra $CFLAGS +# @_cppflags: $CPPFLAGS +# @_cppflags_extra: extra $CPPFLAGS +# @_cxxflags: $CXXFLAGS +# @_cxxflags_extra: extra $CXXFLAGS +# @_ldflags: $LDFLAGS +# @_ldflags_extra: extra $LDFLAGS +# @_pkg_config_libdir: pkg-config(1) search directory +# @--: (ignored) +# @_destdir_spec: DESTDIR=... specification +# @_target: make(1) target +# +# Returns: zero (0) on success, non-zero (>0) on failure +# +ex_rtl_make() { + local _erm_ar="${1}" _erm_cc="${2}" _erm_cxx="${3}" _erm_ld="${4}" \ + _erm_libtool="${5}" _erm_make="${6}" _erm_pkg_config="${7}" _erm_ranlib="${8}" \ + _erm_ignored="${9}" \ + _erm_set_ccfl="${10}" _erm_subdir="${11}" \ + _erm_ignored="${12}" \ + _erm_makeflags="${13}" _erm_makeflags_extra="${14}" _erm_makeflags_list="${15}" \ + _erm_makeflags_extra_list="${16}" _erm_makeflags_loadavg="${17}" \ + _erm_makeflags_parallelise="${18}" _erm_makeflags_verbosity="${19}" \ + _erm_ignored="${20}" \ + _erm_cflags="${21}" _erm_cflags_extra="${22}" _erm_cppflags="${23}" \ + _erm_cppflags_extra="${24}" _erm_cxxflags="${25}" _erm_cxxflags_extra="${26}" \ + _erm_ldflags="${27}" _erm_ldflags_extra="${28}" _erm_pkg_config_libdir="${29}" \ + _erm_ignored="${30}" \ + _erm_destdir_spec="${31}" _erm_target="${32}" \ + _erm_rc=0; + + case "${_erm_makeflags_loadavg:-}" in + none) _erm_makeflags_loadavg=""; ;; + esac; + + case "${_erm_libtool:-}" in + none) _erm_libtool=""; ;; + esac; + + case "${_erm_makeflags_verbosity}" in + none) _erm_makeflags_verbosity=""; ;; + esac; + + case "${_erm_set_ccfl}" in + 1) _erm_set_ccfl="1"; ;; + *) _erm_set_ccfl=""; ;; + esac; + +( + if [ "${_erm_libtool:+1}" = 1 ]; then + export MAKE="make LIBTOOL=${_erm_libtool}"; + fi; + + if [ "${_erm_makeflags_list:+1}" = 1 ]; then + rtl_run_cmdlineV ":" "${_erm_make}" \ + AR="${_erm_ar}" \ + ${_erm_set_ccfl:+CC="${_erm_cc}"} \ + ${_erm_set_ccfl:+CXX="${_erm_cxx}"} \ + LD="${_erm_ld}" \ + ${_erm_libtool:+LIBTOOL="${_erm_libtool}"} \ + ${_erm_pkg_config:+PKG_CONFIG="${_erm_pkg_config}"} \ + RANLIB="${_erm_ranlib}" \ + \ + "${_erm_makeflags_list}" \ + "${_erm_makeflags_extra_list:-}" \ + ${_erm_makeflags_loadavg:-} \ + ${_erm_makeflags_parallelise:-} \ + ${_erm_makeflags_verbosity} \ + \ + ${_erm_cflags:+CFLAGS="${_erm_cflags}"} \ + ${_erm_cflags_extra:+CFLAGS+="${_erm_cflags_extra}"} \ + ${_erm_cppflags:+CPPFLAGS="${_erm_cppflags}"} \ + ${_erm_cppflags_extra:+CPPFLAGS+="${_erm_cppflags_extra}"} \ + ${_erm_cxxflags:+CXXFLAGS="${_erm_cxxflags}"} \ + ${_erm_cxxflags_extra:+CXXFLAGS+="${_erm_cxxflags_extra}"} \ + ${_erm_ldflags:+LDFLAGS="${_erm_ldflags}"} \ + ${_erm_ldflags_extra:+LDFLAGS+="${_erm_ldflags_extra}"} \ + ${_erm_pkg_config_libdir:+PKG_CONFIG_LIBDIR="${_erm_pkg_config_libdir}"} \ + \ + ${_erm_subdir:+-C "${_erm_subdir}"} \ + ${_erm_destdir_spec:+"${_erm_destdir_spec}"} \ + ${_erm_target:+"${_erm_target}"} \ + ; + exit "${?}"; + elif [ "${_erm_makeflags_extra_list:+1}" = 1 ]; then + rtl_run_cmdlineV ":" "${_erm_make}" \ + AR="${_erm_ar}" \ + ${_erm_set_ccfl:+CC="${_erm_cc}"} \ + ${_erm_set_ccfl:+CXX="${_erm_cxx}"} \ + LD="${_erm_ld}" \ + ${_erm_libtool:+LIBTOOL="${_erm_libtool}"} \ + ${_erm_pkg_config:+PKG_CONFIG="${_erm_pkg_config}"} \ + RANLIB="${_erm_ranlib}" \ + \ + ${_erm_makeflags:-} \ + "${_erm_makeflags_extra_list}" \ + ${_erm_makeflags_loadavg:-} \ + ${_erm_makeflags_parallelise:-} \ + ${_erm_makeflags_verbosity} \ + \ + ${_erm_cflags:+CFLAGS="${_erm_cflags}"} \ + ${_erm_cflags_extra:+CFLAGS+="${_erm_cflags_extra}"} \ + ${_erm_cppflags:+CPPFLAGS="${_erm_cppflags}"} \ + ${_erm_cppflags_extra:+CPPFLAGS+="${_erm_cppflags_extra}"} \ + ${_erm_cxxflags:+CXXFLAGS="${_erm_cxxflags}"} \ + ${_erm_cxxflags_extra:+CXXFLAGS+="${_erm_cxxflags_extra}"} \ + ${_erm_ldflags:+LDFLAGS="${_erm_ldflags}"} \ + ${_erm_ldflags_extra:+LDFLAGS+="${_erm_ldflags_extra}"} \ + ${_erm_pkg_config_libdir:+PKG_CONFIG_LIBDIR="${_erm_pkg_config_libdir}"} \ + \ + ${_erm_subdir:+-C "${_erm_subdir}"} \ + ${_erm_destdir_spec:+"${_erm_destdir_spec}"} \ + ${_erm_target:+"${_erm_target}"} \ + ; + exit "${?}"; + else + rtl_run_cmdlineV ":" "${_erm_make}" \ + AR="${_erm_ar}" \ + ${_erm_set_ccfl:+CC="${_erm_cc}"} \ + ${_erm_set_ccfl:+CXX="${_erm_cxx}"} \ + LD="${_erm_ld}" \ + ${_erm_libtool:+LIBTOOL="${_erm_libtool}"} \ + ${_erm_pkg_config:+PKG_CONFIG="${_erm_pkg_config}"} \ + RANLIB="${_erm_ranlib}" \ + \ + ${_erm_makeflags:-} \ + ${_erm_makeflags_extra:-} \ + ${_erm_makeflags_loadavg:-} \ + ${_erm_makeflags_parallelise:-} \ + ${_erm_makeflags_verbosity} \ + \ + ${_erm_cflags:+CFLAGS="${_erm_cflags}"} \ + ${_erm_cflags_extra:+CFLAGS+="${_erm_cflags_extra}"} \ + ${_erm_cppflags:+CPPFLAGS="${_erm_cppflags}"} \ + ${_erm_cppflags_extra:+CPPFLAGS+="${_erm_cppflags_extra}"} \ + ${_erm_cxxflags:+CXXFLAGS="${_erm_cxxflags}"} \ + ${_erm_cxxflags_extra:+CXXFLAGS+="${_erm_cxxflags_extra}"} \ + ${_erm_ldflags:+LDFLAGS="${_erm_ldflags}"} \ + ${_erm_ldflags_extra:+LDFLAGS+="${_erm_ldflags_extra}"} \ + ${_erm_pkg_config_libdir:+PKG_CONFIG_LIBDIR="${_erm_pkg_config_libdir}"} \ + \ + ${_erm_subdir:+-C "${_erm_subdir}"} \ + ${_erm_destdir_spec:+"${_erm_destdir_spec}"} \ + ${_erm_target:+"${_erm_target}"} \ + ; + exit "${?}"; + fi; +); + _erm_rc="${?}"; + + return "${_erm_rc}"; +}; + +# vim:filetype=sh textwidth=0 diff --git a/subr.ex/ex_rtl_run.subr b/subr.ex/ex_rtl_run.subr deleted file mode 100644 index 558c8486..00000000 --- a/subr.ex/ex_rtl_run.subr +++ /dev/null @@ -1,400 +0,0 @@ -# -# Copyright (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Lucía Andrea Illanes Albornoz <lucia@luciaillanes.de> -# set +o errexit -o noglob -o nounset is assumed. -# -# Package {configure,make} command execution -# - -# -# ex_rtl_run_configure() - run configure script -# @_ar: ar(1) command name or pathname -# @_cc: C compiler command name or pathname -# @_configure: configure script command name or pathname -# @_cxx: C++ compiler command name or pathname -# @_ld: ld(1) command name or pathname -# @_libtool: libtool(1) command name or pathname or "none" -# @_pkg_config: pkg-config(1) command name or pathname -# @_python: python command name or pathname -# @_ranlib: ranlib(1) command name or pathname -# @--: (ignored) -# @_flags: configure script flags as a whitespace-separated list -# @_flags_extra: extra configure script flags as a whitespace-separated likst -# @_flags_list: configure script flags as a :-separated list -# @_flags_extra_list: extra configure script flags as a :-separated list -# @--: (ignored) -# @_cflags: $CFLAGS -# @_cflags_extra: extra $CFLAGS -# @_cppflags: $CPPFLAGS -# @_cppflags_extra: extra $CPPFLAGS -# @_cxxflags: $CXXFLAGS -# @_cxxflags_extra: extra $CXXFLAGS -# @_ldflags: $LDFLAGS -# @_ldflags_extra: extra $LDFLAGS -# @_pkg_config_libdir: pkg-config(1) search directory -# -# Returns: zero (0) on success, non-zero (>0) on failure -# -ex_rtl_run_configure() { - local _errc_ar="${1}" _errc_cc="${2}" _errc_configure="${3}" _errc_cxx="${4}" _errc_ld="${5}" \ - _errc_libtool="${6}" _errc_pkg_config="${7}" _errc_python="${8}" _errc_ranlib="${9}" \ - _errc_ignored="${10}" \ - _errc_flags="${11}" _errc_flags_extra="${12}" \ - _errc_flags_list="${13}" _errc_flags_extra_list="${14}" \ - _errc_ignored="${15}" \ - _errc_cflags="${16}" _errc_cflags_extra="${17}" _errc_cppflags="${18}" \ - _errc_cppflags_extra="${19}" _errc_cxxflags="${20}" _errc_cxxflags_extra="${21}" \ - _errc_ldflags="${22}" _errc_ldflags_extra="${23}" _errc_pkg_config_libdir="${24}" \ - _errc_rc=0; - - case "${_errc_libtool:-}" in - none) _errc_libtool=""; ;; - esac; - - [ "${_errc_cflags_extra:+1}" = 1 ] && _errc_cflags="${_errc_cflags:+${_errc_cflags} }${_errc_cflags_extra}"; - [ "${_errc_cppflags_extra:+1}" = 1 ] && _errc_cppflags="${_errc_cppflags:+${_errc_cppflags} }${_errc_cppflags_extra}"; - [ "${_errc_cxxflags_extra:+1}" = 1 ] && _errc_cxxflags="${_errc_cxxflags:+${_errc_cxxflags} }${_errc_cxxflags_extra}"; - [ "${_errc_ldflags_extra:+1}" = 1 ] && _errc_ldflags="${_errc_ldflags:+${_errc_ldflags} }${_errc_ldflags_extra}"; - -( - if [ "${_errc_libtool:+1}" = 1 ]; then - export MAKE="make LIBTOOL=${_errc_libtool}"; - fi; - - [ "${_errc_ar:+1}" = 1 ] && export AR="${_errc_ar}"; - [ "${_errc_cc:+1}" = 1 ] && export CC="${_errc_cc}"; - [ "${_errc_cxx:+1}" = 1 ] && export CXX="${_errc_cxx}"; - [ "${_errc_ld:+1}" = 1 ] && export LD="${_errc_ld}"; - [ "${_errc_libtool:+1}" = 1 ] && export LIBTOOL="${_errc_libtool}"; - [ "${_errc_pkg_config:+1}" = 1 ] && export PKG_CONFIG="${_errc_pkg_config}"; - [ "${_errc_python:+1}" = 1 ] && export PYTHON="${_errc_python}"; - [ "${_errc_ranlib:+1}" = 1 ] && export RANLIB="${_errc_ranlib}"; - - [ "${_errc_cflags:+1}" = 1 ] && export CFLAGS="${_errc_cflags}"; - [ "${_errc_cppflags:+1}" = 1 ] && export CPPFLAGS="${_errc_cppflags}"; - [ "${_errc_cxxflags:+1}" = 1 ] && export CXXFLAGS="${_errc_cxxflags}"; - [ "${_errc_ldflags:+1}" = 1 ] && export LDFLAGS="${_errc_ldflags}"; - [ "${_errc_pkg_config_libdir:+1}" = 1 ] && export PKG_CONFIG_LIBDIR="${_errc_pkg_config_libdir}"; - - if [ "${_errc_flags_list:+1}" = 1 ]; then - rtl_run_cmdlineV ":" "${_errc_configure}" \ - "${_errc_flags_list}" \ - "${_errc_flags_extra_list:-}" \ - ; - exit "${?}"; - elif [ "${_errc_flags_extra_list:+1}" = 1 ]; then - rtl_run_cmdlineV ":" "${_errc_configure}" \ - ${_errc_flags:-} \ - "${_errc_flags_extra_list:-}" \ - ; - exit "${?}"; - else - rtl_run_cmdlineV ":" "${_errc_configure}" \ - ${_errc_flags:-} \ - ${_errc_flags_extra:-} \ - ; - exit "${?}"; - fi; -); - _errc_rc="${?}"; - - return "${_errc_rc}"; -}; - -# -# ex_rtl_run_configure_cmake() - run configure script -# @_ar: ar(1) command name or pathname -# @_cc: C compiler command name or pathname -# @_ccache: ccache(1) command name or pathname or "" -# @_cmake: CMake command name or pathname -# @_cxx: C++ compiler command name or pathname -# @_ld: ld(1) command name or pathname -# @_pkg_config: pkg-config(1) command name or pathname -# @_python: python command name or pathname -# @_ranlib: ranlib(1) command name or pathname -# @--: (ignored) -# @_build_type: CMake build type (host, cross, native) -# @_cmake_args: additional CMake arguments as a whitespace-separated list -# @_cmake_args_extra: additional CMake extra arguments as a whitespace-separated likst -# @_prefix: build prefix pathname -# @_subdir: CMake build directory pathname -# @_system_name: CMake system name -# @_system_processor: CMake system processor -# @--: (ignored) -# @_cflags: $CFLAGS -# @_cflags_extra: extra $CFLAGS -# @_cppflags: $CPPFLAGS -# @_cppflags_extra: extra $CPPFLAGS -# @_cxxflags: $CXXFLAGS -# @_cxxflags_extra: extra $CXXFLAGS -# @_ldflags: $LDFLAGS -# @_ldflags_extra: extra $LDFLAGS -# @_pkg_config_libdir: pkg-config(1) search directory -# -# Returns: zero (0) on success, non-zero (>0) on failure -# -ex_rtl_run_configure_cmake() { - local _errcc_ar="${1}" _errcc_cc="${2}" _errcc_ccache="${3}" _errcc_cmake="${4}" \ - _errcc_cxx="${5}" _errcc_ld="${6}" _errcc_pkg_config="${7}" _errcc_python="${8}" \ - _errcc_ranlib="${9}" \ - _errcc_ignored="${10}" \ - _errcc_build_type="${11}" \ - _errcc_cmake_args="${12}" _errcc_cmake_args_extra="${13}" \ - _errcc_prefix="${14}" _errcc_subdir="${15}" \ - _errcc_system_name="${16}" _errcc_system_processor="${17}" \ - _errcc_ignored="${18}" \ - _errcc_cflags="${19}" _errcc_cflags_extra="${20}" _errcc_cppflags="${21}" \ - _errcc_cppflags_extra="${22}" _errcc_cxxflags="${23}" _errcc_cxxflags_extra="${24}" \ - _errcc_ldflags="${25}" _errcc_ldflags_extra="${26}" _errcc_pkg_config_libdir="${27}" \ - _errcc_cmd_name="" _errcc_cmake_args_auto="" _errcc_rc=0 _errcc_vname="" _errcc_vval="" - - [ "${_errcc_cflags_extra:+1}" = 1 ] && _errcc_cflags="${_errcc_cflags:+${_errcc_cflags} }${_errcc_cflags_extra}"; - [ "${_errcc_cppflags_extra:+1}" = 1 ] && _errcc_cppflags="${_errcc_cppflags:+${_errcc_cppflags} }${_errcc_cppflags_extra}"; - [ "${_errcc_cxxflags_extra:+1}" = 1 ] && _errcc_cxxflags="${_errcc_cxxflags:+${_errcc_cxxflags} }${_errcc_cxxflags_extra}"; - [ "${_errcc_ldflags_extra:+1}" = 1 ] && _errcc_ldflags="${_errcc_ldflags:+${_errcc_ldflags} }${_errcc_ldflags_extra}"; - -( - [ "${_errcc_pkg_config:+1}" = 1 ] && export PKG_CONFIG="${_errcc_pkg_config}"; - [ "${_errcc_pkg_config_libdir:+1}" = 1 ] && export PKG_CONFIG_LIBDIR="${_errcc_pkg_config_libdir}"; - [ "${_errcc_python:+1}" = 1 ] && export PYTHON="${_errcc_python}"; - - for _errcc_vname in ar cc cxx ld pkg_config ranlib; do - case "${_errcc_vname}" in - cc|cxx) - _errcc_vname="_errcc_${_errcc_vname}"; - if [ "${_errcc_ccache:+1}" = 1 ]; then - eval ${_errcc_vname}="\${${_errcc_vname}#${_errcc_ccache} }"; - fi; - ;; - - *) - _errcc_vname="_errcc_${_errcc_vname}"; - ;; - esac; - - if eval [ '"${'"${_errcc_vname}"':+1}"' = 1 ]\ - && eval [ '"${'"${_errcc_vname}"'#/}"' = '"${'"${_errcc_vname}"'}"' ]; then - eval _errcc_cmd_name="\${${_errcc_vname}% *}"; - eval _errcc_vval="\${${_errcc_vname}#* }"; - eval ${_errcc_vname}='$(which "${_errcc_cmd_name}")' || return 1; - fi; - done; - - rtl_lconcat \$_errcc_cmake_args_auto "-DCMAKE_AR=${_errcc_ar}" ":"; - rtl_lconcat \$_errcc_cmake_args_auto "-DCMAKE_BUILD_TYPE=${_errcc_build_type}" ":"; - rtl_lconcat \$_errcc_cmake_args_auto "-DCMAKE_C_COMPILER=${_errcc_cc}" ":"; - if [ "${_errcc_ccache:+1}" = 1 ]; then - rtl_lconcat \$_errcc_cmake_args_auto "-DCMAKE_C_COMPILER_LAUNCHER=${_errcc_ccache}" ":"; - fi; - rtl_lconcat \$_errcc_cmake_args_auto "-DCMAKE_C_FLAGS=${_errcc_cflags}" ":"; - rtl_lconcat \$_errcc_cmake_args_auto "-DCMAKE_CPP_FLAGS=${_errcc_cppflags}" ":"; - rtl_lconcat \$_errcc_cmake_args_auto "-DCMAKE_CXX_COMPILER=${_errcc_cxx}" ":"; - if [ "${_errcc_ccache:+1}" = 1 ]; then - rtl_lconcat \$_errcc_cmake_args_auto "-DCMAKE_CXX_COMPILER_LAUNCHER=${_errcc_ccache}" ":"; - fi; - rtl_lconcat \$_errcc_cmake_args_auto "-DCMAKE_CXX_FLAGS=${_errcc_cxxflags}" ":"; - rtl_lconcat \$_errcc_cmake_args_auto "-DCMAKE_EXE_LINKER_FLAGS=${_errcc_ldflags}" ":"; - rtl_lconcat \$_errcc_cmake_args_auto "-DCMAKE_FIND_ROOT_PATH=${_errcc_prefix}" ":"; - rtl_lconcat \$_errcc_cmake_args_auto "-DCMAKE_INSTALL_PREFIX=" ":"; - rtl_lconcat \$_errcc_cmake_args_auto "-DCMAKE_LINKER=${_errcc_ld}" ":"; - rtl_lconcat \$_errcc_cmake_args_auto "-DCMAKE_MODULE_LINKER_FLAGS=${_errcc_ldflags}" ":"; - rtl_lconcat \$_errcc_cmake_args_auto "-DCMAKE_RANLIB=${_errcc_ranlib}" ":"; - rtl_lconcat \$_errcc_cmake_args_auto "-DCMAKE_SHARED_LINKER_FLAGS=${_errcc_ldflags}" ":"; - rtl_lconcat \$_errcc_cmake_args_auto "-DCMAKE_SYSTEM_PROCESSOR=${_errcc_system_processor}" ":"; - rtl_lconcat \$_errcc_cmake_args_auto "-DPKG_CONFIG_EXECUTABLE=${_errcc_pkg_config}" ":"; - - case "${_errcc_build_type}" in - native) - rtl_lconcat \$_errcc_cmake_args_auto "-DCMAKE_SYSROOT=${_errcc_prefix}" ":"; - rtl_lconcat \$_errcc_cmake_args_auto "-DCMAKE_SYSTEM_NAME=${_errcc_system_name}" ":"; - ;; - esac; - - rtl_run_cmdlineV ":" "${_errcc_cmake}" \ - "${_errcc_cmake_args_auto}" \ - ${_errcc_cmake_args:-} \ - ${_errcc_cmake_args_extra:-} \ - "${_errcc_subdir}"; - exit "${?}"; -); - _errcc_rc="${?}"; - - return "${_errcc_rc}"; -}; - -# -# ex_rtl_run_make() - run make(1) -# @_ar: ar(1) command name or pathname -# @_cc: C compiler command name or pathname -# @_cxx: C++ compiler command name or pathname -# @_ld: ld(1) command name or pathname -# @_libtool: libtool(1) command name or pathname or "none" -# @_make: make(1) command name or pathname -# @_pkg_config: pkg-config(1) command name or pathname -# @_ranlib: ranlib(1) command name or pathname -# @--: (ignored) -# @_set_ccfl: 1 if CC=... is to be passed to make(1), 0 if CC=... is not to be passed to make(1) -# @_subdir: make(1) -C argument -# @--: (ignored) -# @_makeflags: make(1) flags as a whitespace-separated list -# @_makeflags_extra: extra make(1) flags as a whitespace-separated likst -# @_makeflags_list: make(1) flags as a :-separated list -# @_makeflags_extra_list: extra make(1) flags as a :-separated list -# @_makeflags_loadavg: make(1) -l load argument -# @_makeflags_parallelise: make(1) -j jobs argument -# @_makeflags_verbosity: make(1) Makefile verbosity arguments or "none" -# @--: (ignored) -# @_cflags: $CFLAGS -# @_cflags_extra: extra $CFLAGS -# @_cppflags: $CPPFLAGS -# @_cppflags_extra: extra $CPPFLAGS -# @_cxxflags: $CXXFLAGS -# @_cxxflags_extra: extra $CXXFLAGS -# @_ldflags: $LDFLAGS -# @_ldflags_extra: extra $LDFLAGS -# @_pkg_config_libdir: pkg-config(1) search directory -# @--: (ignored) -# @_destdir_spec: DESTDIR=... specification -# @_target: make(1) target -# -# Returns: zero (0) on success, non-zero (>0) on failure -# -ex_rtl_run_make() { - local _errm_ar="${1}" _errm_cc="${2}" _errm_cxx="${3}" _errm_ld="${4}" \ - _errm_libtool="${5}" _errm_make="${6}" _errm_pkg_config="${7}" _errm_ranlib="${8}" \ - _errm_ignored="${9}" \ - _errm_set_ccfl="${10}" _errm_subdir="${11}" \ - _errm_ignored="${12}" \ - _errm_makeflags="${13}" _errm_makeflags_extra="${14}" _errm_makeflags_list="${15}" \ - _errm_makeflags_extra_list="${16}" _errm_makeflags_loadavg="${17}" \ - _errm_makeflags_parallelise="${18}" _errm_makeflags_verbosity="${19}" \ - _errm_ignored="${20}" \ - _errm_cflags="${21}" _errm_cflags_extra="${22}" _errm_cppflags="${23}" \ - _errm_cppflags_extra="${24}" _errm_cxxflags="${25}" _errm_cxxflags_extra="${26}" \ - _errm_ldflags="${27}" _errm_ldflags_extra="${28}" _errm_pkg_config_libdir="${29}" \ - _errm_ignored="${30}" \ - _errm_destdir_spec="${31}" _errm_target="${32}" \ - _errm_rc=0; - - case "${_errm_makeflags_loadavg:-}" in - none) _errm_makeflags_loadavg=""; ;; - esac; - - case "${_errm_libtool:-}" in - none) _errm_libtool=""; ;; - esac; - - case "${_errm_makeflags_verbosity}" in - none) _errm_makeflags_verbosity=""; ;; - esac; - - case "${_errm_set_ccfl}" in - 1) _errm_set_ccfl="1"; ;; - *) _errm_set_ccfl=""; ;; - esac; - -( - if [ "${_errm_libtool:+1}" = 1 ]; then - export MAKE="make LIBTOOL=${_errm_libtool}"; - fi; - - if [ "${_errm_makeflags_list:+1}" = 1 ]; then - rtl_run_cmdlineV ":" "${_errm_make}" \ - AR="${_errm_ar}" \ - ${_errm_set_ccfl:+CC="${_errm_cc}"} \ - ${_errm_set_ccfl:+CXX="${_errm_cxx}"} \ - LD="${_errm_ld}" \ - ${_errm_libtool:+LIBTOOL="${_errm_libtool}"} \ - ${_errm_pkg_config:+PKG_CONFIG="${_errm_pkg_config}"} \ - RANLIB="${_errm_ranlib}" \ - \ - "${_errm_makeflags_list}" \ - "${_errm_makeflags_extra_list:-}" \ - ${_errm_makeflags_loadavg:-} \ - ${_errm_makeflags_parallelise:-} \ - ${_errm_makeflags_verbosity} \ - \ - ${_errm_cflags:+CFLAGS="${_errm_cflags}"} \ - ${_errm_cflags_extra:+CFLAGS+="${_errm_cflags_extra}"} \ - ${_errm_cppflags:+CPPFLAGS="${_errm_cppflags}"} \ - ${_errm_cppflags_extra:+CPPFLAGS+="${_errm_cppflags_extra}"} \ - ${_errm_cxxflags:+CXXFLAGS="${_errm_cxxflags}"} \ - ${_errm_cxxflags_extra:+CXXFLAGS+="${_errm_cxxflags_extra}"} \ - ${_errm_ldflags:+LDFLAGS="${_errm_ldflags}"} \ - ${_errm_ldflags_extra:+LDFLAGS+="${_errm_ldflags_extra}"} \ - ${_errm_pkg_config_libdir:+PKG_CONFIG_LIBDIR="${_errm_pkg_config_libdir}"} \ - \ - ${_errm_subdir:+-C "${_errm_subdir}"} \ - ${_errm_destdir_spec:+"${_errm_destdir_spec}"} \ - ${_errm_target:+"${_errm_target}"} \ - ; - exit "${?}"; - elif [ "${_errm_makeflags_extra_list:+1}" = 1 ]; then - rtl_run_cmdlineV ":" "${_errm_make}" \ - AR="${_errm_ar}" \ - ${_errm_set_ccfl:+CC="${_errm_cc}"} \ - ${_errm_set_ccfl:+CXX="${_errm_cxx}"} \ - LD="${_errm_ld}" \ - ${_errm_libtool:+LIBTOOL="${_errm_libtool}"} \ - ${_errm_pkg_config:+PKG_CONFIG="${_errm_pkg_config}"} \ - RANLIB="${_errm_ranlib}" \ - \ - ${_errm_makeflags:-} \ - "${_errm_makeflags_extra_list}" \ - ${_errm_makeflags_loadavg:-} \ - ${_errm_makeflags_parallelise:-} \ - ${_errm_makeflags_verbosity} \ - \ - ${_errm_cflags:+CFLAGS="${_errm_cflags}"} \ - ${_errm_cflags_extra:+CFLAGS+="${_errm_cflags_extra}"} \ - ${_errm_cppflags:+CPPFLAGS="${_errm_cppflags}"} \ - ${_errm_cppflags_extra:+CPPFLAGS+="${_errm_cppflags_extra}"} \ - ${_errm_cxxflags:+CXXFLAGS="${_errm_cxxflags}"} \ - ${_errm_cxxflags_extra:+CXXFLAGS+="${_errm_cxxflags_extra}"} \ - ${_errm_ldflags:+LDFLAGS="${_errm_ldflags}"} \ - ${_errm_ldflags_extra:+LDFLAGS+="${_errm_ldflags_extra}"} \ - ${_errm_pkg_config_libdir:+PKG_CONFIG_LIBDIR="${_errm_pkg_config_libdir}"} \ - \ - ${_errm_subdir:+-C "${_errm_subdir}"} \ - ${_errm_destdir_spec:+"${_errm_destdir_spec}"} \ - ${_errm_target:+"${_errm_target}"} \ - ; - exit "${?}"; - else - rtl_run_cmdlineV ":" "${_errm_make}" \ - AR="${_errm_ar}" \ - ${_errm_set_ccfl:+CC="${_errm_cc}"} \ - ${_errm_set_ccfl:+CXX="${_errm_cxx}"} \ - LD="${_errm_ld}" \ - ${_errm_libtool:+LIBTOOL="${_errm_libtool}"} \ - ${_errm_pkg_config:+PKG_CONFIG="${_errm_pkg_config}"} \ - RANLIB="${_errm_ranlib}" \ - \ - ${_errm_makeflags:-} \ - ${_errm_makeflags_extra:-} \ - ${_errm_makeflags_loadavg:-} \ - ${_errm_makeflags_parallelise:-} \ - ${_errm_makeflags_verbosity} \ - \ - ${_errm_cflags:+CFLAGS="${_errm_cflags}"} \ - ${_errm_cflags_extra:+CFLAGS+="${_errm_cflags_extra}"} \ - ${_errm_cppflags:+CPPFLAGS="${_errm_cppflags}"} \ - ${_errm_cppflags_extra:+CPPFLAGS+="${_errm_cppflags_extra}"} \ - ${_errm_cxxflags:+CXXFLAGS="${_errm_cxxflags}"} \ - ${_errm_cxxflags_extra:+CXXFLAGS+="${_errm_cxxflags_extra}"} \ - ${_errm_ldflags:+LDFLAGS="${_errm_ldflags}"} \ - ${_errm_ldflags_extra:+LDFLAGS+="${_errm_ldflags_extra}"} \ - ${_errm_pkg_config_libdir:+PKG_CONFIG_LIBDIR="${_errm_pkg_config_libdir}"} \ - \ - ${_errm_subdir:+-C "${_errm_subdir}"} \ - ${_errm_destdir_spec:+"${_errm_destdir_spec}"} \ - ${_errm_target:+"${_errm_target}"} \ - ; - exit "${?}"; - fi; -); - _errm_rc="${?}"; - - return "${_errm_rc}"; -}; - -# vim:filetype=sh textwidth=0 diff --git a/subr.pkg/pkg_build.subr b/subr.pkg/pkg_build.subr index 9ca2afce..f3ec51df 100644 --- a/subr.pkg/pkg_build.subr +++ b/subr.pkg/pkg_build.subr @@ -21,7 +21,7 @@ pkg_build() { # autoconf as it often abuses it by appending -std={gnu99,...} to it # instead of amending CFLAGS. # - ex_rtl_run_make \ + ex_rtl_make \ "${PKG_AR}" "${PKG_CC}" "${PKG_CXX}" "${PKG_CCLD}" "${PKG_LIBTOOL}" \ "${PKG_MAKE}" "${PKG_PKG_CONFIG}" "${PKG_RANLIB}" \ -- \ diff --git a/subr.pkg/pkg_build_clean.subr b/subr.pkg/pkg_build_clean.subr index f93577ec..c9ba0e86 100644 --- a/subr.pkg/pkg_build_clean.subr +++ b/subr.pkg/pkg_build_clean.subr @@ -17,7 +17,7 @@ pkg_build_clean() { _pbc_subdir=""; fi; - ex_rtl_run_make \ + ex_rtl_make \ "${PKG_AR}" "${PKG_CC}" "${PKG_CXX}" "${PKG_CCLD}" "${PKG_LIBTOOL}" \ "${PKG_MAKE}" "${PKG_PKG_CONFIG}" "${PKG_RANLIB}" \ -- \ diff --git a/subr.pkg/pkg_configure.subr b/subr.pkg/pkg_configure.subr index 8d75b6f7..3148e88b 100644 --- a/subr.pkg/pkg_configure.subr +++ b/subr.pkg/pkg_configure.subr @@ -13,7 +13,7 @@ pkgp_configure_autotools() { then _ppca_rc=2; else - ex_rtl_run_configure \ + ex_rtl_configure \ "${PKG_AR}" "${PKG_CC}" "${PKG_CONFIGURE}" "${PKG_CXX}" "${PKG_LD}" \ "${PKG_LIBTOOL}" "${PKG_PKG_CONFIG}" "${PKG_PYTHON:-}" "${PKG_RANLIB}" \ -- \ @@ -53,7 +53,7 @@ pkgp_configure_cmake() { esac; esac; - ex_rtl_run_configure_cmake \ + ex_rtl_configure_cmake \ "${PKG_AR}" "${PKG_CC}" "${ARG_CCACHE}" "${PKG_CMAKE}" "${PKG_CXX}" \ "${PKG_LD}" "${PKG_PKG_CONFIG}" "${PKG_PYTHON:-}" "${PKG_RANLIB}" \ -- \ diff --git a/subr.pkg/pkg_configure_autotools.subr b/subr.pkg/pkg_configure_autotools.subr index b524de32..0a7a62d1 100644 --- a/subr.pkg/pkg_configure_autotools.subr +++ b/subr.pkg/pkg_configure_autotools.subr @@ -5,111 +5,30 @@ 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=""; + _pca_rc=0; 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"; + _pca_rc=0; 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:-}"; + ex_rtl_configure_prepare \ + "${PKG_BUILD_TYPE}" \ + "${PKG_BUILD_DIR}" \ + "${PKG_CONFIG_CACHE:-}" \ + "${PKG_CONFIG_CACHE_LOCAL:-}" \ + "${PKG_CONFIG_CACHE_EXTRA:-}" \ + "${MIDIPIX_BUILD_PWD}/etc/config.guess" \ + "${MIDIPIX_BUILD_PWD}/etc/config.sub" \ + "${PKG_AUTOCONF_CONFIG_GUESS:-copy}" \ + "${PKG_FORCE_AUTORECONF:-0}" \ + "${PKG_BASE_DIR}/${PKG_SUBDIR}" \ + "${PKG_PKG_CONFIG:-}" \ + "${PKG_PKG_CONFIG_LIBDIRG:-}" \ + "${PKG_PREFIX}"; + _pca_rc="${?}"; fi; - return 0; + return "${_pca_rc}"; }; # vim:filetype=sh textwidth=0 diff --git a/subr.pkg/pkg_install_make.subr b/subr.pkg/pkg_install_make.subr index fe255767..1fb896d7 100644 --- a/subr.pkg/pkg_install_make.subr +++ b/subr.pkg/pkg_install_make.subr @@ -17,7 +17,7 @@ pkg_install_make() { _pim_subdir=""; fi; - ex_rtl_run_make \ + ex_rtl_make \ "${PKG_AR}" "${PKG_CC}" "${PKG_CXX}" "${PKG_CCLD}" "${PKG_LIBTOOL}" \ "${PKG_MAKE}" "${PKG_PKG_CONFIG}" "${_pim_ranlib}" \ -- \ |