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/libcxx/
Date: Fri, 07 Oct 2016 08:41:37
Message-Id: 1475829684.f9dd98ec5f9aaf196319a0527d0312d18f2430a2.mgorny@gentoo
1 commit: f9dd98ec5f9aaf196319a0527d0312d18f2430a2
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Thu Oct 6 16:27:40 2016 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Oct 7 08:41:24 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f9dd98ec
7
8 sys-libs/libcxx: Always pass compiler runtime libs
9
10 sys-libs/libcxx/libcxx-3.9.0.ebuild | 27 +++++++++++++++++++++++++--
11 sys-libs/libcxx/libcxx-9999.ebuild | 27 +++++++++++++++++++++++++--
12 2 files changed, 50 insertions(+), 4 deletions(-)
13
14 diff --git a/sys-libs/libcxx/libcxx-3.9.0.ebuild b/sys-libs/libcxx/libcxx-3.9.0.ebuild
15 index a92f0f8..7f16bd2 100644
16 --- a/sys-libs/libcxx/libcxx-3.9.0.ebuild
17 +++ b/sys-libs/libcxx/libcxx-3.9.0.ebuild
18 @@ -102,6 +102,28 @@ multilib_src_configure() {
19 cxxabi_incs="${gcc_inc};${gcc_inc}/${CHOST}"
20 fi
21
22 + # we want -lgcc_s for unwinder, and for compiler runtime when using
23 + # gcc, clang with gcc runtime (or any unknown compiler)
24 + local extra_libs=() want_gcc_s=ON
25 + if use libunwind; then
26 + # work-around missing -lunwind upstream
27 + extra_libs+=( -lunwind )
28 + # if we're using libunwind and clang with compiler-rt, we want
29 + # to link to compiler-rt instead of -lgcc_s
30 + if tc-is-clang; then
31 + # get the full library list out of 'pretend mode'
32 + # and grep it for libclang_rt references
33 + local args=( $($(tc-getCC) -### -x c - 2>&1 | tail -n 1) )
34 + local i
35 + for i in "${args[@]}"; do
36 + if [[ ${i} == *libclang_rt* ]]; then
37 + want_gcc_s=OFF
38 + extra_libs+=( "${i}" )
39 + fi
40 + done
41 + fi
42 + fi
43 +
44 local libdir=$(get_libdir)
45 local mycmakeargs=(
46 # LLVM_LIBDIR_SUFFIX is used to find CMake files
47 @@ -115,10 +137,11 @@ multilib_src_configure() {
48 # we're using our own mechanism for generating linker scripts
49 -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
50 -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
51 - -DLIBCXX_HAS_GCC_S_LIB=$(usex !libunwind)
52 + -DLIBCXX_HAS_GCC_S_LIB=${want_gcc_s}
53 -DLIBCXX_INCLUDE_TESTS=$(usex test)
54 - -DCMAKE_SHARED_LINKER_FLAGS=$(usex libunwind "-lunwind" "")
55 + -DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}"
56 )
57 +
58 if use test; then
59 mycmakeargs+=(
60 # this can be any directory, it just needs to exist...
61
62 diff --git a/sys-libs/libcxx/libcxx-9999.ebuild b/sys-libs/libcxx/libcxx-9999.ebuild
63 index bbc218b..3beacf0 100644
64 --- a/sys-libs/libcxx/libcxx-9999.ebuild
65 +++ b/sys-libs/libcxx/libcxx-9999.ebuild
66 @@ -98,6 +98,28 @@ multilib_src_configure() {
67 cxxabi_incs="${gcc_inc};${gcc_inc}/${CHOST}"
68 fi
69
70 + # we want -lgcc_s for unwinder, and for compiler runtime when using
71 + # gcc, clang with gcc runtime (or any unknown compiler)
72 + local extra_libs=() want_gcc_s=ON
73 + if use libunwind; then
74 + # work-around missing -lunwind upstream
75 + extra_libs+=( -lunwind )
76 + # if we're using libunwind and clang with compiler-rt, we want
77 + # to link to compiler-rt instead of -lgcc_s
78 + if tc-is-clang; then
79 + # get the full library list out of 'pretend mode'
80 + # and grep it for libclang_rt references
81 + local args=( $($(tc-getCC) -### -x c - 2>&1 | tail -n 1) )
82 + local i
83 + for i in "${args[@]}"; do
84 + if [[ ${i} == *libclang_rt* ]]; then
85 + want_gcc_s=OFF
86 + extra_libs+=( "${i}" )
87 + fi
88 + done
89 + fi
90 + fi
91 +
92 local libdir=$(get_libdir)
93 local mycmakeargs=(
94 # LLVM_LIBDIR_SUFFIX is used to find CMake files
95 @@ -111,10 +133,11 @@ multilib_src_configure() {
96 # we're using our own mechanism for generating linker scripts
97 -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
98 -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
99 - -DLIBCXX_HAS_GCC_S_LIB=$(usex !libunwind)
100 + -DLIBCXX_HAS_GCC_S_LIB=${want_gcc_s}
101 -DLIBCXX_INCLUDE_TESTS=$(usex test)
102 - -DCMAKE_SHARED_LINKER_FLAGS=$(usex libunwind "-lunwind" "")
103 + -DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}"
104 )
105 +
106 if use test; then
107 mycmakeargs+=(
108 # this can be any directory, it just needs to exist...