All of lore.kernel.org
 help / color / mirror / Atom feed
From: Angelo Compagnucci <angelo@amarulasolutions.com>
To: buildroot@buildroot.org
Cc: Angelo Compagnucci <angelo@amarulasolutions.com>
Subject: [Buildroot] [PATCH v2 2/5] package/pkg-utils: add KCONFIG_APPEND_OPT
Date: Fri, 14 Oct 2022 08:58:57 +0200	[thread overview]
Message-ID: <20221014065900.3311604-3-angelo@amarulasolutions.com> (raw)
In-Reply-To: <20221014065900.3311604-1-angelo@amarulasolutions.com>

This macro can be used to append a value to a previously configured
option where the intent is to join the old value with the new one.

Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
---
 package/pkg-utils.mk | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
index 0945e6ed31..d812946934 100644
--- a/package/pkg-utils.mk
+++ b/package/pkg-utils.mk
@@ -33,6 +33,16 @@ define KCONFIG_ENABLE_OPT
 		$(call KCONFIG_MUNGE_DOT_CONFIG, $(1), $(1)=y, $(2)); \
 	fi
 endef
+# KCONFIG_APPEND_OPT (option, value, [, file])
+# If the option is already set append, else add new.
+define KCONFIG_APPEND_OPT
+	$(Q)if ! grep -q '^$(strip $(1))' $(call KCONFIG_DOT_CONFIG,$(3)); then \
+		$(call KCONFIG_MUNGE_DOT_CONFIG, $(1), $(1)=$(2), $(3)); \
+	else \
+		grep -E '$(strip $(1)).*$(strip $(2))' $(call KCONFIG_DOT_CONFIG,$(3)) || \
+		$(SED) 's|$(1)="\(.*\)"|$(1)="\1 $(2)"|g' $(call KCONFIG_DOT_CONFIG,$(3)); \
+	fi
+endef
 # KCONFIG_SET_OPT (option, value [, file])
 KCONFIG_SET_OPT     = $(call KCONFIG_MUNGE_DOT_CONFIG, $(1), $(1)=$(2), $(3))
 # KCONFIG_DISABLE_OPT  (option [, file])
-- 
2.25.1

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

  parent reply	other threads:[~2022-10-14  6:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14  6:58 [Buildroot] [PATCH v2 0/5] Lichee RV and Lichee RV dock support Angelo Compagnucci
2022-10-14  6:58 ` [Buildroot] [PATCH v2 1/5] linux: enable CONFIG_EXTRA_FIRMWARE_DIR Angelo Compagnucci
2022-10-30 20:43   ` Thomas Petazzoni via buildroot
2022-10-30 20:52     ` Angelo Compagnucci
2022-10-30 21:23   ` Yann E. MORIN
2022-10-14  6:58 ` Angelo Compagnucci [this message]
2022-10-14  6:58 ` [Buildroot] [PATCH v2 3/5] ackage/rtl8723ds-bt: new package Angelo Compagnucci
2022-10-30 20:48   ` Thomas Petazzoni via buildroot
2022-10-30 20:55     ` Angelo Compagnucci
2022-10-30 21:21       ` Yann E. MORIN
2022-10-14  6:58 ` [Buildroot] [PATCH v2 4/5] configs/lichee_rv: new defconfig Angelo Compagnucci
2022-10-14  6:59 ` [Buildroot] [PATCH v2 5/5] configs/lichee_rv_dock: " Angelo Compagnucci

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=20221014065900.3311604-3-angelo@amarulasolutions.com \
    --to=angelo@amarulasolutions.com \
    --cc=buildroot@buildroot.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.