Gentoo Archives: gentoo-dev

From: Jonathan Callen <jcallen@g.o>
To: gentoo-dev@l.g.o
Cc: multilib@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] Re: [PATCH multilib-build.eclass] Add multilib_native_use* functions to make ebuild writing easier.
Date: Sat, 19 Apr 2014 19:57:20
Message-Id: 5352D512.5050300@gentoo.org
In Reply to: [gentoo-dev] [PATCH multilib-build.eclass] Add multilib_native_use* functions to make ebuild writing easier. by "Michał Górny"
1 On 04/19/2014 06:53 AM, Michał Górny wrote:
2 > People are either inlining this or creating local functions for this
3 > purpose, so it'd be better to have them in the eclass.
4 >
5 > RFC: what about '!use'? Should we invert the multilib_build_binaries
6 > test as well?
7 > ---
8 > eclass/multilib-build.eclass | 48 ++++++++++++++++++++++++++++++++++++++++++++
9 > 1 file changed, 48 insertions(+)
10 >
11 > diff --git a/eclass/multilib-build.eclass b/eclass/multilib-build.eclass
12 > index 77e7573..6adfc76 100644
13 > --- a/eclass/multilib-build.eclass
14 > +++ b/eclass/multilib-build.eclass
15 > @@ -462,5 +462,53 @@ multilib_build_binaries() {
16 > [[ ${COMPLETE_MULTILIB} == yes ]] || multilib_is_native_abi
17 > }
18 >
19 > +# @FUNCTION: multilib_native_use_with
20 > +# @USAGE: <flag> [<opt-name> [<opt-value>]]
21 > +# @DESCRIPTION:
22 > +# Output --with configure option alike use_with if USE <flag> is enabled
23 > +# and executables are being built (multilib_build_binaries is true).
24 > +# Otherwise, outputs --without configure option. Arguments are the same
25 > +# as for use_with in the EAPI.
26 > +multilib_native_use_with() {
27 > + if multilib_build_binaries; then
28 > + use_with "${@}"
29 > + else
30 > + echo "--without-${2:-${1}}"
31 > + fi
32 > +}
33 > +
34 > +# @FUNCTION: multilib_native_use_enable
35 > +# @USAGE: <flag> [<opt-name> [<opt-value>]]
36 > +# @DESCRIPTION:
37 > +# Output --enable configure option alike use_with if USE <flag>
38 > +# is enabled and executables are being built (multilib_build_binaries
39 > +# is true). Otherwise, outputs --disable configure option. Arguments are
40 > +# the same as for use_enable in the EAPI.
41 > +multilib_native_use_enable() {
42 > + if multilib_build_binaries; then
43 > + use_enable "${@}"
44 > + else
45 > + echo "--disable-${2:-${1}}"
46 > + fi
47 > +}
48 > +
49 > +# @FUNCTION: multilib_native_usex
50 > +# @USAGE: <flag> [<true1> [<false1> [<true2> [<false2>]]]]
51 > +# @DESCRIPTION:
52 > +# Output the concatenation of <true1> (or 'yes' if unspecified)
53 > +# and <true2> if USE <flag> is enabled and executables are being built
54 > +# (multilib_build_binaries is true). Otherwise, output the concatenation
55 > +# of <false1> (or 'no' if unspecified) and <false2>. Arguments
56 > +# are the same as for usex in the EAPI.
57 > +#
58 > +# Note: in EAPI 4 you need to inherit eutils to use this function.
59 > +multilib_native_usex() {
60 > + if multilib_build_binaries; then
61 > + usex "${@}"
62 > + else
63 > + echo "${3-no}${5}"
64 > + fi
65 > +}
66 > +
67 > _MULTILIB_BUILD=1
68 > fi
69 >
70
71 These all look good to me (being one of the offenders mentioned above).
72
73 --
74 Jonathan Callen

Attachments

File name MIME type
signature.asc application/pgp-signature