Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/compiler-rt/
Date: Sat, 01 Oct 2016 19:06:15
Message-Id: 1475348759.93a7dfc1e15d39ae382e56d6da1e775e08efbdd3.mgorny@gentoo
1 commit: 93a7dfc1e15d39ae382e56d6da1e775e08efbdd3
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat Oct 1 18:58:18 2016 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sat Oct 1 19:05:59 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=93a7dfc1
7
8 sys-libs/compiler-rt: Support bootstrapping with runtime-less clang
9
10 sys-libs/compiler-rt/compiler-rt-9999.ebuild | 15 ++++++++++++++-
11 1 file changed, 14 insertions(+), 1 deletion(-)
12
13 diff --git a/sys-libs/compiler-rt/compiler-rt-9999.ebuild b/sys-libs/compiler-rt/compiler-rt-9999.ebuild
14 index 751fac9..1f8d174 100644
15 --- a/sys-libs/compiler-rt/compiler-rt-9999.ebuild
16 +++ b/sys-libs/compiler-rt/compiler-rt-9999.ebuild
17 @@ -9,7 +9,7 @@ CMAKE_MIN_VERSION=3.4.3
18 PYTHON_COMPAT=( python2_7 )
19
20 # TODO: fix unnecessary dep on Python upstream
21 -inherit cmake-utils flag-o-matic git-r3 python-any-r1
22 +inherit cmake-utils flag-o-matic git-r3 python-any-r1 toolchain-funcs
23
24 DESCRIPTION="Compiler runtime library for clang (built-in part)"
25 HOMEPAGE="http://llvm.org/"
26 @@ -28,10 +28,23 @@ DEPEND="${RDEPEND}
27 ~sys-devel/llvm-${PV}
28 ${PYTHON_DEPS}"
29
30 +test_compiler() {
31 + $(tc-getCC) ${CFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c - \
32 + <<<'int main() { return 0; }' &>/dev/null
33 +}
34 +
35 src_configure() {
36 # pre-set since we need to pass it to cmake
37 BUILD_DIR=${WORKDIR}/${P}_build
38
39 + if ! test_compiler; then
40 + local extra_flags=( -nodefaultlibs -lc )
41 + if test_compiler "${extra_flags[@]}"; then
42 + local -x LDFLAGS="${LDFLAGS} ${extra_flags[*]}"
43 + ewarn "${CC} seems to lack runtime, trying with ${extra_flags[*]}"
44 + fi
45 + fi
46 +
47 local clang_version=4.0.0
48 local libdir=$(get_libdir)
49 local mycmakeargs=(