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, 09 Jul 2021 14:44:48
Message-Id: 1625841851.13e807474aca9341f51b4d8932ac999ba76dbc1b.mgorny@gentoo
1 commit: 13e807474aca9341f51b4d8932ac999ba76dbc1b
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jul 9 07:39:20 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Jul 9 14:44:11 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=13e80747
7
8 sys-libs/libcxx: Bump to 12.0.1 (final)
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 sys-libs/libcxx/Manifest | 2 +
13 sys-libs/libcxx/libcxx-12.0.1.ebuild | 212 +++++++++++++++++++++++++++++++++++
14 2 files changed, 214 insertions(+)
15
16 diff --git a/sys-libs/libcxx/Manifest b/sys-libs/libcxx/Manifest
17 index 3fd830b40d3..4f62846c44d 100644
18 --- a/sys-libs/libcxx/Manifest
19 +++ b/sys-libs/libcxx/Manifest
20 @@ -2,8 +2,10 @@ DIST llvm-gentoo-patchset-10.0.1-1.tar.xz 8320 BLAKE2B 1b7ea7669586e08fece0efcf0
21 DIST llvm-gentoo-patchset-11.1.0-1.tar.xz 4032 BLAKE2B e69138a422e315b31a3d9c11faa4ae1ddf1bf9092cee2db0de4d2adef81fd802973488293aab48b764402b51996893b17ca03249ef4620848a576d1f6cdb9698 SHA512 e1c5504dab6c5db9fdf4addfeb12316f22d0258717ba551a9b7b3ba37919491fb6011ac5cca1e793b7509d5c1c186bc6bc4213f7d6155d190612492b216f979b
22 DIST llvm-gentoo-patchset-12.0.0-1.tar.xz 6364 BLAKE2B bcf96dad8300cdc3e1f416cb90935ae3b1359efc5687118b5a9bbee25de7087a266250f50c6f2abd18f4efeeec19354f59513c8fdd1d61c2cfc8cc2f0115e514 SHA512 76201e169f71a8d568365ffeafcfd37138e74b0536826f47eb6ce89c2280586f10426917e851f99bfb20477cd828cc40daa8cb7a62959981620fbd81e1b22ee1
23 DIST llvm-gentoo-patchset-12.0.1-rc4-1.tar.xz 4776 BLAKE2B 2ae7994089922805c9b82268e4c73d9a70edbb8860af7e593da904c673836713fae5fd7626ef1dbfe813c66f4da8308b26b4cd0bd977471834d49512690afa39 SHA512 386668fd338ee24677c51379c69a73b6a749bd4cf72bf59f9cb800b1ac19938275d64d0c23e431c80ed5e572d86d94bbb030241c43cbf541801cdc672f5911c1
24 +DIST llvm-gentoo-patchset-12.0.1.tar.xz 5280 BLAKE2B 963d005bc7b636570be90eb841ac5bcaeb927538cc7de27683167111a17d6496677c7517de2ecfaf14b5d8ac22bad357be490b8a2ed9aba502fd5f447ecc99e9 SHA512 fc7c38e671555751650299c3a8bee44d5c7f26e11b68d5538c507fb7fe9ff2d349bdcd43bce90a448a747f082d523b3849d6bcda5e3ae2e998edcb926d6aa249
25 DIST llvm-gentoo-patchset-9999-1.tar.xz 4032 BLAKE2B b9413484dafed8ae0c68c2c164b45fd07bb8d5d0898f03abe118fd2120ffcb1fb6c949de9649a97c2e8105f24b9d131a725c67c0a502ca4d4d192c1a0d65f49d SHA512 e64449eeaf756c5bd945109937b84ba4bd8a015222bd792d39cf3947871e87571a4ca57814790e51544cb05ad4c2d1f044e818e4caaac7c2e2a02cb1aa290fcc
26 DIST llvmorg-10.0.1.tar.gz 120880730 BLAKE2B 30f19f56c4d1f6abcda5fec76256219d1e3c8a6ff1a1f152f94bfe362c07884339fe571ff7fe903ed3b3deb150b2fa868c387887a0dea2930dc08b81db71a5b1 SHA512 48078fff9293a87f1a973f3348f79506f04c3da774295f5eb67d74dd2d1aa94f0973f8ced3f4ab9e8339902071f82c603b43d5608ad7227046c4da769c5d2151
27 DIST llvmorg-11.1.0.tar.gz 122776532 BLAKE2B ca842ff4afff8f44c82b5e7383962a9c45ca1c93b64fa4c6ebcd70a1d3849dbad2b8e4e24fba02d144c6266d7fab3607ebc6999b28c229cb35256cf40f26a985 SHA512 9a8ce022a935eed42fa71a224f2a207122aadcbef58ee855fdb4825f879e7d028e4dcff22c19b9d336db1c8bf63fb84372d44981acf84615f757e54306c92b81
28 DIST llvmorg-12.0.0.tar.gz 134226215 BLAKE2B f9c3ba8c58571855caa4f206fd285c9b5be66672fb0814cb8bc0964a051f57f5d35013aa1e27cbda502652b37df1ec23474129109e76a42066847860db441dbe SHA512 0cff02155c5ac0d6db2b72d60d9819d5b5dd859663b45f721b1c7540239c2fceb1f57d9173f6870c49de851c242ed8e85c5c6d6577a1f8092a7c5dcd12513b26
29 DIST llvmorg-12.0.1-rc4.tar.gz 134278617 BLAKE2B d407421c7244bb125151e69e2a341f1af0a0cf8c1fda3b8ae3d4114c3a285d6307620bbf82b22d96d2c7782b37b0975e87be80c24e3ce1fdc71152734be1e8f8 SHA512 1a2c18435a970491eb9fc9381ba66af726e17dcbd5bf6774f9341b1e82fd35f2e5686844743f5317ebd2106b902c39e09aa98102e58a86e290b29102241c949f
30 +DIST llvmorg-12.0.1.tar.gz 134259748 BLAKE2B f41de787bc73ff2edfda1b22cc8602be6f65f37dd9e4c8888533cfa8c3ccdcf4f108aaab9de23ab0ab987966eb160f2a553a0bdff99461e71ddd5bfcd086090d SHA512 6eb0dc18e2c25935fabfdfc48b0114be0939158dfdef7b85b395fe2e71042672446af0e68750aae003c9847d10d1f63316fe95d3df738d18f249174292b1b9e1
31
32 diff --git a/sys-libs/libcxx/libcxx-12.0.1.ebuild b/sys-libs/libcxx/libcxx-12.0.1.ebuild
33 new file mode 100644
34 index 00000000000..bf4009dbd8f
35 --- /dev/null
36 +++ b/sys-libs/libcxx/libcxx-12.0.1.ebuild
37 @@ -0,0 +1,212 @@
38 +# Copyright 1999-2021 Gentoo Authors
39 +# Distributed under the terms of the GNU General Public License v2
40 +
41 +EAPI=7
42 +
43 +CMAKE_ECLASS=cmake
44 +PYTHON_COMPAT=( python3_{8..10} )
45 +inherit cmake-multilib llvm llvm.org python-any-r1 toolchain-funcs
46 +
47 +DESCRIPTION="New implementation of the C++ standard library, targeting C++11"
48 +HOMEPAGE="https://libcxx.llvm.org/"
49 +
50 +LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
51 +SLOT="0"
52 +KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86 ~x64-macos"
53 +IUSE="elibc_glibc elibc_musl +libcxxabi +libunwind static-libs test"
54 +REQUIRED_USE="libunwind? ( libcxxabi )"
55 +RESTRICT="!test? ( test )"
56 +
57 +RDEPEND="
58 + libcxxabi? ( ~sys-libs/libcxxabi-${PV}[libunwind=,static-libs?,${MULTILIB_USEDEP}] )
59 + !libcxxabi? ( >=sys-devel/gcc-4.7:=[cxx] )"
60 +# llvm-6 for new lit options
61 +# clang-3.9.0 installs necessary target symlinks unconditionally
62 +# which removes the need for MULTILIB_USEDEP
63 +DEPEND="${RDEPEND}
64 + >=sys-devel/llvm-6"
65 +BDEPEND="
66 + test? (
67 + >=dev-util/cmake-3.16
68 + >=sys-devel/clang-3.9.0
69 + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]')
70 + )"
71 +
72 +DOCS=( CREDITS.TXT )
73 +
74 +LLVM_COMPONENTS=( libcxx{,abi} llvm/{cmake/modules,utils/llvm-lit} )
75 +LLVM_PATCHSET=12.0.1
76 +llvm.org_set_globals
77 +
78 +python_check_deps() {
79 + has_version "dev-python/lit[${PYTHON_USEDEP}]"
80 +}
81 +
82 +pkg_setup() {
83 + # Darwin Prefix builds do not have llvm installed yet, so rely on
84 + # bootstrap-prefix to set the appropriate path vars to LLVM instead
85 + # of using llvm_pkg_setup.
86 + if [[ ${CHOST} != *-darwin* ]] || has_version dev-lang/llvm; then
87 + llvm_pkg_setup
88 + fi
89 + use test && python-any-r1_pkg_setup
90 +
91 + if ! use libcxxabi && ! tc-is-gcc ; then
92 + eerror "To build ${PN} against libsupc++, you have to use gcc. Other"
93 + eerror "compilers are not supported. Please set CC=gcc and CXX=g++"
94 + eerror "and try again."
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 + elif [[ ${CHOST} == *-darwin* ]] && tc-is-clang; then
139 + # clang-based darwin prefix disables libunwind useflag during
140 + # bootstrap, because libunwind is not in the prefix yet.
141 + # override the default, though, because clang based libcxx
142 + # should never use gcc_s on Darwin.
143 + want_gcc_s=OFF
144 + # compiler_rt is not available in EPREFIX during bootstrap,
145 + # so we cannot link to it yet anyway, so keep the defaults
146 + # of want_compiler_rt=OFF and extra_libs=()
147 + fi
148 +
149 + # bootstrap: cmake is unhappy if compiler can't link to stdlib
150 + local nolib_flags=( -nodefaultlibs -lc )
151 + if ! test_compiler; then
152 + if test_compiler "${nolib_flags[@]}"; then
153 + local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"
154 + ewarn "${CXX} seems to lack runtime, trying with ${nolib_flags[*]}"
155 + fi
156 + fi
157 +
158 + local libdir=$(get_libdir)
159 + local mycmakeargs=(
160 + -DLIBCXX_LIBDIR_SUFFIX=${libdir#lib}
161 + -DLIBCXX_ENABLE_SHARED=ON
162 + -DLIBCXX_ENABLE_STATIC=$(usex static-libs)
163 + -DLIBCXX_CXX_ABI=${cxxabi}
164 + -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi_incs}
165 + # we're using our own mechanism for generating linker scripts
166 + -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
167 + -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
168 + -DLIBCXX_HAS_GCC_S_LIB=${want_gcc_s}
169 + -DLIBCXX_INCLUDE_TESTS=$(usex test)
170 + -DLIBCXX_USE_COMPILER_RT=${want_compiler_rt}
171 + -DLIBCXX_HAS_ATOMIC_LIB=${want_gcc_s}
172 + -DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}"
173 + )
174 +
175 + if use test; then
176 + local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
177 + [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests"
178 +
179 + mycmakeargs+=(
180 + -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
181 + -DLLVM_LIT_ARGS="$(get_lit_flags);--param=cxx_under_test=${clang_path}"
182 + -DPython3_EXECUTABLE="${PYTHON}"
183 + )
184 + fi
185 + cmake_src_configure
186 +}
187 +
188 +multilib_src_test() {
189 + local -x LIT_PRESERVES_TMP=1
190 + cmake_build check-cxx
191 +}
192 +
193 +# Usage: deps
194 +gen_ldscript() {
195 + local output_format
196 + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
197 + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
198 +
199 + cat <<-END_LDSCRIPT
200 +/* GNU ld script
201 + Include missing dependencies
202 +*/
203 +${output_format}
204 +GROUP ( $@ )
205 +END_LDSCRIPT
206 +}
207 +
208 +gen_static_ldscript() {
209 + local libdir=$(get_libdir)
210 + local cxxabi_lib=$(usex libcxxabi "libc++abi.a" "libsupc++.a")
211 +
212 + # Move it first.
213 + mv "${ED}/usr/${libdir}/libc++.a" "${ED}/usr/${libdir}/libc++_static.a" || die
214 + # Generate libc++.a ldscript for inclusion of its dependencies so that
215 + # clang++ -stdlib=libc++ -static works out of the box.
216 + local deps="libc++_static.a ${cxxabi_lib} $(usex libunwind libunwind.a libgcc_eh.a)"
217 + # On Linux/glibc it does not link without libpthread or libdl. It is
218 + # fine on FreeBSD.
219 + use elibc_glibc && deps+=" libpthread.a libdl.a"
220 +
221 + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.a" || die
222 +}
223 +
224 +gen_shared_ldscript() {
225 + local libdir=$(get_libdir)
226 + # libsupc++ doesn't have a shared version
227 + local cxxabi_lib=$(usex libcxxabi "libc++abi.so" "libsupc++.a")
228 +
229 + mv "${ED}/usr/${libdir}/libc++.so" "${ED}/usr/${libdir}/libc++_shared.so" || die
230 + local deps="libc++_shared.so ${cxxabi_lib} $(usex libunwind libunwind.so libgcc_s.so)"
231 +
232 + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.so" || die
233 +}
234 +
235 +multilib_src_install() {
236 + cmake_src_install
237 + if [[ ${CHOST} != *-darwin* ]] ; then
238 + gen_shared_ldscript
239 + use static-libs && gen_static_ldscript
240 + fi
241 +}
242 +
243 +pkg_postinst() {
244 + elog "This package (${PN}) is mainly intended as a replacement for the C++"
245 + elog "standard library when using clang."
246 + elog "To use it, instead of libstdc++, use:"
247 + elog " clang++ -stdlib=libc++"
248 + elog "to compile your C++ programs."
249 +}