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