From 5538e4766201aa0c1c23721cfc99cbbde595964b Mon Sep 17 00:00:00 2001 From: Simon Dawson Date: Sun, 17 Mar 2013 23:13:47 +0000 Subject: rework patch model At the Buildroot Developers Meeting (4-5 February 2013, in Brussels) a change to the patch logic was discussed. See http://elinux.org/Buildroot:DeveloperDaysFOSDEM2013 for details. In summary: * For patches stored in the package directory, if package/// does exist, apply package///*.patch, otherwise, apply package//*.patch * For patches stored in the global patches directory, if $(GLOBAL_PATCH_DIR)/// does exist, apply $(GLOBAL_PATCH_DIR)///*.patch, otherwise, apply $(GLOBAL_PATCH_DIR)//*.patch This patch adds the new BR2_GLOBAL_PATCH_DIR configuration item, and reworks the generic package infrastructure to implement the new patch logic. [Peter: fixup doc nits as pointed out by Thomas] Signed-off-by: Simon Dawson Acked-by: Thomas Petazzoni Tested-by: Thomas Petazzoni Acked-by: Samuel Martin Signed-off-by: Peter Korsgaard --- package/pkg-generic.mk | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'package/pkg-generic.mk') diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index 8d964a18c..afb90bf79 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -82,21 +82,21 @@ endif # find the package directory (typically package/) and the # prefix of the patches $(BUILD_DIR)/%/.stamp_patched: NAMEVER = $(RAWNAME)-$($(PKG)_VERSION) +$(BUILD_DIR)/%/.stamp_patched: PATCH_BASE_DIRS = $($(PKG)_DIR_PREFIX)/$(RAWNAME) $(call qstrip,$(BR2_GLOBAL_PATCH_DIR))/$(RAWNAME) $(BUILD_DIR)/%/.stamp_patched: @$(call MESSAGE,"Patching $($(PKG)_DIR_PREFIX)/$(RAWNAME)") $(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep)) $(foreach p,$($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $(p)$(sep)) $(Q)( \ - if test -d $($(PKG)_DIR_PREFIX)/$(RAWNAME); then \ - if test "$(wildcard $($(PKG)_DIR_PREFIX)/$(RAWNAME)/$(NAMEVER)*.patch*)"; then \ - support/scripts/apply-patches.sh $(@D) $($(PKG)_DIR_PREFIX)/$(RAWNAME) $(NAMEVER)\*.patch $(NAMEVER)\*.patch.$(ARCH) || exit 1; \ - else \ - support/scripts/apply-patches.sh $(@D) $($(PKG)_DIR_PREFIX)/$(RAWNAME) $(RAWNAME)\*.patch $(RAWNAME)\*.patch.$(ARCH) || exit 1; \ - if test -d $($(PKG)_DIR_PREFIX)/$(RAWNAME)/$(NAMEVER); then \ - support/scripts/apply-patches.sh $(@D) $($(PKG)_DIR_PREFIX)/$(RAWNAME)/$(NAMEVER) \*.patch \*.patch.$(ARCH) || exit 1; \ + for D in $(PATCH_BASE_DIRS); do \ + if test -d $${D}; then \ + if test -d $${D}/$($(PKG)_VERSION); then \ + support/scripts/apply-patches.sh $(@D) $${D}/$($(PKG)_VERSION) \*.patch \*.patch.$(ARCH) || exit 1; \ + else \ + support/scripts/apply-patches.sh $(@D) $${D} \*.patch \*.patch.$(ARCH) || exit 1; \ fi; \ fi; \ - fi; \ + done; \ ) $(foreach hook,$($(PKG)_POST_PATCH_HOOKS),$(call $(hook))$(sep)) $(Q)touch $@ -- cgit v1.2.3