1 |
commit: 04bb278e03b7a36b5a5682c77355c68aee632e78 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Feb 16 13:36:42 2017 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Feb 16 14:16:21 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=04bb278e |
7 |
|
8 |
sys-libs/compiler-rt: Prefer building using clang |
9 |
|
10 |
Add a USE=clang flag to prefer building using installed clang, to work |
11 |
around limited/broken support for '#pragma redefine_extname' which |
12 |
results in incomplete runtime being emitted when building using GCC. |
13 |
|
14 |
sys-libs/compiler-rt/compiler-rt-4.0.0_rc2.ebuild | 10 ++++++++-- |
15 |
sys-libs/compiler-rt/compiler-rt-9999.ebuild | 11 +++++++++-- |
16 |
sys-libs/compiler-rt/metadata.xml | 4 ++++ |
17 |
3 files changed, 21 insertions(+), 4 deletions(-) |
18 |
|
19 |
diff --git a/sys-libs/compiler-rt/compiler-rt-4.0.0_rc2.ebuild b/sys-libs/compiler-rt/compiler-rt-4.0.0_rc2.ebuild |
20 |
index 43560c2edd..82b3dcffe1 100644 |
21 |
--- a/sys-libs/compiler-rt/compiler-rt-4.0.0_rc2.ebuild |
22 |
+++ b/sys-libs/compiler-rt/compiler-rt-4.0.0_rc2.ebuild |
23 |
@@ -19,7 +19,7 @@ SRC_URI="http://www.llvm.org/pre-releases/${PV/_//}/${P/_/}.src.tar.xz" |
24 |
LICENSE="|| ( UoI-NCSA MIT )" |
25 |
SLOT="${PV%_*}" |
26 |
KEYWORDS="~amd64 ~arm64 ~x86" |
27 |
-IUSE="test" |
28 |
+IUSE="+clang test" |
29 |
|
30 |
LLVM_SLOT=${SLOT%%.*} |
31 |
RDEPEND="!=sys-libs/compiler-rt-${SLOT}*:0" |
32 |
@@ -43,7 +43,13 @@ src_configure() { |
33 |
# pre-set since we need to pass it to cmake |
34 |
BUILD_DIR=${WORKDIR}/${P}_build |
35 |
|
36 |
- if ! test_compiler; then |
37 |
+ if use clang; then |
38 |
+ local -x CC=${CHOST}-clang |
39 |
+ local -x CXX=${CHOST}-clang++ |
40 |
+ # ensure we can use clang before installing compiler-rt |
41 |
+ local -x LDFLAGS="${LDFLAGS} -nodefaultlibs -lc" |
42 |
+ strip-unsupported-flags |
43 |
+ elif ! test_compiler; then |
44 |
local extra_flags=( -nodefaultlibs -lc ) |
45 |
if test_compiler "${extra_flags[@]}"; then |
46 |
local -x LDFLAGS="${LDFLAGS} ${extra_flags[*]}" |
47 |
|
48 |
diff --git a/sys-libs/compiler-rt/compiler-rt-9999.ebuild b/sys-libs/compiler-rt/compiler-rt-9999.ebuild |
49 |
index 450177ae5c..034b1d2531 100644 |
50 |
--- a/sys-libs/compiler-rt/compiler-rt-9999.ebuild |
51 |
+++ b/sys-libs/compiler-rt/compiler-rt-9999.ebuild |
52 |
@@ -22,12 +22,13 @@ LICENSE="|| ( UoI-NCSA MIT )" |
53 |
# Note: this needs to be updated to match version of clang-9999 |
54 |
SLOT="5.0.0" |
55 |
KEYWORDS="" |
56 |
-IUSE="test" |
57 |
+IUSE="+clang test" |
58 |
|
59 |
LLVM_SLOT=${SLOT%%.*} |
60 |
# llvm-4 needed for --cmakedir |
61 |
DEPEND=" |
62 |
>=sys-devel/llvm-4 |
63 |
+ clang? ( sys-devel/clang ) |
64 |
test? ( =sys-devel/clang-${PV%_*}*:${LLVM_SLOT} ) |
65 |
${PYTHON_DEPS}" |
66 |
|
67 |
@@ -43,7 +44,13 @@ src_configure() { |
68 |
# pre-set since we need to pass it to cmake |
69 |
BUILD_DIR=${WORKDIR}/${P}_build |
70 |
|
71 |
- if ! test_compiler; then |
72 |
+ if use clang; then |
73 |
+ local -x CC=${CHOST}-clang |
74 |
+ local -x CXX=${CHOST}-clang++ |
75 |
+ # ensure we can use clang before installing compiler-rt |
76 |
+ local -x LDFLAGS="${LDFLAGS} -nodefaultlibs -lc" |
77 |
+ strip-unsupported-flags |
78 |
+ elif ! test_compiler; then |
79 |
local extra_flags=( -nodefaultlibs -lc ) |
80 |
if test_compiler "${extra_flags[@]}"; then |
81 |
local -x LDFLAGS="${LDFLAGS} ${extra_flags[*]}" |
82 |
|
83 |
diff --git a/sys-libs/compiler-rt/metadata.xml b/sys-libs/compiler-rt/metadata.xml |
84 |
index 89c4bdb960..3b99602138 100644 |
85 |
--- a/sys-libs/compiler-rt/metadata.xml |
86 |
+++ b/sys-libs/compiler-rt/metadata.xml |
87 |
@@ -4,4 +4,8 @@ |
88 |
<maintainer type="project"> |
89 |
<email>llvm@g.o</email> |
90 |
</maintainer> |
91 |
+ <use> |
92 |
+ <flag name='clang'>Force building using installed clang (rather |
93 |
+ than the default CC/CXX).</flag> |
94 |
+ </use> |
95 |
</pkgmetadata> |