public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Mart Raudsepp <leio@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] [PATCH] meson.eclass: add meson_feature function
Date: Mon, 04 Mar 2019 10:38:02 +0200	[thread overview]
Message-ID: <eb8804d330240cfa8ed05d61d393302008da816c.camel@gentoo.org> (raw)

This can be used to simplify controlling meson_options.txt entries
of type 'feature'.

Signed-off-by: Mart Raudsepp <leio@gentoo.org>
---
 eclass/meson.eclass | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/eclass/meson.eclass b/eclass/meson.eclass
index 75291d7bdd1..65b09932a7a 100644
--- a/eclass/meson.eclass
+++ b/eclass/meson.eclass
@@ -188,6 +188,19 @@ meson_use() {
 	usex "$1" "-D${2-$1}=true" "-D${2-$1}=false"
 }
 
+# @FUNCTION: meson_feature
+# @USAGE: <USE flag> [option name]
+# @DESCRIPTION:
+# Given a USE flag and meson project option, outputs a string like:
+#
+#   -Doption=enabled
+#   -Doption=disabled
+#
+# If the project option is unspecified, it defaults to the USE flag.
+meson_feature() {
+	usex "$1" "-D${2-$1}=enabled" "-D${2-$1}=disabled"
+}
+
 # @FUNCTION: meson_src_configure
 # @USAGE: [extra meson arguments]
 # @DESCRIPTION:



             reply	other threads:[~2019-03-04  8:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-04  8:38 Mart Raudsepp [this message]
2019-03-11 15:41 ` [gentoo-dev] [PATCH] meson.eclass: add meson_feature function William Hubbs

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=eb8804d330240cfa8ed05d61d393302008da816c.camel@gentoo.org \
    --to=leio@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox