From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 0BB6E138A1F for ; Sat, 19 Apr 2014 10:53:38 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D9EFAE0A95; Sat, 19 Apr 2014 10:53:32 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 03105E09B3 for ; Sat, 19 Apr 2014 10:53:31 +0000 (UTC) Received: from pomiot.lan (77-255-22-215.adsl.inetia.pl [77.255.22.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 3CEFD34032E; Sat, 19 Apr 2014 10:53:30 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: multilib@gentoo.org, =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH multilib-build.eclass] Add multilib_native_use* functions to make ebuild writing easier. Date: Sat, 19 Apr 2014 12:53:26 +0200 Message-Id: <1397904806-3079-1-git-send-email-mgorny@gentoo.org> X-Mailer: git-send-email 1.9.2 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-Archives-Salt: 9169521b-7354-460b-ac1f-e4cc4e870815 X-Archives-Hash: b0135b50a55b856c4d89f0bb496a3fcf People are either inlining this or creating local functions for this purpose, so it'd be better to have them in the eclass. RFC: what about '!use'? Should we invert the multilib_build_binaries test as well? --- eclass/multilib-build.eclass | 48 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/eclass/multilib-build.eclass b/eclass/multilib-build.eclass index 77e7573..6adfc76 100644 --- a/eclass/multilib-build.eclass +++ b/eclass/multilib-build.eclass @@ -462,5 +462,53 @@ multilib_build_binaries() { [[ ${COMPLETE_MULTILIB} == yes ]] || multilib_is_native_abi } +# @FUNCTION: multilib_native_use_with +# @USAGE: [ []] +# @DESCRIPTION: +# Output --with configure option alike use_with if USE is enabled +# and executables are being built (multilib_build_binaries is true). +# Otherwise, outputs --without configure option. Arguments are the same +# as for use_with in the EAPI. +multilib_native_use_with() { + if multilib_build_binaries; then + use_with "${@}" + else + echo "--without-${2:-${1}}" + fi +} + +# @FUNCTION: multilib_native_use_enable +# @USAGE: [ []] +# @DESCRIPTION: +# Output --enable configure option alike use_with if USE +# is enabled and executables are being built (multilib_build_binaries +# is true). Otherwise, outputs --disable configure option. Arguments are +# the same as for use_enable in the EAPI. +multilib_native_use_enable() { + if multilib_build_binaries; then + use_enable "${@}" + else + echo "--disable-${2:-${1}}" + fi +} + +# @FUNCTION: multilib_native_usex +# @USAGE: [ [ [ []]]] +# @DESCRIPTION: +# Output the concatenation of (or 'yes' if unspecified) +# and if USE is enabled and executables are being built +# (multilib_build_binaries is true). Otherwise, output the concatenation +# of (or 'no' if unspecified) and . Arguments +# are the same as for usex in the EAPI. +# +# Note: in EAPI 4 you need to inherit eutils to use this function. +multilib_native_usex() { + if multilib_build_binaries; then + usex "${@}" + else + echo "${3-no}${5}" + fi +} + _MULTILIB_BUILD=1 fi -- 1.9.2