From patchwork Thu Feb 21 11:15:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Dawson X-Patchwork-Id: 222260 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id D423C2C0087 for ; Thu, 21 Feb 2013 22:16:06 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 56C8DA0174; Thu, 21 Feb 2013 11:16:06 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id T2upL9cxsxq9; Thu, 21 Feb 2013 11:16:01 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 0A990A0085; Thu, 21 Feb 2013 11:16:01 +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 788BC8F753 for ; Thu, 21 Feb 2013 11:16:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id AA6508CFD7 for ; Thu, 21 Feb 2013 11:15:57 +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 9kFi8ADeFghX for ; Thu, 21 Feb 2013 11:15:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by whitealder.osuosl.org (Postfix) with ESMTPS id CD27A8CFD4 for ; Thu, 21 Feb 2013 11:15:54 +0000 (UTC) Received: by mail-wi0-f172.google.com with SMTP id ez12so7337737wid.11 for ; Thu, 21 Feb 2013 03:15:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:subject:date:message-id:x-mailer; bh=QB6Z4Sxa3ILhMRAhveuuuKxzAjtju6Lgg/iK4TjXPjY=; b=F0gk91uLbbX+hyuaS4Wqx5AkeGH1fKCkV46WPpg24YE0GKwnz2El8ksmj0iKftl0Qg dlB52QEqszh3n0E2+79gPCyOc75looLyxTgpdUKx9eOp12iG/xZ8NpFEsdLuyui3hOWQ Uuj2euKvy9PyjlhAvrqQ49nVtrIKFGnU62Kf/fBsAUFl5aPFuuvsoBIVf7r4L7azVWix xRiXarJqrIciGx8chL7LpTt1waptVK7E1RRkaWMP7G/BNq2vkUuIXc+SzuHdhD7eqGJu M9Ag/Gr5C8uZApDQkjuZjZ1OqH8kwbO414AOKE6+vStoIsk+7sIlXCwoh386xvSJnZ65 WLVQ== X-Received: by 10.180.86.166 with SMTP id q6mr39344285wiz.15.1361445353068; Thu, 21 Feb 2013 03:15:53 -0800 (PST) Received: from localhost.localdomain (host86-128-115-226.range86-128.btcentralplus.com. [86.128.115.226]) by mx.google.com with ESMTPS id bj9sm36288161wib.4.2013.02.21.03.15.50 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 21 Feb 2013 03:15:51 -0800 (PST) From: spdawson@gmail.com To: buildroot@busybox.net Date: Thu, 21 Feb 2013 11:15:48 +0000 Message-Id: <1361445348-7720-1-git-send-email-spdawson@gmail.com> X-Mailer: git-send-email 1.7.10.4 Subject: [Buildroot] [PATCH v4] 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) --- v4: Rebased on top of next branch 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 a2c305f..26f8724 100644 --- a/Config.in +++ b/Config.in @@ -437,6 +437,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 a13ba8f..2894f91 100644 --- a/docs/manual/customize.txt +++ b/docs/manual/customize.txt @@ -14,3 +14,5 @@ include::customize-kernel-config.txt[] include::customize-toolchain.txt[] include::customize-store.txt[] + +include::customize-packages.txt[] diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index 57b0fd0..a5effec 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -76,6 +76,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 @@ -86,18 +102,7 @@ $(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; \ - 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 $@