1 |
On Sat, 26 Jan 2013 13:11:41 +0100 |
2 |
Michał Górny <mgorny@g.o> wrote: |
3 |
|
4 |
> On Wed, 23 Jan 2013 21:40:13 -0300 |
5 |
> Alexis Ballier <aballier@g.o> wrote: |
6 |
> |
7 |
> > On Thu, 24 Jan 2013 00:23:57 +0100 |
8 |
> > Michał Górny <mgorny@g.o> wrote: |
9 |
> > |
10 |
> > > This is mostly a proof-of-concept. If approved, I will work on |
11 |
> > > moving the code into a separate eclass, possibly named |
12 |
> > > 'multilib-build' ;). --- |
13 |
> > > gx86/eclass/autotools-multilib.eclass | 24 |
14 |
> > > +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 |
15 |
> > > deletions(-) |
16 |
> > > |
17 |
> > > diff --git a/gx86/eclass/autotools-multilib.eclass |
18 |
> > > b/gx86/eclass/autotools-multilib.eclass index 7c8697a..eef7bcc |
19 |
> > > 100644 --- a/gx86/eclass/autotools-multilib.eclass |
20 |
> > > +++ b/gx86/eclass/autotools-multilib.eclass |
21 |
> > > @@ -32,7 +32,23 @@ inherit autotools-utils multilib |
22 |
> > > |
23 |
> > > EXPORT_FUNCTIONS src_configure src_compile src_test src_install |
24 |
> > > |
25 |
> > > -IUSE=multilib |
26 |
> > > +# Declare all of them, profiles will control their visibility. |
27 |
> > > +IUSE='abi_x86_32 abi_x86_64' |
28 |
> > > + |
29 |
> > > +# @FUNCTION: _autotools-multilib_get_enabled_abis |
30 |
> > > +# @DESCRIPTION: |
31 |
> > > +# Get the list of enabled ABIs. The returned names are suitable |
32 |
> > > for use +# with multilib.eclass. |
33 |
> > > +# |
34 |
> > > +# If multilib is not enabled or not supported, returns an empty |
35 |
> > > list. + |
36 |
> > > + debug-print-function ${FUNCNAME} "${@}" |
37 |
> > > + |
38 |
> > > + if use amd64; then |
39 |
> > > + use abi_x86_64 && echo amd64 |
40 |
> > > + use abi_x86_32 && echo x86 |
41 |
> > > + fi |
42 |
> > > +} |
43 |
> > |
44 |
> > I would rather iterate over a variable than hardcoding and |
45 |
> > duplicating it here: |
46 |
> > |
47 |
> > MULTILIB_ABIS='abi_x86_32:x86 abi_x86_64:amd64' |
48 |
> > IUSE="" |
49 |
> > for i in $MULTILIB_ABIS ; do |
50 |
> > IUSE+=" ${i%:*}" |
51 |
> > done |
52 |
> > |
53 |
> > _autotools-multilib_get_enabled_abis() { |
54 |
> > for i in $MULTILIB_ABIS ; do |
55 |
> > use ${i%:*} && echo ${i#*:} |
56 |
> > done |
57 |
> > } |
58 |
> |
59 |
> What are the advantages? I feel like the explicit solution is much |
60 |
> more readable and obvious at the first glance. |
61 |
|
62 |
yes it is more readable but IMHO it's better to avoid to have to touch |
63 |
multiple places when adding a new ABI: you only have to document |
64 |
that adding a new ABI consists simply in adding it to this list (and |
65 |
document the useflag) instead of 'add the useflag, add support for it to |
66 |
function foo and bar, etc.' |
67 |
your call in the end, but I fear not trying to separate code from data |
68 |
could make the eclass harder to maintain. |
69 |
|
70 |
also, it'll make code much shorter when all the exotic ABIs will be |
71 |
added :) |
72 |
|
73 |
|
74 |
> |
75 |
> > (maybe protect it with has_multilib_profile if you wish) |
76 |
> |
77 |
> Well, the current code assumes that no flags == non-multilib profile. |
78 |
|
79 |
in the code you posted you do not seem to take into account amd64 |
80 |
non-multilib then :) |
81 |
|
82 |
also, IMHO you shouldn't use arch to guess what useflag to check or |
83 |
not: they'll all be in IUSE in the end and the profiles should be the |
84 |
one deciding what to mask or not (which you'll have to do anyway), not |
85 |
the eclass. |
86 |
|
87 |
Alexis. |