Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: amd64@g.o, releng@g.o, x11@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 2/5] Use explicit abi_* flags to select multilib targets.
Date: Sat, 26 Jan 2013 22:08:57
Message-Id: 1359238096-13232-3-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCHES] x86 multilib flags, ver. 2 by "Michał Górny"
1 This time, following suggestions from Alexis Ballier, the complete list
2 of USE flags and corresponding ABIs is stored in a single variable.
3 I have removed the arch hack and all selected ABIs are validated against
4 $(get_all_abis) from multilib.eclass.
5 ---
6 gx86/eclass/multilib-build.eclass | 36 +++++++++++++++++++++++++++++++-----
7 1 file changed, 31 insertions(+), 5 deletions(-)
8
9 diff --git a/gx86/eclass/multilib-build.eclass b/gx86/eclass/multilib-build.eclass
10 index 20d4f1c..a6104e0 100644
11 --- a/gx86/eclass/multilib-build.eclass
12 +++ b/gx86/eclass/multilib-build.eclass
13 @@ -25,7 +25,14 @@ esac
14
15 inherit multilib multiprocessing
16
17 -IUSE=multilib
18 +# @ECLASS-VARIABLE: _MULTILIB_FLAGS
19 +# @INTERNAL
20 +# @DESCRIPTION:
21 +# The list of multilib flags and corresponding ABI values.
22 +_MULTILIB_FLAGS=(
23 + abi_x86_32:x86
24 + abi_x86_64:amd64
25 +)
26
27 # @ECLASS-VARIABLE: MULTILIB_USEDEP
28 # @DESCRIPTION:
29 @@ -37,7 +44,15 @@ IUSE=multilib
30 # RDEPEND="dev-libs/libfoo[${MULTILIB_USEDEP}]
31 # net-libs/libbar[ssl,${MULTILIB_USEDEP}]"
32 # @CODE
33 -MULTILIB_USEDEP='multilib(-)?'
34 +
35 +_multilib_build_set_globals() {
36 + local flags=( "${_MULTILIB_FLAGS[@]%:*}" )
37 + local usedeps=${flags[@]/%/(-)?}
38 +
39 + IUSE=${flags[*]}
40 + MULTILIB_USEDEP=${usedeps// /,}
41 +}
42 +_multilib_build_set_globals
43
44 # @FUNCTION: multilib_get_enabled_abis
45 # @DESCRIPTION:
46 @@ -49,9 +64,20 @@ MULTILIB_USEDEP='multilib(-)?'
47 multilib_get_enabled_abis() {
48 debug-print-function ${FUNCNAME} "${@}"
49
50 - if use multilib; then
51 - get_all_abis
52 - else
53 + local supported_abis=$(get_all_abis)
54 + local i found
55 + for i in "${_MULTILIB_FLAGS[@]}"; do
56 + local abi=${i#*:}
57 + local flag=${i%:*}
58 +
59 + if has "${abi}" ${supported_abis} && use "${flag}"; then
60 + echo "${abi}"
61 + found=1
62 + fi
63 + done
64 +
65 + if [[ ! ${found} ]]; then
66 + debug-print "${FUNCNAME}: no ABIs enabled, fallback to ${DEFAULT_ABI}"
67 echo ${DEFAULT_ABI}
68 fi
69 }
70 --
71 1.8.1.1

Replies