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