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