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