* [gentoo-dev] Re: [PATCH multilib-build.eclass] Add multilib_native_use* functions to make ebuild writing easier.
@ 2014-04-19 19:57 99% ` Jonathan Callen
0 siblings, 0 replies; 1+ results
From: Jonathan Callen @ 2014-04-19 19:57 UTC (permalink / raw
To: gentoo-dev; +Cc: multilib, Michał Górny
[-- Attachment #1: Type: text/plain, Size: 2580 bytes --]
On 04/19/2014 06:53 AM, Michał Górny wrote:
> 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
>
These all look good to me (being one of the offenders mentioned above).
--
Jonathan Callen
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]
^ permalink raw reply [relevance 99%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2014-04-19 10:53 [gentoo-dev] [PATCH multilib-build.eclass] Add multilib_native_use* functions to make ebuild writing easier Michał Górny
2014-04-19 19:57 99% ` [gentoo-dev] " Jonathan Callen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox