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: Mon, 05 Jul 2021 22:54:19
Message-Id: 1625525638.64cac03b95e873f97f5ee194886dc699a793e706.mgorny@gentoo
1 commit: 64cac03b95e873f97f5ee194886dc699a793e706
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jul 5 20:59:57 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Mon Jul 5 22:53:58 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=64cac03b
7
8 sys-libs/libcxx: Bump to 12.0.1-rc4
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 sys-libs/libcxx/Manifest | 1 +
13 sys-libs/libcxx/libcxx-12.0.1_rc4.ebuild | 212 +++++++++++++++++++++++++++++++
14 2 files changed, 213 insertions(+)
15
16 diff --git a/sys-libs/libcxx/Manifest b/sys-libs/libcxx/Manifest
17 index 3d502aefa02..2170cd12357 100644
18 --- a/sys-libs/libcxx/Manifest
19 +++ b/sys-libs/libcxx/Manifest
20 @@ -7,3 +7,4 @@ DIST llvmorg-11.1.0.tar.gz 122776532 BLAKE2B ca842ff4afff8f44c82b5e7383962a9c45c
21 DIST llvmorg-12.0.0.tar.gz 134226215 BLAKE2B f9c3ba8c58571855caa4f206fd285c9b5be66672fb0814cb8bc0964a051f57f5d35013aa1e27cbda502652b37df1ec23474129109e76a42066847860db441dbe SHA512 0cff02155c5ac0d6db2b72d60d9819d5b5dd859663b45f721b1c7540239c2fceb1f57d9173f6870c49de851c242ed8e85c5c6d6577a1f8092a7c5dcd12513b26
22 DIST llvmorg-12.0.1-rc1.tar.gz 134261735 BLAKE2B d29510495641c06e6d7a5ac165e6d34e0ba15d1a5b786534e186e341e3a0550cdd3d8a2b61deb3e2bf44c0b0ff8561224bf7f8cebc2ce9415639cb67ceae289e SHA512 4595a26df56eed7d5941240fe92116ad2f1c61639f0f464697c2c530a601347032fbad6802d1fa915ced8574c7b30ef05bc8c0be737784c844d3860892817e6e
23 DIST llvmorg-12.0.1-rc2.tar.gz 134274147 BLAKE2B 2d3f6ce8d5239cf2e5ea52f4b9020d6a8fedb8d6a4df02ca0d8e4398237f4eb967865e1e65570d16cd191865281b9619a63905c1e1c47b31183b881e97e49867 SHA512 cdebb954016dc92251cd9c6281804f7a36e7bc8c6f101a6817d96cc121aba4d361fb99501c259409a29c90d7749b224be670c41177fe43fa64b730ff294831b8
24 +DIST llvmorg-12.0.1-rc4.tar.gz 134278617 BLAKE2B d407421c7244bb125151e69e2a341f1af0a0cf8c1fda3b8ae3d4114c3a285d6307620bbf82b22d96d2c7782b37b0975e87be80c24e3ce1fdc71152734be1e8f8 SHA512 1a2c18435a970491eb9fc9381ba66af726e17dcbd5bf6774f9341b1e82fd35f2e5686844743f5317ebd2106b902c39e09aa98102e58a86e290b29102241c949f
25
26 diff --git a/sys-libs/libcxx/libcxx-12.0.1_rc4.ebuild b/sys-libs/libcxx/libcxx-12.0.1_rc4.ebuild
27 new file mode 100644
28 index 00000000000..861d92b62c2
29 --- /dev/null
30 +++ b/sys-libs/libcxx/libcxx-12.0.1_rc4.ebuild
31 @@ -0,0 +1,212 @@
32 +# Copyright 1999-2021 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=7
36 +
37 +CMAKE_ECLASS=cmake
38 +PYTHON_COMPAT=( python3_{7..9} )
39 +inherit cmake-multilib llvm llvm.org python-any-r1 toolchain-funcs
40 +
41 +DESCRIPTION="New implementation of the C++ standard library, targeting C++11"
42 +HOMEPAGE="https://libcxx.llvm.org/"
43 +
44 +LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
45 +SLOT="0"
46 +KEYWORDS=""
47 +IUSE="elibc_glibc elibc_musl +libcxxabi +libunwind static-libs test"
48 +REQUIRED_USE="libunwind? ( libcxxabi )"
49 +RESTRICT="!test? ( test )"
50 +
51 +RDEPEND="
52 + libcxxabi? ( ~sys-libs/libcxxabi-${PV}[libunwind=,static-libs?,${MULTILIB_USEDEP}] )
53 + !libcxxabi? ( >=sys-devel/gcc-4.7:=[cxx] )"
54 +# llvm-6 for new lit options
55 +# clang-3.9.0 installs necessary target symlinks unconditionally
56 +# which removes the need for MULTILIB_USEDEP
57 +DEPEND="${RDEPEND}
58 + >=sys-devel/llvm-6"
59 +BDEPEND="
60 + test? (
61 + >=dev-util/cmake-3.16
62 + >=sys-devel/clang-3.9.0
63 + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]')
64 + )"
65 +
66 +DOCS=( CREDITS.TXT )
67 +
68 +LLVM_COMPONENTS=( libcxx{,abi} llvm/{cmake/modules,utils/llvm-lit} )
69 +LLVM_PATCHSET=9999-1
70 +llvm.org_set_globals
71 +
72 +python_check_deps() {
73 + has_version "dev-python/lit[${PYTHON_USEDEP}]"
74 +}
75 +
76 +pkg_setup() {
77 + # Darwin Prefix builds do not have llvm installed yet, so rely on
78 + # bootstrap-prefix to set the appropriate path vars to LLVM instead
79 + # of using llvm_pkg_setup.
80 + if [[ ${CHOST} != *-darwin* ]] || has_version dev-lang/llvm; then
81 + llvm_pkg_setup
82 + fi
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 +}
92 +
93 +test_compiler() {
94 + $(tc-getCXX) ${CXXFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c++ - \
95 + <<<'int main() { return 0; }' &>/dev/null
96 +}
97 +
98 +src_configure() {
99 + # note: we need to do this before multilib kicks in since it will
100 + # alter the CHOST
101 + local cxxabi cxxabi_incs
102 + if use libcxxabi; then
103 + cxxabi=libcxxabi
104 + cxxabi_incs="${EPREFIX}/usr/include/libcxxabi"
105 + else
106 + local gcc_inc="${EPREFIX}/usr/lib/gcc/${CHOST}/$(gcc-fullversion)/include/g++-v$(gcc-major-version)"
107 + cxxabi=libsupc++
108 + cxxabi_incs="${gcc_inc};${gcc_inc}/${CHOST}"
109 + fi
110 +
111 + multilib-minimal_src_configure
112 +}
113 +
114 +multilib_src_configure() {
115 + # we want -lgcc_s for unwinder, and for compiler runtime when using
116 + # gcc, clang with gcc runtime (or any unknown compiler)
117 + local extra_libs=() want_gcc_s=ON want_compiler_rt=OFF
118 + if use libunwind; then
119 + # work-around missing -lunwind upstream
120 + extra_libs+=( -lunwind )
121 + # if we're using libunwind and clang with compiler-rt, we want
122 + # to link to compiler-rt instead of -lgcc_s
123 + if tc-is-clang; then
124 + local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \
125 + ${LDFLAGS} -print-libgcc-file-name)
126 + if [[ ${compiler_rt} == *libclang_rt* ]]; then
127 + want_gcc_s=OFF
128 + want_compiler_rt=ON
129 + extra_libs+=( "${compiler_rt}" )
130 + fi
131 + fi
132 + elif [[ ${CHOST} == *-darwin* ]] && tc-is-clang; then
133 + # clang-based darwin prefix disables libunwind useflag during
134 + # bootstrap, because libunwind is not in the prefix yet.
135 + # override the default, though, because clang based libcxx
136 + # should never use gcc_s on Darwin.
137 + want_gcc_s=OFF
138 + # compiler_rt is not available in EPREFIX during bootstrap,
139 + # so we cannot link to it yet anyway, so keep the defaults
140 + # of want_compiler_rt=OFF and extra_libs=()
141 + fi
142 +
143 + # bootstrap: cmake is unhappy if compiler can't link to stdlib
144 + local nolib_flags=( -nodefaultlibs -lc )
145 + if ! test_compiler; then
146 + if test_compiler "${nolib_flags[@]}"; then
147 + local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"
148 + ewarn "${CXX} seems to lack runtime, trying with ${nolib_flags[*]}"
149 + fi
150 + fi
151 +
152 + local libdir=$(get_libdir)
153 + local mycmakeargs=(
154 + -DLIBCXX_LIBDIR_SUFFIX=${libdir#lib}
155 + -DLIBCXX_ENABLE_SHARED=ON
156 + -DLIBCXX_ENABLE_STATIC=$(usex static-libs)
157 + -DLIBCXX_CXX_ABI=${cxxabi}
158 + -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi_incs}
159 + # we're using our own mechanism for generating linker scripts
160 + -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
161 + -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
162 + -DLIBCXX_HAS_GCC_S_LIB=${want_gcc_s}
163 + -DLIBCXX_INCLUDE_TESTS=$(usex test)
164 + -DLIBCXX_USE_COMPILER_RT=${want_compiler_rt}
165 + -DLIBCXX_HAS_ATOMIC_LIB=${want_gcc_s}
166 + -DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}"
167 + )
168 +
169 + if use test; then
170 + local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
171 + [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests"
172 +
173 + mycmakeargs+=(
174 + -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
175 + -DLLVM_LIT_ARGS="$(get_lit_flags);--param=cxx_under_test=${clang_path}"
176 + -DPython3_EXECUTABLE="${PYTHON}"
177 + )
178 + fi
179 + cmake_src_configure
180 +}
181 +
182 +multilib_src_test() {
183 + local -x LIT_PRESERVES_TMP=1
184 + cmake_build check-cxx
185 +}
186 +
187 +# Usage: deps
188 +gen_ldscript() {
189 + local output_format
190 + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
191 + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
192 +
193 + cat <<-END_LDSCRIPT
194 +/* GNU ld script
195 + Include missing dependencies
196 +*/
197 +${output_format}
198 +GROUP ( $@ )
199 +END_LDSCRIPT
200 +}
201 +
202 +gen_static_ldscript() {
203 + local libdir=$(get_libdir)
204 + local cxxabi_lib=$(usex libcxxabi "libc++abi.a" "libsupc++.a")
205 +
206 + # Move it first.
207 + mv "${ED}/usr/${libdir}/libc++.a" "${ED}/usr/${libdir}/libc++_static.a" || die
208 + # Generate libc++.a ldscript for inclusion of its dependencies so that
209 + # clang++ -stdlib=libc++ -static works out of the box.
210 + local deps="libc++_static.a ${cxxabi_lib} $(usex libunwind libunwind.a libgcc_eh.a)"
211 + # On Linux/glibc it does not link without libpthread or libdl. It is
212 + # fine on FreeBSD.
213 + use elibc_glibc && deps+=" libpthread.a libdl.a"
214 +
215 + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.a" || die
216 +}
217 +
218 +gen_shared_ldscript() {
219 + local libdir=$(get_libdir)
220 + # libsupc++ doesn't have a shared version
221 + local cxxabi_lib=$(usex libcxxabi "libc++abi.so" "libsupc++.a")
222 +
223 + mv "${ED}/usr/${libdir}/libc++.so" "${ED}/usr/${libdir}/libc++_shared.so" || die
224 + local deps="libc++_shared.so ${cxxabi_lib} $(usex libunwind libunwind.so libgcc_s.so)"
225 +
226 + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.so" || die
227 +}
228 +
229 +multilib_src_install() {
230 + cmake_src_install
231 + if [[ ${CHOST} != *-darwin* ]] ; then
232 + gen_shared_ldscript
233 + use static-libs && gen_static_ldscript
234 + fi
235 +}
236 +
237 +pkg_postinst() {
238 + elog "This package (${PN}) is mainly intended as a replacement for the C++"
239 + elog "standard library when using clang."
240 + elog "To use it, instead of libstdc++, use:"
241 + elog " clang++ -stdlib=libc++"
242 + elog "to compile your C++ programs."
243 +}