Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Mayer via buildroot <buildroot@buildroot.org>
To: Buildroot Mailing List <buildroot@buildroot.org>
Cc: Markus Mayer <mmayer@broadcom.com>
Subject: [Buildroot] [PATCH] support/scripts/apply-patches.sh: introduce envvar BR_PATCH_ARGS
Date: Mon, 27 Jan 2025 13:53:54 -0800	[thread overview]
Message-ID: <20250127215356.3175741-1-mmayer@broadcom.com> (raw)

Introduce the environment variable BR_PATCH_ARGS as a means for the
caller to pass additional arguments to the patch(1) command. These
arguments can be new arguments not originally used -- or they can
override one of the default arguments.

In addition, provide a mechanism to add patch parameters on a
per-package basis using the <PACKAGENAME>_PATCH_ARGS makefile variable,
for example "PROCPS_NG_PATCH_ARGS". This allows individual packages to
specify extra arguments or override defaults while not affecting any
other part of the build environment.

Signed-off-by: Markus Mayer <mmayer@broadcom.com>
---
 package/Makefile.in              | 4 +++-
 support/scripts/apply-patches.sh | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/package/Makefile.in b/package/Makefile.in
index 829636900ba9..9df66670c8d3 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -256,7 +256,9 @@ endif
 INSTALL := $(shell which install || type -p install)
 UNZIP := $(shell which unzip || type -p unzip) -q
 
-APPLY_PATCHES = TAR="$(TAR)" PATH=$(HOST_DIR)/bin:$$PATH support/scripts/apply-patches.sh $(if $(QUIET),-s)
+APPLY_PATCHES = TAR="$(TAR)" PATH=$(HOST_DIR)/bin:$$PATH \
+	BR_PATCH_ARGS=$($(PKG)_PATCH_ARGS) \
+	support/scripts/apply-patches.sh $(if $(QUIET),-s)
 
 HOST_CPPFLAGS  = -I$(HOST_DIR)/include
 HOST_CFLAGS   ?= -O2
diff --git a/support/scripts/apply-patches.sh b/support/scripts/apply-patches.sh
index 2acaa63e9fd3..26e7a4a37bb1 100755
--- a/support/scripts/apply-patches.sh
+++ b/support/scripts/apply-patches.sh
@@ -116,7 +116,8 @@ function apply_patch {
         exit 1
     fi
     echo "${path}/${patch}" >> ${builddir}/.applied_patches_list
-    ${uncomp} "${path}/$patch" | patch -F0 -g0 -p1 --no-backup-if-mismatch -d "${builddir}" -t -N $silent
+    ${uncomp} "${path}/$patch" | patch -F0 -g0 -p1 --no-backup-if-mismatch \
+		-d "${builddir}" -t -N $silent $BR_PATCH_ARGS
     if [ $? != 0 ] ; then
         echo "Patch failed!  Please fix ${patch}!"
         exit 1
-- 
2.48.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

             reply	other threads:[~2025-01-27 21:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-27 21:53 Markus Mayer via buildroot [this message]
2025-01-28 21:09 ` [Buildroot] [PATCH] support/scripts/apply-patches.sh: introduce envvar BR_PATCH_ARGS Thomas Petazzoni via buildroot
2025-02-05 16:58   ` Markus Mayer via buildroot
2025-02-05 19:28     ` Arnout Vandecappelle via buildroot
2025-02-05 22:08       ` Markus Mayer via buildroot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250127215356.3175741-1-mmayer@broadcom.com \
    --to=buildroot@buildroot.org \
    --cc=mmayer@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox