From patchwork Thu Dec 6 12:46:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Dawson X-Patchwork-Id: 204216 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id 9E3242C0317 for ; Thu, 6 Dec 2012 23:47:45 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id B59B1101AC2; Thu, 6 Dec 2012 12:47:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yIxgSiPMNBnC; Thu, 6 Dec 2012 12:47:32 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 91A26101A47; Thu, 6 Dec 2012 12:47:32 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 6AC5F8F74A for ; Thu, 6 Dec 2012 12:47:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 28EE88BCD1 for ; Thu, 6 Dec 2012 12:47:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id frJ8CYZerEMU for ; Thu, 6 Dec 2012 12:47:37 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-we0-f171.google.com (mail-we0-f171.google.com [74.125.82.171]) by whitealder.osuosl.org (Postfix) with ESMTPS id C94378BCE8 for ; Thu, 6 Dec 2012 12:47:36 +0000 (UTC) Received: by mail-we0-f171.google.com with SMTP id u3so3142114wey.16 for ; Thu, 06 Dec 2012 04:47:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:x-mailer; bh=d3l0x7QDU5Bp2V8a5/h7hh10oC9XMQ/+ASEiVPBQNK0=; b=UL4TClrJsI6EK9FmSj/tdgNR3X95Z//3D/SVrAsdj2XQgZ33n5NRhho1CpKGZbYS+j hhcbqWxT7fX3uPr1Ny/X6h7TSxC+Nz6aY5JMcHa8JM4H1ydpIoE/QW6B6LB9cONgOB1z 8r3PzIwQdBYfmztuiJvN8hZg0G1cp/hpBxNUAdCiQmosXKA039XaMHojQLIQLzqGo/nG YN/Lbfw/dmew5fhcMZ1VGKvCGh6MqoUDPTXXYoKAe5aifHSgGTGtCDFICf3IQaxeFf0J sBpqnVHbkXbOBjcGZXWXlHkQWkQ/Clk2fwgPc8YEgJWmcFldGRuID3VihjVEGE2p86yi dJFQ== Received: by 10.180.92.132 with SMTP id cm4mr8878676wib.12.1354798055148; Thu, 06 Dec 2012 04:47:35 -0800 (PST) Received: from localhost.localdomain (host-84-13-96-11.opaltelecom.net. [84.13.96.11]) by mx.google.com with ESMTPS id hv4sm22993189wib.0.2012.12.06.04.47.33 (version=SSLv3 cipher=OTHER); Thu, 06 Dec 2012 04:47:34 -0800 (PST) From: spdawson@gmail.com To: buildroot@busybox.net Date: Thu, 6 Dec 2012 12:46:29 +0000 Message-Id: <1354797989-5888-1-git-send-email-spdawson@gmail.com> X-Mailer: git-send-email 1.7.10.4 Subject: [Buildroot] [PATCH v3] Add support for custom package patches X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net From: Simon Dawson Add a configuration item to allow a space-separated list of directories to be specified, from which custom package patches will be applied. Signed-off-by: Simon Dawson Acked-by: Arnout Vandecappelle (Essensium/Mind) --- v3: Add documentation, as suggested by Samuel Martin. Incorporate further improvements suggested by Arnout Vandecappelle v2: Incorporate improvements suggested by Arnout Vandecappelle, and fix handling of the case where the new configuration item is not set Config.in | 7 +++++++ docs/manual/customize-packages.txt | 15 +++++++++++++++ docs/manual/customize.txt | 2 ++ package/pkg-generic.mk | 29 +++++++++++++++++------------ 4 files changed, 41 insertions(+), 12 deletions(-) create mode 100644 docs/manual/customize-packages.txt diff --git a/Config.in b/Config.in index b319ac7..25910e5 100644 --- a/Config.in +++ b/Config.in @@ -419,6 +419,13 @@ config BR2_PACKAGE_OVERRIDE_FILE as the source directory for a particular package. See the Buildroot documentation for more details on this feature. +config BR2_EXTRA_PACKAGE_PATCH_DIRS + string "extra package patch directories" + help + You may specify a space-separated list of directories containing + extra package patches. Note that any extra patches for a package + will be applied AFTER the Buildroot patch set for the package. + endmenu source "toolchain/Config.in" diff --git a/docs/manual/customize-packages.txt b/docs/manual/customize-packages.txt new file mode 100644 index 0000000..4dea34a --- /dev/null +++ b/docs/manual/customize-packages.txt @@ -0,0 +1,15 @@ +// -*- 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_EXTRA_PACKAGE_PATCH_DIRS+ configuration file option can be +used to specify a set of extra package patch directories. The option +should be set to a space-separated list of directories containing the +extra package patches. Note that any extra patches for a package +will be applied *after* the Buildroot patch set for the package. diff --git a/docs/manual/customize.txt b/docs/manual/customize.txt index 1e6f4e8..a2705e5 100644 --- a/docs/manual/customize.txt +++ b/docs/manual/customize.txt @@ -12,3 +12,5 @@ include::customize-uclibc-config.txt[] include::customize-kernel-config.txt[] include::customize-toolchain.txt[] + +include::customize-packages.txt[] diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index fc05dc6..31493b9 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -69,6 +69,22 @@ else @true # Nothing to do to source a local package endif +# Apply package patches from the specified directory +define pkg-apply-patch-directory + if test -d $(1); then \ + if test "$(wildcard $(1)/$(NAMEVER)*.patch*)"; then \ + support/scripts/apply-patches.sh $(@D) $(1) $(NAMEVER)\*.patch $(NAMEVER)\*.patch.$(ARCH) || exit 1; \ + else \ + support/scripts/apply-patches.sh $(@D) $(1) $(RAWNAME)\*.patch $(RAWNAME)\*.patch.$(ARCH) || exit 1; \ + if test -d $(1)/$(NAMEVER); then \ + support/scripts/apply-patches.sh $(@D) $(1)/$(NAMEVER) \*.patch \*.patch.$(ARCH) || exit 1; \ + fi; \ + fi; \ + fi; +endef + +PACKAGE_PATCH_DIRS = $($(PKG)_DIR_PREFIX)/$(RAWNAME) $(call qstrip,$(BR2_EXTRA_PACKAGE_PATCH_DIRS)) + # Patch # # The RAWNAME variable is the lowercased package name, which allows to @@ -79,18 +95,7 @@ $(BUILD_DIR)/%/.stamp_patched: @$(call MESSAGE,"Patching $($(PKG)_DIR_PREFIX)/$(RAWNAME)") $(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep)) $(if $($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $($(PKG)_PATCH)) - $(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; \ - fi; \ - fi; \ - fi; \ - ) + $(Q)$(foreach patchdir,$(PACKAGE_PATCH_DIRS),$(call pkg-apply-patch-directory,$(patchdir))) $(foreach hook,$($(PKG)_POST_PATCH_HOOKS),$(call $(hook))$(sep)) $(Q)touch $@