as the source directory for a particular package. See the
Buildroot documentation for more details on this feature.
+config BR2_GLOBAL_PATCH_DIR
+ string "global patch directory"
+ help
+ You may specify a directory containing global package patches.
+ For a specific version <packageversion> of a specific package
+ <packagename>, patches are applied as follows.
+
+ First, the default Buildroot patch set for the package is applied.
+
+ If the directory $(BR2_GLOBAL_PATCH_DIR)/<packagename>/<packageversion>
+ exists, then all *.patch files in the directory will be applied.
+
+ Otherwise, if the directory $(BR2_GLOBAL_PATCH_DIR)/<packagename> exists,
+ then all *.patch files in the directory will be applied.
+
endmenu
source "toolchain/Config.in"
--- /dev/null
+// -*- mode:doc -*- ;
+
+[[packages-custom]]
+Customizing packages
+~~~~~~~~~~~~~~~~~~~~
+
+It is sometimes useful to apply 'extra' patches to packages - over and
+above those provided in Buildroot. This might be used to support custom
+features in a project, for example, or when working on a new architecture.
+
+The +BR2_GLOBAL_PATCH_DIR+ configuration file option can be
+used to specify a directory containing global package patches.
+
+For a specific version <packageversion> of a specific package <packagename>,
+patches are applied as follows.
+
+First, the default Buildroot patch set for the package is applied.
+
+If the directory +$(BR2_GLOBAL_PATCH_DIR)/<packagename>/<packageversion>+
+exists, then all +*.patch+ files in the directory will be applied.
+
+Otherwise, if the directory +$(BR2_GLOBAL_PATCH_DIR)/<packagename>+
+exists, then all +*.patch+ files in the directory will be applied.
include::customize-toolchain.txt[]
include::customize-store.txt[]
+
+include::customize-packages.txt[]
Buildroot.
Buildroot offers an infrastructure to automatically handle this during
-the builds. It supports two ways of applying patch sets: downloaded patches
-and patches supplied within buildroot.
+the builds. It supports three ways of applying patch sets: downloaded patches,
+patches supplied within buildroot and patches located in a user-defined
+global patch directory.
Providing patches
~~~~~~~~~~~~~~~~~
reference in their filename.
- The field +<number>+ in the patch file name refers to the 'apply order'.
+Global patch directory
+^^^^^^^^^^^^^^^^^^^^^^
+
+The +BR2_GLOBAL_PATCH_DIR+ configuration file option can be
+used to specify a directory containing global package patches. See
+xref:packages-custom[] for details.
+
How patches are applied
~~~~~~~~~~~~~~~~~~~~~~~
tarballs are applied;
. If there are some +*.patch+ files in the package directory or in the
- a package subdirectory named +<packagename>-<packageversion>+, then:
+ a package subdirectory named +<packageversion>+, then:
+
* If a +series+ file exists in the package directory, then patches are
applied according to the +series+ file;
# find the package directory (typically package/<pkgname>) 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 $@