commit:     b7ad7de7e4a3d584601bf3d7bd9c8d9c7dd2af48
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 11 19:14:06 2017 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Sat Dec 23 18:04:12 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b7ad7de7

meson.eclass: add meson_use function

 eclass/meson.eclass | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/eclass/meson.eclass b/eclass/meson.eclass
index 2c943dd6ae2..71735fbfc67 100644
--- a/eclass/meson.eclass
+++ b/eclass/meson.eclass
@@ -137,6 +137,19 @@ _meson_create_cross_file() {
        EOF
 }
 
+# @FUNCTION: meson_use
+# @USAGE: <USE flag> [option name]
+# @DESCRIPTION:
+# Given a USE flag and meson project option, outputs a string like:
+#
+#   -Doption=true
+#   -Doption=false
+#
+# If the project option is unspecified, it defaults to the USE flag.
+meson_use() {
+       usex "$1" "-D${2-$1}=true" "-D${2-$1}=false"
+}
+
 # @FUNCTION: meson_src_configure
 # @DESCRIPTION:
 # This is the meson_src_configure function.

Reply via email to