Gentoo Archives: gentoo-dev

From: Alexis Ballier <aballier@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: Re: [gentoo-dev] [PATCH 2/2] Use new multilib flags in autotools-multilib.
Date: Thu, 24 Jan 2013 00:40:25
Message-Id: 20130123214013.3a4b146f@gentoo.org
In Reply to: [gentoo-dev] [PATCH 2/2] Use new multilib flags in autotools-multilib. by "Michał Górny"
1 On Thu, 24 Jan 2013 00:23:57 +0100
2 Michał Górny <mgorny@g.o> wrote:
3
4 > This is mostly a proof-of-concept. If approved, I will work on moving
5 > the code into a separate eclass, possibly named 'multilib-build' ;).
6 > ---
7 > gx86/eclass/autotools-multilib.eclass | 24 +++++++++++++++++++++---
8 > 1 file changed, 21 insertions(+), 3 deletions(-)
9 >
10 > diff --git a/gx86/eclass/autotools-multilib.eclass
11 > b/gx86/eclass/autotools-multilib.eclass index 7c8697a..eef7bcc 100644
12 > --- a/gx86/eclass/autotools-multilib.eclass
13 > +++ b/gx86/eclass/autotools-multilib.eclass
14 > @@ -32,7 +32,23 @@ inherit autotools-utils multilib
15 >
16 > EXPORT_FUNCTIONS src_configure src_compile src_test src_install
17 >
18 > -IUSE=multilib
19 > +# Declare all of them, profiles will control their visibility.
20 > +IUSE='abi_x86_32 abi_x86_64'
21 > +
22 > +# @FUNCTION: _autotools-multilib_get_enabled_abis
23 > +# @DESCRIPTION:
24 > +# Get the list of enabled ABIs. The returned names are suitable for
25 > use +# with multilib.eclass.
26 > +#
27 > +# If multilib is not enabled or not supported, returns an empty list.
28 > +
29 > + debug-print-function ${FUNCNAME} "${@}"
30 > +
31 > + if use amd64; then
32 > + use abi_x86_64 && echo amd64
33 > + use abi_x86_32 && echo x86
34 > + fi
35 > +}
36
37 I would rather iterate over a variable than hardcoding and duplicating
38 it here:
39
40 MULTILIB_ABIS='abi_x86_32:x86 abi_x86_64:amd64'
41 IUSE=""
42 for i in $MULTILIB_ABIS ; do
43 IUSE+=" ${i%:*}"
44 done
45
46 _autotools-multilib_get_enabled_abis() {
47 for i in $MULTILIB_ABIS ; do
48 use ${i%:*} && echo ${i#*:}
49 done
50 }
51
52 (maybe protect it with has_multilib_profile if you wish)
53
54 [...]
55
56 Alexis.

Replies