Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: multilib@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 1/3] Introduce multilib_get_enabled_abi_pairs().
Date: Mon, 05 May 2014 08:30:20
Message-Id: 1399278606-7549-1-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCHES] multilib-build.eclass: getting 'long' ABI value & deprecating multilib_for_best_abi() by "Michał Górny"
1 The multilib_get_enabled_abis() returns ${ABI} values only, losing the
2 information about USE flags. Reverse mapping of those values may
3 be unclear (two architectures may use the same ABI name), and therefore
4 the function would to do that would be unnecessarily complex.
5
6 Instead, introduce a new function that would return both the USE flags
7 and the matching ${ABI} value.
8 ---
9 eclass/multilib-build.eclass | 19 +++++++++++++++++--
10 1 file changed, 17 insertions(+), 2 deletions(-)
11
12 diff --git a/eclass/multilib-build.eclass b/eclass/multilib-build.eclass
13 index ddf11cc..f369923 100644
14 --- a/eclass/multilib-build.eclass
15 +++ b/eclass/multilib-build.eclass
16 @@ -106,6 +106,21 @@ _multilib_build_set_globals
17 multilib_get_enabled_abis() {
18 debug-print-function ${FUNCNAME} "${@}"
19
20 + local pairs=( $(multilib_get_enabled_abi_pairs) )
21 + echo "${pairs[@]#*:}"
22 +}
23 +
24 +# @FUNCTION: multilib_get_enabled_abi_pairs
25 +# @DESCRIPTION:
26 +# Return the ordered list of enabled <use-flag>:<ABI> pairs
27 +# if multilib builds are enabled. The best (most preferred)
28 +# ABI will come last.
29 +#
30 +# If multilib is disabled, the default ABI will be returned
31 +# along with empty <use-flag>.
32 +multilib_get_enabled_abi_pairs() {
33 + debug-print-function ${FUNCNAME} "${@}"
34 +
35 local abis=( $(get_all_abis) )
36
37 local abi i found
38 @@ -119,7 +134,7 @@ multilib_get_enabled_abis() {
39 # for the split is more complex than cheating like this
40 for m_abi in ${m_abis//,/ }; do
41 if [[ ${m_abi} == ${abi} ]] && use "${m_flag}"; then
42 - echo "${abi}"
43 + echo "${m_flag}:${abi}"
44 found=1
45 break 2
46 fi
47 @@ -134,7 +149,7 @@ multilib_get_enabled_abis() {
48
49 debug-print "${FUNCNAME}: no ABIs enabled, fallback to ${abi}"
50 debug-print "${FUNCNAME}: ABI=${ABI}, DEFAULT_ABI=${DEFAULT_ABI}"
51 - echo ${abi}
52 + echo ":${abi}"
53 fi
54 }
55
56 --
57 1.9.2