1 |
On Wed, 23 Jan 2013 21:40:13 -0300 |
2 |
Alexis Ballier <aballier@g.o> wrote: |
3 |
|
4 |
> On Thu, 24 Jan 2013 00:23:57 +0100 |
5 |
> Michał Górny <mgorny@g.o> wrote: |
6 |
> |
7 |
> > This is mostly a proof-of-concept. If approved, I will work on moving |
8 |
> > the code into a separate eclass, possibly named 'multilib-build' ;). |
9 |
> > --- |
10 |
> > gx86/eclass/autotools-multilib.eclass | 24 +++++++++++++++++++++--- |
11 |
> > 1 file changed, 21 insertions(+), 3 deletions(-) |
12 |
> > |
13 |
> > diff --git a/gx86/eclass/autotools-multilib.eclass |
14 |
> > b/gx86/eclass/autotools-multilib.eclass index 7c8697a..eef7bcc 100644 |
15 |
> > --- a/gx86/eclass/autotools-multilib.eclass |
16 |
> > +++ b/gx86/eclass/autotools-multilib.eclass |
17 |
> > @@ -32,7 +32,23 @@ inherit autotools-utils multilib |
18 |
> > |
19 |
> > EXPORT_FUNCTIONS src_configure src_compile src_test src_install |
20 |
> > |
21 |
> > -IUSE=multilib |
22 |
> > +# Declare all of them, profiles will control their visibility. |
23 |
> > +IUSE='abi_x86_32 abi_x86_64' |
24 |
> > + |
25 |
> > +# @FUNCTION: _autotools-multilib_get_enabled_abis |
26 |
> > +# @DESCRIPTION: |
27 |
> > +# Get the list of enabled ABIs. The returned names are suitable for |
28 |
> > use +# with multilib.eclass. |
29 |
> > +# |
30 |
> > +# If multilib is not enabled or not supported, returns an empty list. |
31 |
> > + |
32 |
> > + debug-print-function ${FUNCNAME} "${@}" |
33 |
> > + |
34 |
> > + if use amd64; then |
35 |
> > + use abi_x86_64 && echo amd64 |
36 |
> > + use abi_x86_32 && echo x86 |
37 |
> > + fi |
38 |
> > +} |
39 |
> |
40 |
> I would rather iterate over a variable than hardcoding and duplicating |
41 |
> it here: |
42 |
> |
43 |
> MULTILIB_ABIS='abi_x86_32:x86 abi_x86_64:amd64' |
44 |
> IUSE="" |
45 |
> for i in $MULTILIB_ABIS ; do |
46 |
> IUSE+=" ${i%:*}" |
47 |
> done |
48 |
> |
49 |
> _autotools-multilib_get_enabled_abis() { |
50 |
> for i in $MULTILIB_ABIS ; do |
51 |
> use ${i%:*} && echo ${i#*:} |
52 |
> done |
53 |
> } |
54 |
|
55 |
What are the advantages? I feel like the explicit solution is much more |
56 |
readable and obvious at the first glance. |
57 |
|
58 |
> (maybe protect it with has_multilib_profile if you wish) |
59 |
|
60 |
Well, the current code assumes that no flags == non-multilib profile. |
61 |
|
62 |
-- |
63 |
Best regards, |
64 |
Michał Górny |