Blame subr.pkg/pkg_configure_patch.subr

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_configure_patch() {
e9fa07
	local	_pcp_group_name="${1}" _pcp_pkg_name="${2}" _pcp_restart_at="${3}"	\
e9fa07
		_pcp_patch_cwd="" _pcp_patch_dir="${MIDIPIX_BUILD_PWD}/patches"		\
fd38dc
		_pcp_patch_fname="" _pcp_patch_idx=0 _pcp_patches_done=""		\
fd38dc
		_pcp_pkg_name_full="" _pcp_strip_count=0;
e9fa07
	_pcp_pkg_name_full="${_pcp_pkg_name}${PKG_VERSION:+-${PKG_VERSION}}";
e9fa07
e9fa07
	if [ "${PKG_FNAME:+1}" = 1 ]\
e9fa07
	&& [ "${PKG_URLS_GIT:+1}" = 1 ];
e9fa07
	then
e9fa07
		_pcp_patch_cwd="${PKG_BASE_DIR}";
e9fa07
		_pcp_strip_count=0;
e9fa07
	else
e9fa07
		_pcp_patch_cwd="${PKG_BASE_DIR}/${PKG_SUBDIR}";
e9fa07
		_pcp_strip_count=1;
e9fa07
	fi;
e9fa07
fd38dc
	_pcp_patch_idx=1;
fd38dc
	while ex_pkg_get_default				\
fd38dc
		\$_pcp_patch_fname "${_pcp_pkg_name}"		\
fd38dc
		"${PKG_VERSION}" "patches" "${_pcp_patch_idx}"	\
fd38dc
	   && [ "${_pcp_patch_fname:+1}" = 1 ];
e9fa07
	do
fd38dc
		: $((_pcp_patch_idx += 1));
e9fa07
		if [ -r "${_pcp_patch_fname}" ]\
e9fa07
		&& ! rtl_lmatch \$_pcp_patches_done "${_pcp_patch_fname}";
e9fa07
		then
e9fa07
			if ! patch -b -d "${_pcp_patch_cwd}" "-p${_pcp_strip_count}" < "${_pcp_patch_fname}"; then
fd38dc
				return 1;
e9fa07
			else
e9fa07
				rtl_lconcat \$_pcp_patches_done "${_pcp_patch_fname}";
e9fa07
			fi;
e9fa07
		fi;
e9fa07
	done;
e9fa07
e9fa07
	return 0;
e9fa07
};
e9fa07
64844b
# vim:filetype=sh textwidth=0