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.
#

pkgp_configure_patch_pre() {
	local _ppcpp_patch_fname="" _ppcpp_patch_idx=0;

	_ppcpp_patch_idx=1;
	while ex_pkg_get_default					\
		\$_ppcpp_patch_fname "${PKG_NAME}"			\
		"${PKG_VERSION}" "patches_pre" "${_ppcpp_patch_idx}"	\
	   && [ "${_pcp_patch_fname:+1}" = 1 ];
	do
		: $((_ppcpp_patch_idx += 1));
		if [ -r "${_ppcpp_patch_fname}" ]\
		&& ! patch -b -d "${PKG_BASE_DIR}/${PKG_SUBDIR}" -p1 < "${_ppcpp_patch_fname}";
		then
			return 1;
		fi;
	done;
	return 0;
};

pkgp_configure_patch_pre_chainport() {
	local _ppcppc_patch_dname="" _ppcppc_patch_fname="";

	ex_pkg_get_default				\
		\$_ppcppc_patch_fname "${PKG_NAME}"	\
		"${PKG_VERSION}" "patches_chainport" 1	\
		|| return 1;

	if [ "${_ppcppc_patch_fname:+1}" = 1 ]\
	&& [ -e "${_ppcppc_patch_fname}" ]; then
		_ppcppc_patch_dname="${PKG_BASE_DIR}/${PKG_SUBDIR}/patches/${PKG_NAME%%_*}";
		if ! rtl_fileop mkdir "${_ppcppc_patch_dname}"\
		|| ! rtl_fileop cp "${_ppcppc_patch_fname}" "${_ppcppc_patch_dname}"; then
			return 1;
		fi;
	fi;
	return 0;
};

pkg_configure_patch_pre() {
	local _pcpp_group_name="${1}" _pcpp_pkg_name="${2}" _pcpp_restart_at="${3}";

	if ! pkgp_configure_patch_pre_chainport\
	|| ! pkgp_configure_patch_pre;
	then
		return 1;
	fi;
	return 0;
};

# vim:filetype=sh textwidth=0