1 |
commit: 5c3bb3600f924282a4d66fdc2f9699fb098dd2b8 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Oct 1 06:52:18 2016 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Oct 1 13:05:49 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5c3bb360 |
7 |
|
8 |
sys-devel/clang: Always install wrappers for all ABIs |
9 |
|
10 |
Install wrappers for all ABIs supported by the current profile rather |
11 |
than explicitly enabled via ABI_* flags. This makes them more consistent |
12 |
with ABIs supported by the compiler (it always supports all ABIs for |
13 |
the target) and avoids enforcing [${MULTILIB_USEDEP}] when you just need |
14 |
the wrappers (e.g. in tests of sys-libs/libcxx). |
15 |
|
16 |
sys-devel/clang/clang-9999.ebuild | 69 ++++++++++++++++++++------------------- |
17 |
1 file changed, 35 insertions(+), 34 deletions(-) |
18 |
|
19 |
diff --git a/sys-devel/clang/clang-9999.ebuild b/sys-devel/clang/clang-9999.ebuild |
20 |
index 61a172b..b2c3499 100644 |
21 |
--- a/sys-devel/clang/clang-9999.ebuild |
22 |
+++ b/sys-devel/clang/clang-9999.ebuild |
23 |
@@ -49,6 +49,17 @@ REQUIRED_USE="${PYTHON_REQUIRED_USE} |
24 |
|| ( ${ALL_LLVM_TARGETS[*]} ) |
25 |
multitarget? ( ${ALL_LLVM_TARGETS[*]} )" |
26 |
|
27 |
+# Multilib notes: |
28 |
+# 1. ABI_* flags control ABIs libclang* is built for only. |
29 |
+# 2. clang is always capable of compiling code for all ABIs for enabled |
30 |
+# target. However, you will need appropriate crt* files (installed |
31 |
+# e.g. by sys-devel/gcc and sys-libs/glibc). |
32 |
+# 3. ${CHOST}-clang wrappers are always installed for all ABIs included |
33 |
+# in the current profile (i.e. alike supported by sys-devel/gcc). |
34 |
+# |
35 |
+# Therefore: use sys-devel/clang[${MULTILIB_USEDEP}] only if you need |
36 |
+# multilib clang* libraries (not runtime, not wrappers). |
37 |
+ |
38 |
pkg_pretend() { |
39 |
local build_size=650 |
40 |
|
41 |
@@ -190,37 +201,16 @@ multilib_src_test() { |
42 |
} |
43 |
|
44 |
src_install() { |
45 |
- # note: magic applied in multilib_src_install()! |
46 |
- CLANG_VERSION=4.0 |
47 |
- |
48 |
- MULTILIB_CHOST_TOOLS=( |
49 |
- /usr/bin/clang |
50 |
- /usr/bin/clang++ |
51 |
- /usr/bin/clang-cl |
52 |
- /usr/bin/clang-${CLANG_VERSION} |
53 |
- /usr/bin/clang++-${CLANG_VERSION} |
54 |
- /usr/bin/clang-cl-${CLANG_VERSION} |
55 |
- ) |
56 |
- |
57 |
MULTILIB_WRAPPED_HEADERS=( |
58 |
/usr/include/clang/Config/config.h |
59 |
) |
60 |
|
61 |
multilib-minimal_src_install |
62 |
|
63 |
- # Remove unnecessary headers on FreeBSD, bug #417171 |
64 |
- if use kernel_FreeBSD && use clang; then |
65 |
- rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h || die |
66 |
- fi |
67 |
-} |
68 |
- |
69 |
-multilib_src_install() { |
70 |
- cmake-utils_src_install |
71 |
- |
72 |
- # apply CHOST and CLANG_VERSION to clang executables |
73 |
- # they're statically linked so we don't have to worry about the lib |
74 |
+ # Apply CHOST and version suffix to clang tools |
75 |
+ local clang_version=4.0 |
76 |
local clang_tools=( clang clang++ clang-cl ) |
77 |
- local i |
78 |
+ local abi i |
79 |
|
80 |
# cmake gives us: |
81 |
# - clang-X.Y |
82 |
@@ -230,27 +220,38 @@ multilib_src_install() { |
83 |
# - clang-X.Y |
84 |
# - clang++-X.Y, clang-cl-X.Y -> clang-X.Y |
85 |
# - clang, clang++, clang-cl -> clang*-X.Y |
86 |
- # so we need to fix the two tools |
87 |
+ # also in CHOST variant |
88 |
for i in "${clang_tools[@]:1}"; do |
89 |
rm "${ED%/}/usr/bin/${i}" || die |
90 |
- dosym "clang-${CLANG_VERSION}" "/usr/bin/${i}-${CLANG_VERSION}" |
91 |
- dosym "${i}-${CLANG_VERSION}" "/usr/bin/${i}" |
92 |
+ dosym "clang-${clang_version}" "/usr/bin/${i}-${clang_version}" |
93 |
+ dosym "${i}-${clang_version}" "/usr/bin/${i}" |
94 |
done |
95 |
|
96 |
- # now prepend ${CHOST} and let the multilib-build.eclass symlink it |
97 |
- if ! multilib_is_native_abi; then |
98 |
- # non-native? let's replace it with a simple wrapper |
99 |
+ # now create wrappers for all supported ABIs |
100 |
+ for abi in $(get_all_abis); do |
101 |
+ local abi_flags=$(get_abi_CFLAGS "${abi}") |
102 |
+ local abi_chost=$(get_abi_CHOST "${abi}") |
103 |
for i in "${clang_tools[@]}"; do |
104 |
- rm "${ED%/}/usr/bin/${i}-${CLANG_VERSION}" || die |
105 |
- cat > "${T}"/wrapper.tmp <<-_EOF_ |
106 |
+ cat > "${T}"/wrapper.tmp <<-_EOF_ || die |
107 |
#!${EPREFIX}/bin/sh |
108 |
- exec "${i}-${CLANG_VERSION}" $(get_abi_CFLAGS) "\${@}" |
109 |
+ exec "${i}-${clang_version}" ${abi_flags} "\${@}" |
110 |
_EOF_ |
111 |
- newbin "${T}"/wrapper.tmp "${i}-${CLANG_VERSION}" |
112 |
+ newbin "${T}"/wrapper.tmp "${abi_chost}-${i}-${clang_version}" |
113 |
+ dosym "${abi_chost}-${i}-${clang_version}" \ |
114 |
+ "/usr/bin/${abi_chost}-${i}" |
115 |
done |
116 |
+ done |
117 |
+ |
118 |
+ # Remove unnecessary headers on FreeBSD, bug #417171 |
119 |
+ if use kernel_FreeBSD && use clang; then |
120 |
+ rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h || die |
121 |
fi |
122 |
} |
123 |
|
124 |
+multilib_src_install() { |
125 |
+ cmake-utils_src_install |
126 |
+} |
127 |
+ |
128 |
multilib_src_install_all() { |
129 |
if use python ; then |
130 |
pushd bindings/python/clang >/dev/null || die |