Blob Blame History Raw
#
# 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.
#

pkg_configure_patch_pre() {
	pkg_configure_patch "${@}" "patches_pre";
};

pkg_configure_patch() {
	local	_pcp_group_name="${1}" _pcp_pkg_name="${2}"		\
		_pcp_restart_at="${3}" _pcp_type="${4:-patches}"	\
		_pcp_patch_cwd="" _pcp_strip_count=0;

	if [ -x "${PKG_BASE_DIR}/${PKG_SUBDIR}/srcprep.sh" ]; then
		return 0;
	fi;

	if [ "${PKG_FNAME:+1}" = 1 ]\
	&& [ "${PKG_URLS_GIT:+1}" = 1 ];
	then
		_pcp_patch_cwd="${PKG_BASE_DIR}";
		_pcp_strip_count=0;
	else
		_pcp_patch_cwd="${PKG_BASE_DIR}/${PKG_SUBDIR}";
		_pcp_strip_count=1;
	fi;

	if ! rtl_patch_files						\
		"${_pcp_patch_cwd}" "${_pcp_strip_count}"		\
		ex_pkg_get_default -- --				\
		"${_pcp_pkg_name}" "${PKG_VERSION:-}" "${_pcp_type}";
	then
		return 1;
	fi;
	return 0;
};

# vim:filetype=sh textwidth=0