summaryrefslogtreecommitdiffhomepage
path: root/subr.ex
diff options
context:
space:
mode:
authorLucía Andrea Illanes Albornoz <lucia@luciaillanes.de>2023-03-27 08:04:23 +0200
committerLucía Andrea Illanes Albornoz <lucia@luciaillanes.de>2023-03-27 08:04:23 +0200
commit938c5c45b976387ceea5792b0ce9717dd97667eb (patch)
treef0dfdb3728fe7b62aef4a395f24f8e66cf85d824 /subr.ex
parent0753bb40540d5f1754ddd508614b3b606e10bd93 (diff)
downloadmidipix_build-938c5c45b976387ceea5792b0ce9717dd97667eb.tar.bz2
midipix_build-938c5c45b976387ceea5792b0ce9717dd97667eb.tar.xz
Generalise subr.pkg/*.subr code.
Diffstat (limited to 'subr.ex')
-rw-r--r--subr.ex/ex_pkg_run.subr400
-rw-r--r--subr.ex/ex_rtl.subr204
-rw-r--r--subr.ex/ex_rtl_midipix.subr92
-rw-r--r--subr.ex/ex_rtl_run.subr400
4 files changed, 696 insertions, 400 deletions
diff --git a/subr.ex/ex_pkg_run.subr b/subr.ex/ex_pkg_run.subr
deleted file mode 100644
index 38f48f34..00000000
--- a/subr.ex/ex_pkg_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_pkg_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_pkg_run_configure() {
- local _eprc_ar="${1}" _eprc_cc="${2}" _eprc_configure="${3}" _eprc_cxx="${4}" _eprc_ld="${5}" \
- _eprc_libtool="${6}" _eprc_pkg_config="${7}" _eprc_python="${8}" _eprc_ranlib="${9}" \
- _eprc_ignored="${10}" \
- _eprc_flags="${11}" _eprc_flags_extra="${12}" \
- _eprc_flags_list="${13}" _eprc_flags_extra_list="${14}" \
- _eprc_ignored="${15}" \
- _eprc_cflags="${16}" _eprc_cflags_extra="${17}" _eprc_cppflags="${18}" \
- _eprc_cppflags_extra="${19}" _eprc_cxxflags="${20}" _eprc_cxxflags_extra="${21}" \
- _eprc_ldflags="${22}" _eprc_ldflags_extra="${23}" _eprc_pkg_config_libdir="${24}" \
- _eprc_rc=0;
-
- case "${_eprc_libtool:-}" in
- none) _eprc_libtool=""; ;;
- esac;
-
- [ "${_eprc_cflags_extra:+1}" = 1 ] && _eprc_cflags="${_eprc_cflags:+${_eprc_cflags} }${_eprc_cflags_extra}";
- [ "${_eprc_cppflags_extra:+1}" = 1 ] && _eprc_cppflags="${_eprc_cppflags:+${_eprc_cppflags} }${_eprc_cppflags_extra}";
- [ "${_eprc_cxxflags_extra:+1}" = 1 ] && _eprc_cxxflags="${_eprc_cxxflags:+${_eprc_cxxflags} }${_eprc_cxxflags_extra}";
- [ "${_eprc_ldflags_extra:+1}" = 1 ] && _eprc_ldflags="${_eprc_ldflags:+${_eprc_ldflags} }${_eprc_ldflags_extra}";
-
-(
- if [ "${_eprc_libtool:+1}" = 1 ]; then
- export MAKE="make LIBTOOL=${_eprc_libtool}";
- fi;
-
- [ "${_eprc_ar:+1}" = 1 ] && export AR="${_eprc_ar}";
- [ "${_eprc_cc:+1}" = 1 ] && export CC="${_eprc_cc}";
- [ "${_eprc_cxx:+1}" = 1 ] && export CXX="${_eprc_cxx}";
- [ "${_eprc_ld:+1}" = 1 ] && export LD="${_eprc_ld}";
- [ "${_eprc_libtool:+1}" = 1 ] && export LIBTOOL="${_eprc_libtool}";
- [ "${_eprc_pkg_config:+1}" = 1 ] && export PKG_CONFIG="${_eprc_pkg_config}";
- [ "${_eprc_python:+1}" = 1 ] && export PYTHON="${_eprc_python}";
- [ "${_eprc_ranlib:+1}" = 1 ] && export RANLIB="${_eprc_ranlib}";
-
- [ "${_eprc_cflags:+1}" = 1 ] && export CFLAGS="${_eprc_cflags}";
- [ "${_eprc_cppflags:+1}" = 1 ] && export CPPFLAGS="${_eprc_cppflags}";
- [ "${_eprc_cxxflags:+1}" = 1 ] && export CXXFLAGS="${_eprc_cxxflags}";
- [ "${_eprc_ldflags:+1}" = 1 ] && export LDFLAGS="${_eprc_ldflags}";
- [ "${_eprc_pkg_config_libdir:+1}" = 1 ] && export PKG_CONFIG_LIBDIR="${_eprc_pkg_config_libdir}";
-
- if [ "${_eprc_flags_list:+1}" = 1 ]; then
- rtl_run_cmdlineV ":" "${_eprc_configure}" \
- "${_eprc_flags_list}" \
- "${_eprc_flags_extra_list:-}" \
- ;
- exit "${?}";
- elif [ "${_eprc_flags_extra_list:+1}" = 1 ]; then
- rtl_run_cmdlineV ":" "${_eprc_configure}" \
- ${_eprc_flags:-} \
- "${_eprc_flags_extra_list:-}" \
- ;
- exit "${?}";
- else
- rtl_run_cmdlineV ":" "${_eprc_configure}" \
- ${_eprc_flags:-} \
- ${_eprc_flags_extra:-} \
- ;
- exit "${?}";
- fi;
-);
- _eprc_rc="${?}";
-
- return "${_eprc_rc}";
-};
-
-#
-# ex_pkg_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_pkg_run_configure_cmake() {
- local _eprcc_ar="${1}" _eprcc_cc="${2}" _eprcc_ccache="${3}" _eprcc_cmake="${4}" \
- _eprcc_cxx="${5}" _eprcc_ld="${6}" _eprcc_pkg_config="${7}" _eprcc_python="${8}" \
- _eprcc_ranlib="${9}" \
- _eprcc_ignored="${10}" \
- _eprcc_build_type="${11}" \
- _eprcc_cmake_args="${12}" _eprcc_cmake_args_extra="${13}" \
- _eprcc_prefix="${14}" _eprcc_subdir="${15}" \
- _eprcc_system_name="${16}" _eprcc_system_processor="${17}" \
- _eprcc_ignored="${18}" \
- _eprcc_cflags="${19}" _eprcc_cflags_extra="${20}" _eprcc_cppflags="${21}" \
- _eprcc_cppflags_extra="${22}" _eprcc_cxxflags="${23}" _eprcc_cxxflags_extra="${24}" \
- _eprcc_ldflags="${25}" _eprcc_ldflags_extra="${26}" _eprcc_pkg_config_libdir="${27}" \
- _eprcc_cmd_name="" _eprcc_cmake_args_auto="" _eprcc_rc=0 _eprcc_vname="" _eprcc_vval=""
-
- [ "${_eprcc_cflags_extra:+1}" = 1 ] && _eprcc_cflags="${_eprcc_cflags:+${_eprcc_cflags} }${_eprcc_cflags_extra}";
- [ "${_eprcc_cppflags_extra:+1}" = 1 ] && _eprcc_cppflags="${_eprcc_cppflags:+${_eprcc_cppflags} }${_eprcc_cppflags_extra}";
- [ "${_eprcc_cxxflags_extra:+1}" = 1 ] && _eprcc_cxxflags="${_eprcc_cxxflags:+${_eprcc_cxxflags} }${_eprcc_cxxflags_extra}";
- [ "${_eprcc_ldflags_extra:+1}" = 1 ] && _eprcc_ldflags="${_eprcc_ldflags:+${_eprcc_ldflags} }${_eprcc_ldflags_extra}";
-
-(
- [ "${_eprcc_pkg_config:+1}" = 1 ] && export PKG_CONFIG="${_eprcc_pkg_config}";
- [ "${_eprcc_pkg_config_libdir:+1}" = 1 ] && export PKG_CONFIG_LIBDIR="${_eprcc_pkg_config_libdir}";
- [ "${_eprcc_python:+1}" = 1 ] && export PYTHON="${_eprcc_python}";
-
- for _eprcc_vname in ar cc cxx ld pkg_config ranlib; do
- case "${_eprcc_vname}" in
- cc|cxx)
- _eprcc_vname="_eprcc_${_eprcc_vname}";
- if [ "${_eprcc_ccache:+1}" = 1 ]; then
- eval ${_eprcc_vname}="\${${_eprcc_vname}#${_eprcc_ccache} }";
- fi;
- ;;
-
- *)
- _eprcc_vname="_eprcc_${_eprcc_vname}";
- ;;
- esac;
-
- if eval [ '"${'"${_eprcc_vname}"':+1}"' = 1 ]\
- && eval [ '"${'"${_eprcc_vname}"'#/}"' = '"${'"${_eprcc_vname}"'}"' ]; then
- eval _eprcc_cmd_name="\${${_eprcc_vname}% *}";
- eval _eprcc_vval="\${${_eprcc_vname}#* }";
- eval ${_eprcc_vname}='$(which "${_eprcc_cmd_name}")' || return 1;
- fi;
- done;
-
- rtl_lconcat \$_eprcc_cmake_args_auto "-DCMAKE_AR=${_eprcc_ar}" ":";
- rtl_lconcat \$_eprcc_cmake_args_auto "-DCMAKE_BUILD_TYPE=${_eprcc_build_type}" ":";
- rtl_lconcat \$_eprcc_cmake_args_auto "-DCMAKE_C_COMPILER=${_eprcc_cc}" ":";
- if [ "${_eprcc_ccache:+1}" = 1 ]; then
- rtl_lconcat \$_eprcc_cmake_args_auto "-DCMAKE_C_COMPILER_LAUNCHER=${_eprcc_ccache}" ":";
- fi;
- rtl_lconcat \$_eprcc_cmake_args_auto "-DCMAKE_C_FLAGS=${_eprcc_cflags}" ":";
- rtl_lconcat \$_eprcc_cmake_args_auto "-DCMAKE_CPP_FLAGS=${_eprcc_cppflags}" ":";
- rtl_lconcat \$_eprcc_cmake_args_auto "-DCMAKE_CXX_COMPILER=${_eprcc_cxx}" ":";
- if [ "${_eprcc_ccache:+1}" = 1 ]; then
- rtl_lconcat \$_eprcc_cmake_args_auto "-DCMAKE_CXX_COMPILER_LAUNCHER=${_eprcc_ccache}" ":";
- fi;
- rtl_lconcat \$_eprcc_cmake_args_auto "-DCMAKE_CXX_FLAGS=${_eprcc_cxxflags}" ":";
- rtl_lconcat \$_eprcc_cmake_args_auto "-DCMAKE_EXE_LINKER_FLAGS=${_eprcc_ldflags}" ":";
- rtl_lconcat \$_eprcc_cmake_args_auto "-DCMAKE_FIND_ROOT_PATH=${_eprcc_prefix}" ":";
- rtl_lconcat \$_eprcc_cmake_args_auto "-DCMAKE_INSTALL_PREFIX=" ":";
- rtl_lconcat \$_eprcc_cmake_args_auto "-DCMAKE_LINKER=${_eprcc_ld}" ":";
- rtl_lconcat \$_eprcc_cmake_args_auto "-DCMAKE_MODULE_LINKER_FLAGS=${_eprcc_ldflags}" ":";
- rtl_lconcat \$_eprcc_cmake_args_auto "-DCMAKE_RANLIB=${_eprcc_ranlib}" ":";
- rtl_lconcat \$_eprcc_cmake_args_auto "-DCMAKE_SHARED_LINKER_FLAGS=${_eprcc_ldflags}" ":";
- rtl_lconcat \$_eprcc_cmake_args_auto "-DCMAKE_SYSTEM_PROCESSOR=${_eprcc_system_processor}" ":";
- rtl_lconcat \$_eprcc_cmake_args_auto "-DPKG_CONFIG_EXECUTABLE=${_eprcc_pkg_config}" ":";
-
- case "${_eprcc_build_type}" in
- native)
- rtl_lconcat \$_eprcc_cmake_args_auto "-DCMAKE_SYSROOT=${_eprcc_prefix}" ":";
- rtl_lconcat \$_eprcc_cmake_args_auto "-DCMAKE_SYSTEM_NAME=${_eprcc_system_name}" ":";
- ;;
- esac;
-
- rtl_run_cmdlineV ":" "${_eprcc_cmake}" \
- "${_eprcc_cmake_args_auto}" \
- ${_eprcc_cmake_args:-} \
- ${_eprcc_cmake_args_extra:-} \
- "${_eprcc_subdir}";
- exit "${?}";
-);
- _eprcc_rc="${?}";
-
- return "${_eprcc_rc}";
-};
-
-#
-# ex_pkg_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_pkg_run_make() {
- local _eprm_ar="${1}" _eprm_cc="${2}" _eprm_cxx="${3}" _eprm_ld="${4}" \
- _eprm_libtool="${5}" _eprm_make="${6}" _eprm_pkg_config="${7}" _eprm_ranlib="${8}" \
- _eprm_ignored="${9}" \
- _eprm_set_ccfl="${10}" _eprm_subdir="${11}" \
- _eprm_ignored="${12}" \
- _eprm_makeflags="${13}" _eprm_makeflags_extra="${14}" _eprm_makeflags_list="${15}" \
- _eprm_makeflags_extra_list="${16}" _eprm_makeflags_loadavg="${17}" \
- _eprm_makeflags_parallelise="${18}" _eprm_makeflags_verbosity="${19}" \
- _eprm_ignored="${20}" \
- _eprm_cflags="${21}" _eprm_cflags_extra="${22}" _eprm_cppflags="${23}" \
- _eprm_cppflags_extra="${24}" _eprm_cxxflags="${25}" _eprm_cxxflags_extra="${26}" \
- _eprm_ldflags="${27}" _eprm_ldflags_extra="${28}" _eprm_pkg_config_libdir="${29}" \
- _eprm_ignored="${30}" \
- _eprm_destdir_spec="${31}" _eprm_target="${32}" \
- _eprm_rc=0;
-
- case "${_eprm_makeflags_loadavg:-}" in
- none) _eprm_makeflags_loadavg=""; ;;
- esac;
-
- case "${_eprm_libtool:-}" in
- none) _eprm_libtool=""; ;;
- esac;
-
- case "${_eprm_makeflags_verbosity}" in
- none) _eprm_makeflags_verbosity=""; ;;
- esac;
-
- case "${_eprm_set_ccfl}" in
- 1) _eprm_set_ccfl="1"; ;;
- *) _eprm_set_ccfl=""; ;;
- esac;
-
-(
- if [ "${_eprm_libtool:+1}" = 1 ]; then
- export MAKE="make LIBTOOL=${_eprm_libtool}";
- fi;
-
- if [ "${_eprm_makeflags_list:+1}" = 1 ]; then
- rtl_run_cmdlineV ":" "${_eprm_make}" \
- AR="${_eprm_ar}" \
- ${_eprm_set_ccfl:+CC="${_eprm_cc}"} \
- ${_eprm_set_ccfl:+CXX="${_eprm_cxx}"} \
- LD="${_eprm_ld}" \
- ${_eprm_libtool:+LIBTOOL="${_eprm_libtool}"} \
- ${_eprm_pkg_config:+PKG_CONFIG="${_eprm_pkg_config}"} \
- RANLIB="${_eprm_ranlib}" \
- \
- "${_eprm_makeflags_list}" \
- "${_eprm_makeflags_extra_list:-}" \
- ${_eprm_makeflags_loadavg:-} \
- ${_eprm_makeflags_parallelise:-} \
- ${_eprm_makeflags_verbosity} \
- \
- ${_eprm_cflags:+CFLAGS="${_eprm_cflags}"} \
- ${_eprm_cflags_extra:+CFLAGS+="${_eprm_cflags_extra}"} \
- ${_eprm_cppflags:+CPPFLAGS="${_eprm_cppflags}"} \
- ${_eprm_cppflags_extra:+CPPFLAGS+="${_eprm_cppflags_extra}"} \
- ${_eprm_cxxflags:+CXXFLAGS="${_eprm_cxxflags}"} \
- ${_eprm_cxxflags_extra:+CXXFLAGS+="${_eprm_cxxflags_extra}"} \
- ${_eprm_ldflags:+LDFLAGS="${_eprm_ldflags}"} \
- ${_eprm_ldflags_extra:+LDFLAGS+="${_eprm_ldflags_extra}"} \
- ${_eprm_pkg_config_libdir:+PKG_CONFIG_LIBDIR="${_eprm_pkg_config_libdir}"} \
- \
- ${_eprm_subdir:+-C "${_eprm_subdir}"} \
- ${_eprm_destdir_spec:+"${_eprm_destdir_spec}"} \
- ${_eprm_target:+"${_eprm_target}"} \
- ;
- exit "${?}";
- elif [ "${_eprm_makeflags_extra_list:+1}" = 1 ]; then
- rtl_run_cmdlineV ":" "${_eprm_make}" \
- AR="${_eprm_ar}" \
- ${_eprm_set_ccfl:+CC="${_eprm_cc}"} \
- ${_eprm_set_ccfl:+CXX="${_eprm_cxx}"} \
- LD="${_eprm_ld}" \
- ${_eprm_libtool:+LIBTOOL="${_eprm_libtool}"} \
- ${_eprm_pkg_config:+PKG_CONFIG="${_eprm_pkg_config}"} \
- RANLIB="${_eprm_ranlib}" \
- \
- ${_eprm_makeflags:-} \
- "${_eprm_makeflags_extra_list}" \
- ${_eprm_makeflags_loadavg:-} \
- ${_eprm_makeflags_parallelise:-} \
- ${_eprm_makeflags_verbosity} \
- \
- ${_eprm_cflags:+CFLAGS="${_eprm_cflags}"} \
- ${_eprm_cflags_extra:+CFLAGS+="${_eprm_cflags_extra}"} \
- ${_eprm_cppflags:+CPPFLAGS="${_eprm_cppflags}"} \
- ${_eprm_cppflags_extra:+CPPFLAGS+="${_eprm_cppflags_extra}"} \
- ${_eprm_cxxflags:+CXXFLAGS="${_eprm_cxxflags}"} \
- ${_eprm_cxxflags_extra:+CXXFLAGS+="${_eprm_cxxflags_extra}"} \
- ${_eprm_ldflags:+LDFLAGS="${_eprm_ldflags}"} \
- ${_eprm_ldflags_extra:+LDFLAGS+="${_eprm_ldflags_extra}"} \
- ${_eprm_pkg_config_libdir:+PKG_CONFIG_LIBDIR="${_eprm_pkg_config_libdir}"} \
- \
- ${_eprm_subdir:+-C "${_eprm_subdir}"} \
- ${_eprm_destdir_spec:+"${_eprm_destdir_spec}"} \
- ${_eprm_target:+"${_eprm_target}"} \
- ;
- exit "${?}";
- else
- rtl_run_cmdlineV ":" "${_eprm_make}" \
- AR="${_eprm_ar}" \
- ${_eprm_set_ccfl:+CC="${_eprm_cc}"} \
- ${_eprm_set_ccfl:+CXX="${_eprm_cxx}"} \
- LD="${_eprm_ld}" \
- ${_eprm_libtool:+LIBTOOL="${_eprm_libtool}"} \
- ${_eprm_pkg_config:+PKG_CONFIG="${_eprm_pkg_config}"} \
- RANLIB="${_eprm_ranlib}" \
- \
- ${_eprm_makeflags:-} \
- ${_eprm_makeflags_extra:-} \
- ${_eprm_makeflags_loadavg:-} \
- ${_eprm_makeflags_parallelise:-} \
- ${_eprm_makeflags_verbosity} \
- \
- ${_eprm_cflags:+CFLAGS="${_eprm_cflags}"} \
- ${_eprm_cflags_extra:+CFLAGS+="${_eprm_cflags_extra}"} \
- ${_eprm_cppflags:+CPPFLAGS="${_eprm_cppflags}"} \
- ${_eprm_cppflags_extra:+CPPFLAGS+="${_eprm_cppflags_extra}"} \
- ${_eprm_cxxflags:+CXXFLAGS="${_eprm_cxxflags}"} \
- ${_eprm_cxxflags_extra:+CXXFLAGS+="${_eprm_cxxflags_extra}"} \
- ${_eprm_ldflags:+LDFLAGS="${_eprm_ldflags}"} \
- ${_eprm_ldflags_extra:+LDFLAGS+="${_eprm_ldflags_extra}"} \
- ${_eprm_pkg_config_libdir:+PKG_CONFIG_LIBDIR="${_eprm_pkg_config_libdir}"} \
- \
- ${_eprm_subdir:+-C "${_eprm_subdir}"} \
- ${_eprm_destdir_spec:+"${_eprm_destdir_spec}"} \
- ${_eprm_target:+"${_eprm_target}"} \
- ;
- exit "${?}";
- fi;
-);
- _eprm_rc="${?}";
-
- return "${_eprm_rc}";
-};
-
-# vim:filetype=sh textwidth=0
diff --git a/subr.ex/ex_rtl.subr b/subr.ex/ex_rtl.subr
new file mode 100644
index 00000000..1da1b8ef
--- /dev/null
+++ b/subr.ex/ex_rtl.subr
@@ -0,0 +1,204 @@
+#
+# 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.
+#
+#
+
+#
+# ex_rtl_build_rpm() - build RPM package
+# @_destdir: package destination directory
+# @_name: package name
+# @_rpms_dname: RPMs directory pathname
+# @_spec_fname: RPM .spec file pathname
+# @_spec_fname_tgt: target package RPM .spec file pathname
+# @_tmp_dname: temporary files directory pathname
+# @_topdir: package top directory
+# @_url: package URL
+# @_version: package version
+# @_version_rpm: package RPM version
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
+ex_rtl_build_rpm() {
+ local _erbr_destdir="${1}" _erbr_name="${2}" _erbr_rpms_dname="${3}" _erbr_spec_fname="${4}" \
+ _erbr_spec_fname_tgt="${5}" _erbr_tmp_dname="${6}" _erbr_topdir="${7}" _erbr_url="${8}" \
+ _erbr_version="${9}" _erbr_version_rpm="${10}" \
+ _erbr_rc=0;
+
+ if ! rtl_fileop cp "${_erbr_spec_fname}" "${_erbr_spec_fname_tgt}"; then
+ return 1;
+ else
+ while true; do
+ rpmbuild \
+ -bb \
+ \
+ --define "_binary_payload w2T16.xzdio" \
+ \
+ --define="_tmppath ${_erbr_tmp_dname=}" \
+ --define="_topdir ${_erbr_topdir}" \
+ --define="pkg_destdir ${_erbr_destdir}" \
+ --define="pkg_name ${_erbr_name}" \
+ --define="pkg_url ${_erbr_url}" \
+ --define="pkg_version_full ${_erbr_version}" \
+ --define="pkg_version_rpm ${_erbr_version_rpm}" \
+ --nodeps "${_erbr_spec_fname_tgt}";
+ _erbr_rc="${?}";
+
+ if [ "${_erbr_rc}" -eq 0 ]; then
+ break;
+ elif [ "${_erbr_rc}" -eq 141 ]; then
+ continue;
+ else
+ return "${_erbr_rc}";
+ fi;
+ done;
+
+ if ! find "${_erbr_rpms_dname}/${_erbr_name}-${_erbr_version_rpm}/RPMS" \
+ -iname \*.rpm -exec cp -pP {} "${_erbr_rpms_dname}/" \; \
+ || ! rtl_fileop rm "${_erbr_rpms_dname}/${_erbr_name}-${_erbr_version_rpm}" \
+ || ! rtl_fileop cp "${_erbr_spec_fname_tgt}" "${_erbr_rpms_dname}/";
+ then
+ return 1;
+ fi;
+ fi;
+
+ return 0;
+};
+
+#
+# ex_rtl_expand_rpm_version() - expand RPM version strings
+# @_rurl: out reference to package URL
+# @_rversion: out reference to package version
+# @_rversion_rpm: out reference to RPM version string
+# @_subdir: package subdirectory
+# @_url: package URL
+# @_url_censor: package URL filter
+# @_urls_git: package Git URL(s)
+# @_version: package version
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
+ex_rtl_expand_rpm_version() {
+ local _ererv_rurl="${1#\$}" _ererv_rversion="${2#\$}" _ererv_rversion_rpm="${3#\$}" \
+ _ererv_subdir="${4}" _ererv_url="${5}" _ererv_url_censor="${6}" \
+ _ererv_urls_git="${7}" _ererv_version="${8}" \
+ _ererv_version_full="" _ererv_version_rpm=""
+
+ if [ "${_ererv_url:+1}" = 1 ]; then
+ _ererv_url="${_ererv_url%% *}";
+ _ererv_version_full="${_ererv_version}";
+ _ererv_version_rpm="${_ererv_version%%-*}";
+
+ elif [ "${_ererv_urls_git:+1}" = 1 ]; then
+ _ererv_url="${_ererv_urls_git%% *}";
+ _ererv_url="${_ererv_url##*=}";
+ _ererv_url="${_ererv_url%%@*}";
+
+ _ererv_version_rpm="$(cd "${_ererv_subdir}" && git rev-parse HEAD)" || return 1;
+ _ererv_version_full="${_ererv_version_rpm} ($(cd "${_ererv_subdir}" && git rev-parse --abbrev-ref HEAD))" || return 1;
+ fi;
+
+ if [ "${_ererv_url#${_ererv_url_censor}}" != "${_ererv_url}" ]; then
+ _ererv_url="Unknown";
+ fi;
+
+ eval ${_ererv_rurl}='${_ererv_url}';
+ eval ${_ererv_rversion}='${_ererv_version_full}';
+ eval ${_ererv_rversion_rpm}='${_ererv_version_rpm}';
+
+ return 0;
+};
+
+#
+# ex_rtl_fixup_pkgconfig_paths() - fixup pathname prefixes in pkg-config(1) files
+# @_dname_base: base directory pathname
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
+ex_rtl_fixup_pkgconfig_paths() {
+ local _erfpp_dname_base="${1}" \
+ _erfpp_pc_path="";
+
+ for _erfpp_pc_path in $(find "${_erfpp_dname_base=}" -name \*.pc); do
+ if [ -n "$(sed -ne '/^libdir=[^$]*$/p' "${_erfpp_pc_path}")" ] \
+ && ! sed -i"" -e '/^libdir=[^$]*$/s/^libdir=\(.*\)$/libdir=${exec_prefix}\1/' \
+ -e '/^exec_prefix=$/s/^.*$/exec_prefix=${prefix}/' \
+ "${_erfpp_pc_path}";
+ then
+ return 1;
+ fi;
+
+ if [ -n "$(sed -ne '/^includedir=[^$]*$/p' "${_erfpp_pc_path}")" ] \
+ && ! sed -i"" -e '/^includedir=[^$]*$/s/^includedir=\(.*\)$/includedir=${prefix}\1/' \
+ "${_erfpp_pc_path}";
+ then
+ return 1;
+ fi;
+ done;
+
+ return 0;
+};
+
+#
+# ex_rtl_purge_la_files() - purge .la files in tree
+# @_dname_base: base directory pathname
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
+ex_rtl_purge_la_files() {
+ local _erplf_dname_base="${1}" \
+ _erplf_la_path="";
+
+ for _erplf_la_path in $(find \
+ "${_erplf_dname_base}" \
+ -type f \
+ -name \*.la);
+ do
+ if ! rtl_fileop rm "${_erplf_la_path}"; then
+ return 1;
+ fi;
+ done;
+ return 0;
+};
+
+#
+# ex_rtl_strip_files() - strip files of debugging information
+# @_strip_cmd: strip(1) command name
+# @_tree_root: pathname to tree root
+# @--: (ignored)
+# @_log_fn: logging function name; called with @... and pathname of each file stripped
+# @...: @_fn initial arguments list as positional parameters
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
+ex_rtl_strip_files() {
+ local _ersf_strip_cmd="${1}" _ersf_tree_root="${2}" \
+ _ersf_ignored="${3}" _ersf_log_fn="${4}" \
+ _ersf_bin_path="";
+ shift 4;
+
+ if [ -e "${_ersf_tree_root}" ]; then
+ for _ersf_bin_path in $(find \
+ "${_ersf_tree_root}" \
+ -perm /a=x \
+ -type f);
+ do
+ if objdump \
+ -sj .debug_frame \
+ -j .debug_info \
+ "${_ersf_bin_path}" \
+ >/dev/null 2>&1;
+ then
+ if ! "${_ersf_strip_cmd}" "${_ersf_bin_path}"; then
+ return 1;
+ else
+ "${_ersf_log_fn}" "${@}" "${_ersf_bin_path}";
+ fi;
+ fi;
+ done;
+ fi;
+
+ return 0;
+};
+
+# vim:filetype=sh textwidth=0
diff --git a/subr.ex/ex_rtl_midipix.subr b/subr.ex/ex_rtl_midipix.subr
new file mode 100644
index 00000000..6c321035
--- /dev/null
+++ b/subr.ex/ex_rtl_midipix.subr
@@ -0,0 +1,92 @@
+#
+# 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.
+#
+#
+
+#
+# ex_rtl_install_library_archives() - install library archives and library links (.lib.a) for all libraries (.so) in tree
+# @_dname_base: base directory pathname
+# @_mdso_cmd: mdso command name
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
+ex_rtl_install_library_archives() {
+ local _erila_dname_base="${1}" _erila_mdso_cmd="${2}" \
+ _erila_postfix="" _erila_lib_dst_path="" _erila_lib_name="" \
+ _erila_lib_src_path="" _erila_so_dst_dir="" _erila_so_src_path="";
+
+ for _erila_so_src_path in \
+ $(find "${_erila_dname_base=}" \
+ \( -name "*.so" -or -name "*.so.*" \) \
+ -print);
+ do
+ if [ "$(readlink -f "${_erila_so_src_path}")" != "/dev/null" ]\
+ && rtl_remove_postfix "[0-9.]" "${_erila_so_src_path##*.so}" \$_erila_postfix\
+ && [ "${_erila_postfix:+1}" != 1 ]; then
+
+ case "${_erila_so_src_path}" in
+ *.so) _erila_lib_src_path="${_erila_so_src_path%%.so}.lib.a"; ;;
+ *.so.*) _erila_lib_src_path="${_erila_so_src_path%%.so.*}.${_erila_so_src_path##*.so.}.lib.a"; ;;
+ esac;
+
+ _erila_so_dst_dir="${_erila_so_src_path%/*}";
+ rtl_basename2 \$_erila_lib_src_path \$_erila_lib_name;
+ _erila_lib_dst_path="${_erila_so_dst_dir}/${_erila_lib_name}";
+
+ if [ ! -L "${_erila_lib_src_path}" ]\
+ && [ ! -e "${_erila_lib_dst_path}" ]; then
+ if ! (rtl_basename2 \$_erila_so_src_path \$_erila_fname; \
+ rtl_basename2 \$_erila_lib_dst_path \$_erila_fname_dst; \
+ rtl_dirname2 \$_erila_so_src_path \$_erila_dname; \
+ rtl_fileop cd "${_erila_dname}" && \
+ perk -e "${_erila_fname}" |\
+ "${_erila_mdso_cmd}" \
+ -i "${_erila_fname_dst}" \
+ -n "${_erila_fname}" -);
+ then
+ return 1;
+ fi;
+ fi;
+
+ if ! ex_rtl_install_library_link \
+ "${_erila_lib_name}" "${_erila_so_dst_dir}" \
+ "${_erila_so_src_path}";
+ then
+ return 1;
+ fi;
+ fi;
+ done;
+
+ return 0;
+};
+
+#
+# ex_rtl_install_library_link() - install library archive (.lib.a) link for library (.so)
+# @_lib_name: library name
+# @_so_dir: library directory pathname
+# @_so_path: library file pathname
+#
+# Returns: zero (0) on success, non-zero (>0) on failure
+#
+ex_rtl_install_library_link() {
+ local _erill_lib_name="${1}" _erill_so_dir="${2}" _erill_so_path="${3}" \
+ _erill_lib_link_path="${3%.so*}.lib.a" _erill_fname="" _erill_lib_link_tgt="";
+
+ if _erill_lib_link_tgt="$(find "${_erill_so_dir}" \
+ -name "${_erill_lib_name%%.*}.*.lib.a" |\
+ sort | tail -1)"\
+ && [ "${_erill_lib_link_tgt:+1}" = 1 ]\
+ && [ "${_erill_lib_link_tgt}" != "${_erill_lib_link_path}" ];
+ then
+ rtl_basename2 \$_erill_lib_link_tgt \$_erill_fname;
+
+ if ! rtl_fileop rm "${_erill_lib_link_path}"\
+ || ! rtl_fileop ln_symbolic "${_erill_fname}" "${_erill_lib_link_path}"; then
+ return 1;
+ fi;
+ fi;
+ return 0;
+};
+
+# vim:filetype=sh textwidth=0
diff --git a/subr.ex/ex_rtl_run.subr b/subr.ex/ex_rtl_run.subr
new file mode 100644
index 00000000..558c8486
--- /dev/null
+++ b/subr.ex/ex_rtl_run.subr
@@ -0,0 +1,400 @@
+#
+# 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