summaryrefslogtreecommitdiffhomepage
path: root/subr.pkg/pkg_configure_patch_pre.subr
blob: a1ae73b6e75936759ca62043628674cc220305bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#
# 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_path="";

	for _ppcpp_patch_path in 											\
			"${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}${PKG_VERSION:+-${PKG_VERSION}}_pre.local.patch"	\
			"${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}${PKG_VERSION:+-${PKG_VERSION}}_pre.local@${BUILD_HNAME}.patch";
	do
		if [ -r "${_ppcpp_patch_path}" ]\
		&& ! patch -b -d "${PKG_BASE_DIR}/${PKG_SUBDIR}" -p1 < "${_ppcpp_patch_path}";
		then
			return 1;
		fi;
	done;
	return 0;
};

pkgp_configure_patch_pre_chainport() {
	local _ppcppc_patch_dname="" _ppcppc_patch_fname="" _ppcppc_oldpwd="";
	_ppcppc_patch_dname="${PKG_BASE_DIR}/${PKG_SUBDIR}/patches/${PKG_NAME%%_ppcppc_*}";

	if [ "${PKG_VERSION:+1}" = 1 ]; then
		_ppcppc_patch_fname="${BUILD_WORKDIR}/chainport/patches/${PKG_NAME%%_ppcppc_*}/${PKG_NAME%%_ppcppc_*}-${PKG_VERSION}.midipix.patch";
	fi;
	if [ -e "${_ppcppc_patch_fname}" ]; then
		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