meson.eclass: add meson_use function
authorMike Gilbert <floppym@gentoo.org>
Mon, 11 Dec 2017 19:14:06 +0000 (14:14 -0500)
committerMike Gilbert <floppym@gentoo.org>
Sat, 23 Dec 2017 18:04:12 +0000 (13:04 -0500)
eclass/meson.eclass

index 2c943dd6ae27b151993f5e3ac8f45e5d655959b5..71735fbfc67d8363dc24ac0a5af3f42f3c0be124 100644 (file)
@@ -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.