summaryrefslogtreecommitdiffhomepage
path: root/subr/pkg_patch.subr
blob: eba8f6f223164613f4eb5f1f6475ed797ab805e5 (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
#
# set -o errexit -o noglob are assumed.
#

pkg_patch() {
	local _patch_fname _patches_done;
	set +o noglob;
	for _patch_fname in 										\
			${WORKDIR}/chainport/${PKG_NAME}.midipix.patch					\
			${WORKDIR}/chainport/${PKG_SUBDIR}.midipix.patch				\
			${WORKDIR}/chainport/${PKG_SUBDIR%-*}.midipix.patch				\
			${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}/*.patch				\
			${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}/*.patch				\
			${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR%-*}/*.patch				\
			${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}.local.patch				\
			${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}.local.patch				\
			${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR%-*}.local.patch			\
			${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}.local@${BUILD_HNAME}.patch		\
			${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR}.local@${BUILD_HNAME}.patch		\
			${MIDIPIX_BUILD_PWD}/patches/${PKG_SUBDIR%-*}.local@${BUILD_HNAME}.patch; do
		if ! lmatch "${_patches_done}" " " "${_patch_fname}"\
		&& [ -r "${_patch_fname}" ]; then
			patch -b -d "${WORKDIR}/${PKG_SUBDIR}" -p1 < "${_patch_fname}";
			_patches_done="${_patches_done:+${_patches_done} }${_patch_fname}";
		fi;
	done;
	set -o noglob;
};

# vim:filetype=sh