Lucio Andrés Illanes Albornoz (arab, vxp) 570129
#
8d7a8a
# Copyright (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 LucĂ­a Andrea Illanes Albornoz <lucia@luciaillanes.de>
Lucio Andrés Illanes Albornoz e1d469
# set +o errexit -o noglob -o nounset is assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
#
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
pkg_configure_autotools() {
e9fa07
	local	_pca_group_name="${1}" _pca_pkg_name="${2}" _pca_restart_at="${3}"	\
e9fa07
		_pca_config_cache="" _pca_config_guest_fname="" _pca_fname=""		\
e9fa07
		_pca_subdir_tgt="";
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz b9a715
	if [ "${PKG_CONFIGURE_TYPE:+1}" = 1 ]\
Lucio Andrés Illanes Albornoz b9a715
	&& [ "${PKG_CONFIGURE_TYPE}" != "autotools" ]; then
Lucio Andrés Illanes Albornoz b9a715
		return 0;
Lucio Andrés Illanes Albornoz b9a715
	fi;
Lucio Andrés Illanes Albornoz b9a715
Lucio Andrés Illanes Albornoz 4d6e26
	if [ "${PKG_AUTOCONF_CONFIG_GUESS:-midipix}" = "midipix" ]; then
e9fa07
		_pca_config_guest_fname="config.guess";
Lucio Andrés Illanes Albornoz 4d6e26
	else
e9fa07
		_pca_config_guest_fname="";
Lucio Andrés Illanes Albornoz 4d6e26
	fi;
Lucio Andrés Illanes Albornoz 4d6e26
e9fa07
	if rtl_exists_any "${PKG_BASE_DIR}/${PKG_SUBDIR}"				\
e9fa07
			${_pca_config_guest_fname:+"${_pca_config_guest_fname}"}	\
Lucio Andrés Illanes Albornoz 4d6e26
			"configure.ac" "configure.in" "configure";
e9fa07
	then
e9fa07
		rtl_export_vars PKG_CONFIG "${PKG_PKG_CONFIG:-}" PKG_CONFIG_LIBDIR "${PKG_PKG_CONFIG_LIBDIR:-}";
e9fa07
Lucio Andrés Illanes Albornoz bf9edf
		if [ "${PKG_FORCE_AUTORECONF:-0}" -eq 1 ]\
Lucio Andrés Illanes Albornoz bf9edf
		&& ! (cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && autoreconf -fiv); then
Lucio Andrés Illanes Albornoz bf9edf
			return 1;
Lucio Andrés Illanes Albornoz bf9edf
		fi;
e9fa07
Lucio Andrés Illanes Albornoz (arab, vxp) d01c02
		if [ -e "${PKG_BASE_DIR}/${PKG_SUBDIR}/configure.ac" ]\
Lucio Andrés Illanes Albornoz (arab, vxp) d01c02
		&& [ ! -e "${PKG_BASE_DIR}/${PKG_SUBDIR}/configure" ]; then
e9fa07
			for _pca_fname in bootstrap bootstrap.sh autogen.sh; do
e9fa07
				if [ -e "${PKG_BASE_DIR}/${PKG_SUBDIR}/${_pca_fname}" ]; then
e9fa07
					for _pca_subdir_tgt in \
Lucio Andrés Illanes Albornoz 2b85d0
							"${PKG_BASE_DIR}/${PKG_SUBDIR}/build-aux"		\
Lucio Andrés Illanes Albornoz 2b85d0
							"${PKG_BASE_DIR}/${PKG_SUBDIR}";
e9fa07
					do	if [ -e "${_pca_subdir_tgt}" ]; then
Lucio Andrés Illanes Albornoz bf9edf
							if ! rtl_fileop install -m 0700				\
Lucio Andrés Illanes Albornoz bf9edf
									"${MIDIPIX_BUILD_PWD}/etc/config.sub"	\
e9fa07
									"${_pca_subdir_tgt}/config.sub"; then
Lucio Andrés Illanes Albornoz bf9edf
								return 1;
Lucio Andrés Illanes Albornoz 4d6e26
							fi;
e9fa07
Lucio Andrés Illanes Albornoz 4d6e26
							if [ "${PKG_AUTOCONF_CONFIG_GUESS:-midipix}" = "midipix" ]; then
Lucio Andrés Illanes Albornoz 4d6e26
								if ! rtl_fileop install -m 0700			\
Lucio Andrés Illanes Albornoz 4d6e26
										"${MIDIPIX_BUILD_PWD}/etc/config.guess"\
e9fa07
										"${_pca_subdir_tgt}/config.guess"; then
Lucio Andrés Illanes Albornoz 4d6e26
									return 1;
Lucio Andrés Illanes Albornoz 4d6e26
								else
Lucio Andrés Illanes Albornoz 4d6e26
									break;
Lucio Andrés Illanes Albornoz 4d6e26
								fi;
Lucio Andrés Illanes Albornoz bf9edf
							fi;
Lucio Andrés Illanes Albornoz (arab, vxp) b19456
						fi;
Lucio Andrés Illanes Albornoz (arab, vxp) b19456
					done;
e9fa07
Lucio Andrés Illanes Albornoz bf9edf
					if ! (rtl_fileop cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" &&			\
e9fa07
							/bin/sh "${_pca_fname}"); then
Lucio Andrés Illanes Albornoz bf9edf
						return 1;
Lucio Andrés Illanes Albornoz bf9edf
					else
Lucio Andrés Illanes Albornoz bf9edf
						break;
Lucio Andrés Illanes Albornoz bf9edf
					fi;
Lucio Andrés Illanes Albornoz (arab, vxp) b19456
				fi;
Lucio Andrés Illanes Albornoz (arab, vxp) b19456
			done;
e9fa07
Lucio Andrés Illanes Albornoz bf9edf
			if ! (rtl_fileop cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && autoconf); then
Lucio Andrés Illanes Albornoz bf9edf
				return 1;
Lucio Andrés Illanes Albornoz bf9edf
			fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		fi;
e9fa07
e9fa07
		for _pca_fname in $(find "${PKG_BASE_DIR}/${PKG_SUBDIR}" -name config.sub); do
e9fa07
			if ! rtl_fileop mv "${_pca_fname}" "${_pca_fname}.orig"\
e9fa07
			|| ! rtl_fileop install -m 0700 "${MIDIPIX_BUILD_PWD}/etc/config.sub" "${_pca_fname}"; then
Lucio Andrés Illanes Albornoz 2b85d0
				return 1;
Lucio Andrés Illanes Albornoz 2b85d0
			fi;
Lucio Andrés Illanes Albornoz 4d6e26
		done;
e9fa07
Lucio Andrés Illanes Albornoz 4d6e26
		if [ "${PKG_AUTOCONF_CONFIG_GUESS:-midipix}" = "midipix" ]; then
e9fa07
			for _pca_fname in $(find "${PKG_BASE_DIR}/${PKG_SUBDIR}" -name config.guess); do
e9fa07
				if ! rtl_fileop mv "${_pca_fname}" "${_pca_fname}.orig"\
e9fa07
				|| ! rtl_fileop install -m 0700 "${MIDIPIX_BUILD_PWD}/etc/config.guess" "${_pca_fname}"; then
Lucio Andrés Illanes Albornoz 4d6e26
					return 1;
Lucio Andrés Illanes Albornoz 4d6e26
				fi;
Lucio Andrés Illanes Albornoz 4d6e26
			done;
Lucio Andrés Illanes Albornoz 4d6e26
		fi;
e9fa07
Lucio Andrés Illanes Albornoz (arab, vxp) a2f293
		if [ "${PKG_BUILD_TYPE}" != host ]; then
Lucio Andrés Illanes Albornoz c6d6e0
			if ! rtl_fileop touch "${PKG_BUILD_DIR}/config.cache"; then
Lucio Andrés Illanes Albornoz 2b85d0
				return 1;
e9fa07
			else
e9fa07
				for _pca_config_cache in \
Lucio Andrés Illanes Albornoz e1d469
						"${PKG_CONFIG_CACHE:-}"						\
Lucio Andrés Illanes Albornoz e1d469
						"${PKG_CONFIG_CACHE_LOCAL:-}"					\
Lucio Andrés Illanes Albornoz e1d469
						"${PKG_CONFIG_CACHE_EXTRA:-}";
e9fa07
				do	if [ "${_pca_config_cache:+1}" = 1 ]\
e9fa07
					&& ! printf "%s\n" "${_pca_config_cache}"					|\
Lucio Andrés Illanes Albornoz bf9edf
							tr " " "\n" >> "${PKG_BUILD_DIR}/config.cache"; then
Lucio Andrés Illanes Albornoz bf9edf
						return 1;
Lucio Andrés Illanes Albornoz bf9edf
					fi;
Lucio Andrés Illanes Albornoz 2b85d0
				done;
e9fa07
Lucio Andrés Illanes Albornoz bf9edf
				if ! sed -i"" "s,%PREFIX%,${PKG_PREFIX},g" "${PKG_BUILD_DIR}/config.cache"; then
Lucio Andrés Illanes Albornoz bf9edf
					return 1;
Lucio Andrés Illanes Albornoz bf9edf
				fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 8a4338
			fi;
Lucio Andrés Illanes Albornoz (arab, vxp) a2f293
		fi;
Lucio Andrés Illanes Albornoz 703f24
		rtl_export_vars -u PKG_CONFIG "${PKG_PKG_CONFIG:-}" PKG_CONFIG_LIBDIR "${PKG_PKG_CONFIG_LIBDIR:-}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
e9fa07
e9fa07
	return 0;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
64844b
# vim:filetype=sh textwidth=0