e9fa07
#
8d7a8a
# Copyright (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 LucĂ­a Andrea Illanes Albornoz <lucia@luciaillanes.de>
e9fa07
# set +o errexit -o noglob -o nounset is assumed.
e9fa07
#
e9fa07
e9fa07
pkg_build_clean() {
e9fa07
	local	_pbc_group_name="${1}" _pbc_pkg_name="${2}" _pbc_restart_at="${3}"	\
e9fa07
		_pbc_libtool="" _pbc_makeflags_verbosity="${PKG_MAKEFLAGS_VERBOSITY:-}"	\
e9fa07
		_pbc_no_autoconf="" _pbc_rc=0 _pbc_subdir="";
e9fa07
e9fa07
	if ex_pkg_state_test "${PKG_NAME}" "build" "${_pbc_restart_at}"; then
e9fa07
		case "${PKG_LIBTOOL:-}" in
e9fa07
		"")	_pbc_libtool=""; ;;
e9fa07
		none)	_pbc_libtool=""; ;;
e9fa07
		*)	_pbc_libtool="${PKG_LIBTOOL}"; ;;
e9fa07
		esac;
e9fa07
		[ ! -x "${PKG_CONFIGURE:-}" ] && _pbc_no_autoconf=1;
e9fa07
e9fa07
		for _pbc_subdir in ${PKG_MAKE_SUBDIRS:-:}; do
e9fa07
			[ "${_pbc_subdir}" = ":" ] && _pbc_subdir="";
e9fa07
			[ "${#_pbc_libtool}" -gt 0 ] && export MAKE="make LIBTOOL=${_pbc_libtool}";
e9fa07
e9fa07
			rtl_run_cmd_unsplit "${PKG_MAKE}"			\
e9fa07
				${PKG_MAKEFLAGS_BUILD:-}			\
e9fa07
				${PKG_MAKEFLAGS_BUILD_EXTRA:-}			\
e9fa07
				${_pbc_libtool:+"LIBTOOL=${_pbc_libtool}"}	\
e9fa07
				${_pbc_makeflags_verbosity}			\
e9fa07
				${_pbc_subdir:+-C "${_pbc_subdir}"}		\
e9fa07
				clean; _pbc_rc="${?}";
e9fa07
e9fa07
			[ "${#_pbc_libtool}" -gt 0 ] && unset MAKE;
e9fa07
			[ "${_pbc_rc}" -ne 0 ] && return 1;
e9fa07
		done;
e9fa07
	fi;
e9fa07
	return 0;
e9fa07
};
e9fa07
64844b
# vim:filetype=sh textwidth=0