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: Sat, 25 Jun 2022 13:08:30
Message-Id: 1656162451.479d0faa2e053c08126c400975061ec1a1c190ae.mgorny@gentoo
1 commit: 479d0faa2e053c08126c400975061ec1a1c190ae
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jun 25 11:19:25 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sat Jun 25 13:07:31 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=479d0faa
7
8 sys-libs/libcxx: Bump to 14.0.6
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 sys-libs/libcxx/Manifest | 3 +
13 sys-libs/libcxx/libcxx-14.0.6.ebuild | 228 +++++++++++++++++++++++++++++++++++
14 2 files changed, 231 insertions(+)
15
16 diff --git a/sys-libs/libcxx/Manifest b/sys-libs/libcxx/Manifest
17 index 6281aaebc7d4..9688cf1bc0bb 100644
18 --- a/sys-libs/libcxx/Manifest
19 +++ b/sys-libs/libcxx/Manifest
20 @@ -4,9 +4,12 @@ DIST llvm-gentoo-patchset-14.0.1.tar.xz 4724 BLAKE2B 2689298c687fa8b5fa2545afccc
21 DIST llvm-gentoo-patchset-14.0.3.tar.xz 5492 BLAKE2B 48a46d50a81c5572d1573c6923bc404b198f74ee8587a928e0858553dac37f7fa39cc969d72b938ef3d2f04f6872f9e2e2478821ab90c657ecbbacb3f7d99d7a SHA512 b917b549de6d46cd7aab3e59b888b5e5ffb955435b33d6538be2f31dc30217a24740a673cb6bb661087c245121edb079052b179badaf70b86b985ca69b3652a6
22 DIST llvm-gentoo-patchset-14.0.4.tar.xz 4072 BLAKE2B cbd8804e33069ca2709503931545a57cfd33c06f28696d876d499285e9add9487a069495b756bbb94d29a162c39ece651defddd302e3ac523c5484c09fb3d2ea SHA512 db00268d01e7ec99b907321384c02468a53020386ee4fc819fabfc1cd0784323044931dac42437968d5fd37190da1b9f8f847af553a65a0595c33cecfd82c293
23 DIST llvm-gentoo-patchset-14.0.5.tar.xz 4072 BLAKE2B c35072f70831d5e3c9f7236f8473b098e6b8da4f27ce6a382ff4d3cd235837b25b9a1bc1e406ce0d3feb05e4d1e1c8bf141ff8f218568d5a5339fd1092f86b62 SHA512 646e0515a6cf1aae86f05db4797d7af6e3c9b8a6070f41cbd36535944029e0e5888128e33d8c44af22b5bb9ccba392b9dfeabc7708e5eab11858edefced6b68d
24 +DIST llvm-gentoo-patchset-14.0.6.tar.xz 4544 BLAKE2B b613582fa048837303168a2d62835688128621236022ca6c232293cb2e4549174ef256e7dcd8303bfef6d5456d0459ddb2cbda4a4d323b82901da4c16f15dcc4 SHA512 fb89a3186c5bffdc6245ed103d79fe6802a86986bd43891b7e128955bd546dffcb5b4083ac9e7966f67ce8dd82322756a11428ab4c62d21f012d614062adab35
25 DIST llvm-gentoo-patchset-9999-1.tar.xz 4032 BLAKE2B b9413484dafed8ae0c68c2c164b45fd07bb8d5d0898f03abe118fd2120ffcb1fb6c949de9649a97c2e8105f24b9d131a725c67c0a502ca4d4d192c1a0d65f49d SHA512 e64449eeaf756c5bd945109937b84ba4bd8a015222bd792d39cf3947871e87571a4ca57814790e51544cb05ad4c2d1f044e818e4caaac7c2e2a02cb1aa290fcc
26 DIST llvm-project-14.0.5.src.tar.xz 105617748 BLAKE2B a68a6eb58302702f560d1204eb97d34b695eb5df417ccefb50117dbd641ba3c3dda9e64c04506e646dd40c1151eb60b12843e206996ef74b35b2841b8dabafda SHA512 db5a7ea1149988c2aab4ed634f14e00bb9a8042089350b811f875e295ced7b5add80a11b91cad80ba0ba9801261502644a720021506483c14dfb1bc24a7f54d5
27 DIST llvm-project-14.0.5.src.tar.xz.sig 566 BLAKE2B ecf66df5d0acb382c9d441aee053404254fa4087d57130b04bb496af9cbb71c59e82f0938f44953d7fd777524781d13d1327b6c64065cf45b177bc3ea0e5c3f2 SHA512 a785e38f11863a46de8766ff4495a73173479cdbd95dc539804b0381a7a834a409713dbaf441272a9cc2963a3c7015c95dc6f0dcfa745e8d6047b1ad5feacff7
28 +DIST llvm-project-14.0.6.src.tar.xz 105618228 BLAKE2B ee67c5407df8cef493b9c0004f15e428f22a536a17e5f4e3eb29a003b8a8ec0abe0fa3e072591161d5f30ef7d8867c1ce34d1b341ad858e93c00263499941a99 SHA512 6fc6eeb60fac698702d1aac495fc0161eb7216a1f8db2020af8fccec5837831f7cc20dc2a169bf4f0b5f520748280b4a86621f3697d622aa58faaa45dbfaad13
29 +DIST llvm-project-14.0.6.src.tar.xz.sig 566 BLAKE2B cb658ad43d8ab6c43a5773aedadf0569c97b5ee4b1bd58eceb10e1879a30880c741c3d66bedd462c892309b688fb7b2673115a62d1f74d71ee375a578de9547f SHA512 b4a7b368532a7a4a24376cfa7db8f6d3478f6d4446474342fc00b474ecf466330cd0f16783209263c4c72d5fc7ddedfb11b95578842e700cfb7ee0bb34cc95d6
30 DIST llvmorg-12.0.1.tar.gz 134259748 BLAKE2B f41de787bc73ff2edfda1b22cc8602be6f65f37dd9e4c8888533cfa8c3ccdcf4f108aaab9de23ab0ab987966eb160f2a553a0bdff99461e71ddd5bfcd086090d SHA512 6eb0dc18e2c25935fabfdfc48b0114be0939158dfdef7b85b395fe2e71042672446af0e68750aae003c9847d10d1f63316fe95d3df738d18f249174292b1b9e1
31 DIST llvmorg-13.0.1.tar.gz 147290251 BLAKE2B 2a44b012a672501761d0c27c6b3a315b69bfef0cd13b078a7e7d2fccc4a9c8c0f2bee0f164c4271c9106b0a99cb06e8b64986f66253b613336719fb86b82541b SHA512 9a8cb5d11964ba88b7624f19ec861fb28701f23956ea3c92f6ac644332d5f41fde97bd8933dd3ee70ed378058c252fa3a3887c8d1af90d219970c2b27691166f
32 DIST llvmorg-14.0.1.tar.gz 158074615 BLAKE2B bf80366461580058494eb101646efcd1a8b55a66818a710c2eb8c649bf88c02fe4552cecf4c1c8637a64e7cee8d644bca31aafc804765ed18f2b5e2975dd6c92 SHA512 0a15aa9cfc978a7b03a1659a2affad65ede66d280f5c12bf0beaaf194cd7bdd57ff438b5f40e64c1e1b88f368de99be349e9d30b544d2bbe4a50f0ebed3307f2
33
34 diff --git a/sys-libs/libcxx/libcxx-14.0.6.ebuild b/sys-libs/libcxx/libcxx-14.0.6.ebuild
35 new file mode 100644
36 index 000000000000..4d6be5bcc7f2
37 --- /dev/null
38 +++ b/sys-libs/libcxx/libcxx-14.0.6.ebuild
39 @@ -0,0 +1,228 @@
40 +# Copyright 1999-2022 Gentoo Authors
41 +# Distributed under the terms of the GNU General Public License v2
42 +
43 +EAPI=8
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="+libcxxabi +libunwind static-libs test"
56 +RESTRICT="!test? ( test )"
57 +REQUIRED_USE="libunwind? ( libcxxabi )"
58 +
59 +RDEPEND="
60 + libcxxabi? (
61 + ~sys-libs/libcxxabi-${PV}[libunwind=,static-libs?,${MULTILIB_USEDEP}]
62 + )
63 + !libcxxabi? ( >=sys-devel/gcc-4.7:=[cxx] )
64 +"
65 +# llvm-6 for new lit options
66 +# clang-3.9.0 installs necessary target symlinks unconditionally
67 +# which removes the need for MULTILIB_USEDEP
68 +DEPEND="
69 + ${RDEPEND}
70 + >=sys-devel/llvm-6
71 +"
72 +BDEPEND="
73 + !test? (
74 + ${PYTHON_DEPS}
75 + )
76 + test? (
77 + >=dev-util/cmake-3.16
78 + >=sys-devel/clang-3.9.0
79 + sys-devel/gdb[python]
80 + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]')
81 + )
82 +"
83 +
84 +LLVM_COMPONENTS=( runtimes libcxx{,abi} llvm/{cmake,utils/llvm-lit} cmake )
85 +LLVM_PATCHSET=${PV}
86 +llvm.org_set_globals
87 +
88 +python_check_deps() {
89 + use test || return 0
90 + has_version "dev-python/lit[${PYTHON_USEDEP}]"
91 +}
92 +
93 +pkg_setup() {
94 + # Darwin Prefix builds do not have llvm installed yet, so rely on
95 + # bootstrap-prefix to set the appropriate path vars to LLVM instead
96 + # of using llvm_pkg_setup.
97 + if [[ ${CHOST} != *-darwin* ]] || has_version dev-lang/llvm; then
98 + llvm_pkg_setup
99 + fi
100 + python-any-r1_pkg_setup
101 +
102 + if ! use libcxxabi && ! tc-is-gcc ; then
103 + eerror "To build ${PN} against libsupc++, you have to use gcc. Other"
104 + eerror "compilers are not supported. Please set CC=gcc and CXX=g++"
105 + eerror "and try again."
106 + die
107 + fi
108 +}
109 +
110 +test_compiler() {
111 + $(tc-getCXX) ${CXXFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c++ - \
112 + <<<'int main() { return 0; }' &>/dev/null
113 +}
114 +
115 +src_configure() {
116 + # note: we need to do this before multilib kicks in since it will
117 + # alter the CHOST
118 + local cxxabi cxxabi_incs
119 + if use libcxxabi; then
120 + cxxabi=system-libcxxabi
121 + cxxabi_incs="${EPREFIX}/usr/include/libcxxabi"
122 + else
123 + local gcc_inc="${EPREFIX}/usr/lib/gcc/${CHOST}/$(gcc-fullversion)/include/g++-v$(gcc-major-version)"
124 + cxxabi=libsupc++
125 + cxxabi_incs="${gcc_inc};${gcc_inc}/${CHOST}"
126 + fi
127 +
128 + multilib-minimal_src_configure
129 +}
130 +
131 +multilib_src_configure() {
132 + # we want -lgcc_s for unwinder, and for compiler runtime when using
133 + # gcc, clang with gcc runtime (or any unknown compiler)
134 + local extra_libs=() want_gcc_s=ON want_compiler_rt=OFF
135 + if use libunwind; then
136 + # work-around missing -lunwind upstream
137 + extra_libs+=( -lunwind )
138 + # if we're using libunwind and clang with compiler-rt, we want
139 + # to link to compiler-rt instead of -lgcc_s
140 + if tc-is-clang; then
141 + local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \
142 + ${LDFLAGS} -print-libgcc-file-name)
143 + if [[ ${compiler_rt} == *libclang_rt* ]]; then
144 + want_gcc_s=OFF
145 + want_compiler_rt=ON
146 + extra_libs+=( "${compiler_rt}" )
147 + fi
148 + fi
149 + elif [[ ${CHOST} == *-darwin* ]] && tc-is-clang; then
150 + # clang-based darwin prefix disables libunwind useflag during
151 + # bootstrap, because libunwind is not in the prefix yet.
152 + # override the default, though, because clang based libcxx
153 + # should never use gcc_s on Darwin.
154 + want_gcc_s=OFF
155 + # compiler_rt is not available in EPREFIX during bootstrap,
156 + # so we cannot link to it yet anyway, so keep the defaults
157 + # of want_compiler_rt=OFF and extra_libs=()
158 + fi
159 +
160 + # bootstrap: cmake is unhappy if compiler can't link to stdlib
161 + local nolib_flags=( -nodefaultlibs -lc )
162 + if ! test_compiler; then
163 + if test_compiler "${nolib_flags[@]}"; then
164 + local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"
165 + ewarn "${CXX} seems to lack runtime, trying with ${nolib_flags[*]}"
166 + fi
167 + fi
168 +
169 + local libdir=$(get_libdir)
170 + local mycmakeargs=(
171 + -DPython3_EXECUTABLE="${PYTHON}"
172 + -DLLVM_ENABLE_RUNTIMES=libcxx
173 + -DLLVM_INCLUDE_TESTS=OFF
174 + -DLLVM_LIBDIR_SUFFIX=${libdir#lib}
175 +
176 + -DLIBCXX_ENABLE_SHARED=ON
177 + -DLIBCXX_ENABLE_STATIC=$(usex static-libs)
178 + -DLIBCXX_CXX_ABI=${cxxabi}
179 + -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi_incs}
180 + # we're using our own mechanism for generating linker scripts
181 + -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
182 + -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
183 + -DLIBCXX_HAS_GCC_S_LIB=${want_gcc_s}
184 + -DLIBCXX_INCLUDE_BENCHMARKS=OFF
185 + -DLIBCXX_INCLUDE_TESTS=$(usex test)
186 + -DLIBCXX_USE_COMPILER_RT=${want_compiler_rt}
187 + -DLIBCXX_HAS_ATOMIC_LIB=${want_gcc_s}
188 + -DLIBCXX_TARGET_TRIPLE="${CHOST}"
189 + -DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}"
190 + )
191 +
192 + if use test; then
193 + local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
194 + [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests"
195 +
196 + mycmakeargs+=(
197 + -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
198 + -DLLVM_LIT_ARGS="$(get_lit_flags);--param=cxx_under_test=${clang_path}"
199 + -DLIBCXX_LINK_TESTS_WITH_SHARED_LIBCXXABI=ON
200 + -DPython3_EXECUTABLE="${PYTHON}"
201 + )
202 + fi
203 + cmake_src_configure
204 +}
205 +
206 +multilib_src_test() {
207 + local -x LIT_PRESERVES_TMP=1
208 + cmake_build check-cxx
209 +}
210 +
211 +# Usage: deps
212 +gen_ldscript() {
213 + local output_format
214 + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
215 + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
216 +
217 + cat <<-END_LDSCRIPT
218 +/* GNU ld script
219 + Include missing dependencies
220 +*/
221 +${output_format}
222 +GROUP ( $@ )
223 +END_LDSCRIPT
224 +}
225 +
226 +gen_static_ldscript() {
227 + local libdir=$(get_libdir)
228 + local cxxabi_lib=$(usex libcxxabi "libc++abi.a" "libsupc++.a")
229 +
230 + # Move it first.
231 + mv "${ED}/usr/${libdir}/libc++.a" "${ED}/usr/${libdir}/libc++_static.a" || die
232 + # Generate libc++.a ldscript for inclusion of its dependencies so that
233 + # clang++ -stdlib=libc++ -static works out of the box.
234 + local deps="libc++_static.a ${cxxabi_lib} $(usex libunwind libunwind.a libgcc_eh.a)"
235 + # On Linux/glibc it does not link without libpthread or libdl. It is
236 + # fine on FreeBSD.
237 + use elibc_glibc && deps+=" libpthread.a libdl.a"
238 +
239 + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.a" || die
240 +}
241 +
242 +gen_shared_ldscript() {
243 + local libdir=$(get_libdir)
244 + # libsupc++ doesn't have a shared version
245 + local cxxabi_lib=$(usex libcxxabi "libc++abi.so" "libsupc++.a")
246 +
247 + mv "${ED}/usr/${libdir}/libc++.so" "${ED}/usr/${libdir}/libc++_shared.so" || die
248 + local deps="libc++_shared.so ${cxxabi_lib} $(usex libunwind libunwind.so libgcc_s.so)"
249 +
250 + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.so" || die
251 +}
252 +
253 +multilib_src_install() {
254 + cmake_src_install
255 + if [[ ${CHOST} != *-darwin* ]] ; then
256 + gen_shared_ldscript
257 + use static-libs && gen_static_ldscript
258 + fi
259 +}
260 +
261 +pkg_postinst() {
262 + elog "This package (${PN}) is mainly intended as a replacement for the C++"
263 + elog "standard library when using clang."
264 + elog "To use it, instead of libstdc++, use:"
265 + elog " clang++ -stdlib=libc++"
266 + elog "to compile your C++ programs."
267 +}