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: Wed, 04 Mar 2020 16:25:06
Message-Id: 1583339085.7dd6f16cfcd42d8b59cd621646e57c5ea3b4fa64.mgorny@gentoo
1 commit: 7dd6f16cfcd42d8b59cd621646e57c5ea3b4fa64
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Wed Mar 4 13:56:43 2020 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Mar 4 16:24:45 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7dd6f16c
7
8 sys-libs/libcxx: Bump to 10.0.0rc3
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 sys-libs/libcxx/Manifest | 1 +
13 sys-libs/libcxx/libcxx-10.0.0_rc3.ebuild | 206 +++++++++++++++++++++++++++++++
14 2 files changed, 207 insertions(+)
15
16 diff --git a/sys-libs/libcxx/Manifest b/sys-libs/libcxx/Manifest
17 index 732b68c7fa4..19031a3bc4e 100644
18 --- a/sys-libs/libcxx/Manifest
19 +++ b/sys-libs/libcxx/Manifest
20 @@ -2,4 +2,5 @@ DIST libcxx-7.1.0.src.tar.xz 1638448 BLAKE2B eca192e03f839f4323e3c37beba2e6daaf9
21 DIST libcxx-8.0.1.src.tar.xz 1739524 BLAKE2B 6e641cb6bda0de12c8408d3ab33f627389ac014aa65b3391c870aa96ffd347784e6b70b953bd1ee8eba56554e0f78a723ab77b9dba5f85e6219e2b95ca50c160 SHA512 75749d08b2b343c6f5f9aefb04be63e42f6d12efc51101d3647ed6f70c7a6d050afb3ab2f3636eae78cb523f5844de67b960a7a3145ed89ab0c7015deb14921e
22 DIST llvmorg-10.0.0-rc1.tar.gz 120755822 BLAKE2B a729d37d96ba498cb865c6f708734dccb796b2caabb69167b9aa3b0e12c788f2a5980a048b99d5603da3d26af909fb31f406b4f4743cabae56c45f829a7bf695 SHA512 27137fc700971147c00ded6787eaae9f0bcf98c938fe227a5a559b38d983736f3d086f4ff6772d802c5f48a7d97a97c293261e4af88fcb5a720693b9cb5a4f02
23 DIST llvmorg-10.0.0-rc2.tar.gz 120795019 BLAKE2B 6e701eddbd2313e777c7b37dff8455a08d3c599d01055b60afc0319373d4709deb429aac6bf9e80c4d2e2ab8ade03bf5b398b6ccd8882e4bde608d10cdbf2284 SHA512 ee571c9258a2d9fc411964f56b0b92b2e7134349ed21dbe7963eb61ef65da506e0c4f7c69259a3b6cecec23f55d24636608287ee4457ee667031e141f8f09aae
24 +DIST llvmorg-10.0.0-rc3.tar.gz 120814170 BLAKE2B 432fe0c1e74d3020a269a256e6e456cbfa0b7166dd3f86df6caf3a55e1931c022285fe8afdc4d8998c729c5471acf5308abb336782ddec2ef9b0f58d1ccb5a3c SHA512 aad1df86063612d20c48ea7046940330fe2ac572a146be22ff71d9e65fa3438184cb39a2533fc6afd1e74df26909a9f0d24ebcd7d62e74728cfd81e447f2ffbf
25 DIST llvmorg-9.0.1.tar.gz 113193320 BLAKE2B b86e405f2b8e00436045fd409fe19cdde75c797b1192c62a22b5ec75e6b4dc8e874a0f33008dc31562445e4cbe53a992b6f48c684255a6a1ef261e595b8b161f SHA512 fa88beeaae94b6d0cd9b5ba38658d0ffed8004035d7d8a4f95c3d31a709b88b581ae9bd7761333c8e5375c44b8f6be01768b5a3be901163159d7e6c43b71da59
26
27 diff --git a/sys-libs/libcxx/libcxx-10.0.0_rc3.ebuild b/sys-libs/libcxx/libcxx-10.0.0_rc3.ebuild
28 new file mode 100644
29 index 00000000000..5a3729e82ad
30 --- /dev/null
31 +++ b/sys-libs/libcxx/libcxx-10.0.0_rc3.ebuild
32 @@ -0,0 +1,206 @@
33 +# Copyright 1999-2020 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=7
37 +
38 +PYTHON_COMPAT=( python3_{6,7} )
39 +inherit cmake-multilib llvm llvm.org multiprocessing python-any-r1 \
40 + toolchain-funcs
41 +
42 +DESCRIPTION="New implementation of the C++ standard library, targeting C++11"
43 +HOMEPAGE="https://libcxx.llvm.org/"
44 +LLVM_COMPONENTS=( libcxx )
45 +llvm.org_set_globals
46 +
47 +LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
48 +SLOT="0"
49 +KEYWORDS=""
50 +IUSE="elibc_glibc elibc_musl +libcxxabi +libunwind +static-libs test"
51 +REQUIRED_USE="libunwind? ( libcxxabi )"
52 +RESTRICT="!test? ( test )"
53 +
54 +RDEPEND="
55 + libcxxabi? ( ~sys-libs/libcxxabi-${PV}[libunwind=,static-libs?,${MULTILIB_USEDEP}] )
56 + !libcxxabi? ( >=sys-devel/gcc-4.7:=[cxx] )"
57 +# llvm-6 for new lit options
58 +# clang-3.9.0 installs necessary target symlinks unconditionally
59 +# which removes the need for MULTILIB_USEDEP
60 +DEPEND="${RDEPEND}
61 + >=sys-devel/llvm-6"
62 +BDEPEND="
63 + test? ( >=sys-devel/clang-3.9.0
64 + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]') )"
65 +
66 +DOCS=( CREDITS.TXT )
67 +
68 +PATCHES=(
69 + # Add link flag "-Wl,-z,defs" to avoid underlinking; this is needed in a
70 + # out-of-tree build.
71 + "${FILESDIR}/${PN}-3.9-cmake-link-flags.patch"
72 +)
73 +
74 +# least intrusive of all
75 +CMAKE_BUILD_TYPE=RelWithDebInfo
76 +
77 +python_check_deps() {
78 + has_version "dev-python/lit[${PYTHON_USEDEP}]"
79 +}
80 +
81 +pkg_setup() {
82 + llvm_pkg_setup
83 + use test && python-any-r1_pkg_setup
84 +
85 + if ! use libcxxabi && ! tc-is-gcc ; then
86 + eerror "To build ${PN} against libsupc++, you have to use gcc. Other"
87 + eerror "compilers are not supported. Please set CC=gcc and CXX=g++"
88 + eerror "and try again."
89 + die
90 + fi
91 + if tc-is-gcc && [[ $(gcc-version) < 4.7 ]] ; then
92 + eerror "${PN} needs to be built with gcc-4.7 or later (or other"
93 + eerror "conformant compilers). Please use gcc-config to switch to"
94 + eerror "gcc-4.7 or later version."
95 + die
96 + fi
97 +}
98 +
99 +test_compiler() {
100 + $(tc-getCXX) ${CXXFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c++ - \
101 + <<<'int main() { return 0; }' &>/dev/null
102 +}
103 +
104 +src_configure() {
105 + # note: we need to do this before multilib kicks in since it will
106 + # alter the CHOST
107 + local cxxabi cxxabi_incs
108 + if use libcxxabi; then
109 + cxxabi=libcxxabi
110 + cxxabi_incs="${EPREFIX}/usr/include/libcxxabi"
111 + else
112 + local gcc_inc="${EPREFIX}/usr/lib/gcc/${CHOST}/$(gcc-fullversion)/include/g++-v$(gcc-major-version)"
113 + cxxabi=libsupc++
114 + cxxabi_incs="${gcc_inc};${gcc_inc}/${CHOST}"
115 + fi
116 +
117 + multilib-minimal_src_configure
118 +}
119 +
120 +multilib_src_configure() {
121 + # we want -lgcc_s for unwinder, and for compiler runtime when using
122 + # gcc, clang with gcc runtime (or any unknown compiler)
123 + local extra_libs=() want_gcc_s=ON want_compiler_rt=OFF
124 + if use libunwind; then
125 + # work-around missing -lunwind upstream
126 + extra_libs+=( -lunwind )
127 + # if we're using libunwind and clang with compiler-rt, we want
128 + # to link to compiler-rt instead of -lgcc_s
129 + if tc-is-clang; then
130 + local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \
131 + ${LDFLAGS} -print-libgcc-file-name)
132 + if [[ ${compiler_rt} == *libclang_rt* ]]; then
133 + want_gcc_s=OFF
134 + want_compiler_rt=ON
135 + extra_libs+=( "${compiler_rt}" )
136 + fi
137 + fi
138 + fi
139 +
140 + # bootstrap: cmake is unhappy if compiler can't link to stdlib
141 + local nolib_flags=( -nodefaultlibs -lc )
142 + if ! test_compiler; then
143 + if test_compiler "${nolib_flags[@]}"; then
144 + local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"
145 + ewarn "${CXX} seems to lack runtime, trying with ${nolib_flags[*]}"
146 + fi
147 + fi
148 +
149 + local libdir=$(get_libdir)
150 + local mycmakeargs=(
151 + -DLIBCXX_LIBDIR_SUFFIX=${libdir#lib}
152 + -DLIBCXX_ENABLE_SHARED=ON
153 + -DLIBCXX_ENABLE_STATIC=$(usex static-libs)
154 + -DLIBCXX_CXX_ABI=${cxxabi}
155 + -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi_incs}
156 + # we're using our own mechanism for generating linker scripts
157 + -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
158 + -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
159 + -DLIBCXX_HAS_GCC_S_LIB=${want_gcc_s}
160 + -DLIBCXX_INCLUDE_TESTS=$(usex test)
161 + -DLIBCXX_USE_COMPILER_RT=${want_compiler_rt}
162 + -DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}"
163 + )
164 +
165 + if use test; then
166 + local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
167 + local jobs=${LIT_JOBS:-$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")}
168 +
169 + [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests"
170 +
171 + mycmakeargs+=(
172 + -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
173 + -DLLVM_LIT_ARGS="-vv;-j;${jobs};--param=cxx_under_test=${clang_path}"
174 + )
175 + fi
176 + cmake-utils_src_configure
177 +}
178 +
179 +multilib_src_test() {
180 + local -x LIT_PRESERVES_TMP=1
181 + cmake-utils_src_make check-libcxx
182 +}
183 +
184 +# Usage: deps
185 +gen_ldscript() {
186 + local output_format
187 + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
188 + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
189 +
190 + cat <<-END_LDSCRIPT
191 +/* GNU ld script
192 + Include missing dependencies
193 +*/
194 +${output_format}
195 +GROUP ( $@ )
196 +END_LDSCRIPT
197 +}
198 +
199 +gen_static_ldscript() {
200 + local libdir=$(get_libdir)
201 + local cxxabi_lib=$(usex libcxxabi "libc++abi.a" "libsupc++.a")
202 +
203 + # Move it first.
204 + mv "${ED}/usr/${libdir}/libc++.a" "${ED}/usr/${libdir}/libc++_static.a" || die
205 + # Generate libc++.a ldscript for inclusion of its dependencies so that
206 + # clang++ -stdlib=libc++ -static works out of the box.
207 + local deps="libc++_static.a ${cxxabi_lib} $(usex libunwind libunwind.a libgcc_eh.a)"
208 + # On Linux/glibc it does not link without libpthread or libdl. It is
209 + # fine on FreeBSD.
210 + use elibc_glibc && deps+=" libpthread.a libdl.a"
211 +
212 + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.a" || die
213 +}
214 +
215 +gen_shared_ldscript() {
216 + local libdir=$(get_libdir)
217 + # libsupc++ doesn't have a shared version
218 + local cxxabi_lib=$(usex libcxxabi "libc++abi.so" "libsupc++.a")
219 +
220 + mv "${ED}/usr/${libdir}/libc++.so" "${ED}/usr/${libdir}/libc++_shared.so" || die
221 + local deps="libc++_shared.so ${cxxabi_lib} $(usex libunwind libunwind.so libgcc_s.so)"
222 +
223 + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.so" || die
224 +}
225 +
226 +multilib_src_install() {
227 + cmake-utils_src_install
228 + gen_shared_ldscript
229 + use static-libs && gen_static_ldscript
230 +}
231 +
232 +pkg_postinst() {
233 + elog "This package (${PN}) is mainly intended as a replacement for the C++"
234 + elog "standard library when using clang."
235 + elog "To use it, instead of libstdc++, use:"
236 + elog " clang++ -stdlib=libc++"
237 + elog "to compile your C++ programs."
238 +}