From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 7336E138334 for ; Mon, 4 Mar 2019 08:38:12 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AF93EE0870; Mon, 4 Mar 2019 08:38:08 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 676B6E07DB for ; Mon, 4 Mar 2019 08:38:08 +0000 (UTC) Received: from 5e46-fe7f-49ff-6ef0-3d80-83ab-07d0-2001.dyn.estpak.ee (5e46-fe7f-49ff-6ef0-3d80-83ab-07d0-2001.dyn.estpak.ee [IPv6:2001:7d0:83ab:3d80:6ef0:49ff:fe7f:5e46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: leio) by smtp.gentoo.org (Postfix) with ESMTPSA id B8399335C29 for ; Mon, 4 Mar 2019 08:38:06 +0000 (UTC) Message-ID: Subject: [gentoo-dev] [PATCH] meson.eclass: add meson_feature function From: Mart Raudsepp To: gentoo-dev@lists.gentoo.org Date: Mon, 04 Mar 2019 10:38:02 +0200 Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Archives-Salt: a6037f1f-8926-4faa-9fd3-8ba2fb9c56ed X-Archives-Hash: 2f2377061a94f8fa76d14fa15c41663a This can be used to simplify controlling meson_options.txt entries of type 'feature'. Signed-off-by: Mart Raudsepp --- 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: [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: