From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: multilib@gentoo.org, "Michał Górny" <mgorny@gentoo.org>
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 [thread overview]
Message-ID: <1397904806-3079-1-git-send-email-mgorny@gentoo.org> (raw)
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: <flag> [<opt-name> [<opt-value>]]
+# @DESCRIPTION:
+# Output --with configure option alike use_with if USE <flag> 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: <flag> [<opt-name> [<opt-value>]]
+# @DESCRIPTION:
+# Output --enable configure option alike use_with if USE <flag>
+# 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: <flag> [<true1> [<false1> [<true2> [<false2>]]]]
+# @DESCRIPTION:
+# Output the concatenation of <true1> (or 'yes' if unspecified)
+# and <true2> if USE <flag> is enabled and executables are being built
+# (multilib_build_binaries is true). Otherwise, output the concatenation
+# of <false1> (or 'no' if unspecified) and <false2>. 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
next reply other threads:[~2014-04-19 10:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-19 10:53 Michał Górny [this message]
2014-04-19 19:57 ` [gentoo-dev] Re: [PATCH multilib-build.eclass] Add multilib_native_use* functions to make ebuild writing easier Jonathan Callen
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=1397904806-3079-1-git-send-email-mgorny@gentoo.org \
--to=mgorny@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
--cc=multilib@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