Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 1/2] multilib-build: set MULTILIB_ABI as the 'global' ABI value.
Date: Tue, 02 Apr 2013 21:42:51
Message-Id: 1364939012-29714-1-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCHES] multilib-build: use MULTILIB_ABI for eclass-specific ABI value by "Michał Górny"
1 ---
2 gx86/eclass/multilib-build.eclass | 41 ++++++++++++++++++++++++++++++++++-----
3 1 file changed, 36 insertions(+), 5 deletions(-)
4
5 diff --git a/gx86/eclass/multilib-build.eclass b/gx86/eclass/multilib-build.eclass
6 index dbaed70..fdaed6b 100644
7 --- a/gx86/eclass/multilib-build.eclass
8 +++ b/gx86/eclass/multilib-build.eclass
9 @@ -25,10 +25,22 @@ esac
10
11 inherit multibuild multilib
12
13 +# @ECLASS-VARIABLE: MULTILIB_ABI
14 +# @DEFAULT-UNSET
15 +# @DESCRIPTION:
16 +# The current ABI, in form of base arch and sub-ABI, joined using
17 +# an underscore. It's equal to the flag name with 'abi_' prefix
18 +# stripped.
19 +#
20 +# Exported by multilib_foreach_abi, multilib_parallel_foreach_abi,
21 +# multilib_for_best_abi.
22 +#
23 +# Example values: x86_32, mips_n32
24 +
25 # @ECLASS-VARIABLE: _MULTILIB_FLAGS
26 # @INTERNAL
27 # @DESCRIPTION:
28 -# The list of multilib flags and corresponding ABI values.
29 +# The list of corresponding USE flags and ABI values.
30 _MULTILIB_FLAGS=(
31 abi_x86_32:x86
32 abi_x86_64:amd64
33 @@ -56,6 +68,7 @@ _multilib_build_set_globals() {
34 _multilib_build_set_globals
35
36 # @FUNCTION: multilib_get_enabled_abis
37 +# @INTERNAL
38 # @DESCRIPTION:
39 # Return the ordered list of enabled ABIs if multilib builds
40 # are enabled. The best (most preferred) ABI will come last.
41 @@ -74,7 +87,7 @@ multilib_get_enabled_abis() {
42 local m_flag=${i%:*}
43
44 if [[ ${m_abi} == ${abi} ]] && use "${m_flag}"; then
45 - echo "${abi}"
46 + echo "${m_flag#abi_}"
47 found=1
48 fi
49 done
50 @@ -87,7 +100,7 @@ multilib_get_enabled_abis() {
51
52 debug-print "${FUNCNAME}: no ABIs enabled, fallback to ${abi}"
53 debug-print "${FUNCNAME}: ABI=${ABI}, DEFAULT_ABI=${DEFAULT_ABI}"
54 - echo ${abi}
55 + echo default
56 fi
57 }
58
59 @@ -99,8 +112,26 @@ multilib_get_enabled_abis() {
60 _multilib_multibuild_wrapper() {
61 debug-print-function ${FUNCNAME} "${@}"
62
63 - local ABI=${MULTIBUILD_VARIANT}
64 - multilib_toolchain_setup "${ABI}"
65 + local MULTILIB_ABI=${MULTIBUILD_VARIANT}
66 + local i
67 +
68 + if [[ ${MULTILIB_ABI} != default ]]; then
69 + local ABI
70 +
71 + for i in "${_MULTILIB_FLAGS[@]}"; do
72 + local m_abi=${i#*:}
73 + local m_flag=${i%:*}
74 +
75 + if [[ ${MULTILIB_ABI} == ${m_flag#abi_} ]]; then
76 + local -x ABI=${m_abi}
77 + break
78 + fi
79 + done
80 +
81 + [[ ${ABI} ]] || die "Unable to match ${MULTILIB_ABI} to an ABI!"
82 + multilib_toolchain_setup "${ABI}"
83 + fi
84 +
85 "${@}"
86 }
87
88 --
89 1.8.1.5