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: Thu, 03 Nov 2022 14:51:00
Message-Id: 1667486998.e1cd8e782da8eef55305211e3d3150dfdbc0ef4f.mgorny@gentoo
1 commit: e1cd8e782da8eef55305211e3d3150dfdbc0ef4f
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Wed Nov 2 19:55:19 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Thu Nov 3 14:49:58 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e1cd8e78
7
8 sys-libs/libcxx: Bump to 15.0.4
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 sys-libs/libcxx/Manifest | 2 +
13 sys-libs/libcxx/libcxx-15.0.4.ebuild | 204 +++++++++++++++++++++++++++++++++++
14 2 files changed, 206 insertions(+)
15
16 diff --git a/sys-libs/libcxx/Manifest b/sys-libs/libcxx/Manifest
17 index 5925b5932879..5d5f3c1f22c2 100644
18 --- a/sys-libs/libcxx/Manifest
19 +++ b/sys-libs/libcxx/Manifest
20 @@ -5,5 +5,7 @@ DIST llvm-project-14.0.6.src.tar.xz.sig 566 BLAKE2B cb658ad43d8ab6c43a5773aedadf
21 DIST llvm-project-14f996dca8a2b5b17d6917528bfd9ee71ba6192a.tar.gz 169054148 BLAKE2B a23af6658a6ea8a7cb4272faef151937da229e39383ec068d7ef81e72a25d2a46dc2a86255a7f1148b7385b339d1c17e62f627df834d8eccc39be8921575f88d SHA512 e719d296016e7af718d022424c337a5df8d7124fdb49b9f219ab2a5dc592e6a59f6c09064775ea9349bcf4eed9d72214abb648de649ab872174c35635c945c04
22 DIST llvm-project-15.0.3.src.tar.xz 112069972 BLAKE2B 3d29bab890467ba87fedcc4e76522f444e63e3dfbe546793f8e67821bcd403bad460ea176254c9e0b72d60ea56b8480e498a7f610477c1108732d178804c26cd SHA512 d378d417f01c56534f301cfe6cb4958d811c04ae22acaacc917e7e5f0380859d40ce19dffb265d046b70fff95dbc2e759f492e4d5af0ade52f21ebaa8da65856
23 DIST llvm-project-15.0.3.src.tar.xz.sig 438 BLAKE2B e7e0614e144eb878f694c12e97cf42ff8476e47cb55e8f259eb2ec52e303463ad753771271512e89baf0137c1382b11cfa028c85324174ebcd054a124000f537 SHA512 41229bebdb0c2df9a5e3a4d6f02d39fac7dc91f21895a659523beab4fa3ef99ff06eff5e4386221369b6e2b6f8fe974d67b7d8496d5911ce484d09ae0db8b916
24 +DIST llvm-project-15.0.4.src.tar.xz 110936424 BLAKE2B a02b76ad161e352b4d3d84baffdada9c6a0e704de7a2c4017df4d4d05a9e9d02113791cd7d91c3edfa1f5bcb7ab95e1772d60f7061514928c6828600f41a8322 SHA512 9d5b664dd77c08130601636f9d6c006b257f369470ce823aa56d06698a9f0edfec42f2c90da934b9ad52c4d7960d9a024ea46dc9640275be6d191b1ba9869459
25 +DIST llvm-project-15.0.4.src.tar.xz.sig 566 BLAKE2B f1a7be65fcce932dc125ae2b498f68a14e68dad0d7a1e031343c52c5dafb7b123e346f3efa50a7693584361abf01efe9401b1b5781dee6b92dc1045e538e9b7b SHA512 35899ffbd13fc44cade54246a423450571cb4b62b8d706864daa3eef2377c48e24ef3113218e39e29de995b7f7fa307f9187552766576c9050fd924beb517f6e
26 DIST llvm-project-b34ea582774c057d9bf5591174d683fd3d8aa02b.tar.gz 169735900 BLAKE2B d3a82a07f855b038071fc8eb3f41a88b4c220a577219985ecddeb9a535ea8b159dbad575699997d90a49db74c074b5f4354ad707e91d6934daaa7319e0d8ee9b SHA512 3f5525c7d893bdac701cff4cf82dafc31608920d788d9b7401654f320b2432528cf4ae8ef013182807b3dc0c5b758c71f1efeedb672dd47fdb8aa6f434dfb583
27 DIST llvmorg-13.0.1.tar.gz 147290251 BLAKE2B 2a44b012a672501761d0c27c6b3a315b69bfef0cd13b078a7e7d2fccc4a9c8c0f2bee0f164c4271c9106b0a99cb06e8b64986f66253b613336719fb86b82541b SHA512 9a8cb5d11964ba88b7624f19ec861fb28701f23956ea3c92f6ac644332d5f41fde97bd8933dd3ee70ed378058c252fa3a3887c8d1af90d219970c2b27691166f
28
29 diff --git a/sys-libs/libcxx/libcxx-15.0.4.ebuild b/sys-libs/libcxx/libcxx-15.0.4.ebuild
30 new file mode 100644
31 index 000000000000..8b5e382b8889
32 --- /dev/null
33 +++ b/sys-libs/libcxx/libcxx-15.0.4.ebuild
34 @@ -0,0 +1,204 @@
35 +# Copyright 1999-2022 Gentoo Authors
36 +# Distributed under the terms of the GNU General Public License v2
37 +
38 +EAPI=8
39 +
40 +PYTHON_COMPAT=( python3_{8..11} )
41 +inherit cmake-multilib flag-o-matic llvm llvm.org python-any-r1 \
42 + toolchain-funcs
43 +
44 +DESCRIPTION="New implementation of the C++ standard library, targeting C++11"
45 +HOMEPAGE="https://libcxx.llvm.org/"
46 +
47 +LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
48 +SLOT="0"
49 +KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~sparc ~x86 ~x64-macos"
50 +IUSE="+clang +libcxxabi static-libs test"
51 +REQUIRED_USE="test? ( clang )"
52 +RESTRICT="!test? ( test )"
53 +
54 +RDEPEND="
55 + libcxxabi? (
56 + ~sys-libs/libcxxabi-${PV}[static-libs?,${MULTILIB_USEDEP}]
57 + )
58 + !libcxxabi? ( >=sys-devel/gcc-4.7:=[cxx] )
59 +"
60 +DEPEND="
61 + ${RDEPEND}
62 + sys-devel/llvm:${LLVM_MAJOR}
63 +"
64 +BDEPEND="
65 + clang? (
66 + sys-devel/clang:${LLVM_MAJOR}
67 + )
68 + !test? (
69 + ${PYTHON_DEPS}
70 + )
71 + test? (
72 + >=dev-util/cmake-3.16
73 + sys-devel/gdb[python]
74 + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]')
75 + )
76 +"
77 +
78 +LLVM_COMPONENTS=( runtimes libcxx{,abi} llvm/{cmake,utils/llvm-lit} cmake )
79 +llvm.org_set_globals
80 +
81 +python_check_deps() {
82 + use test || return 0
83 + python_has_version "dev-python/lit[${PYTHON_USEDEP}]"
84 +}
85 +
86 +pkg_setup() {
87 + # Darwin Prefix builds do not have llvm installed yet, so rely on
88 + # bootstrap-prefix to set the appropriate path vars to LLVM instead
89 + # of using llvm_pkg_setup.
90 + if [[ ${CHOST} != *-darwin* ]] || has_version dev-lang/llvm; then
91 + LLVM_MAX_SLOT=${LLVM_MAJOR} llvm_pkg_setup
92 + fi
93 + python-any-r1_pkg_setup
94 +
95 + if ! use libcxxabi && ! tc-is-gcc ; then
96 + eerror "To build ${PN} against libsupc++, you have to use gcc. Other"
97 + eerror "compilers are not supported. Please set CC=gcc and CXX=g++"
98 + eerror "and try again."
99 + die
100 + fi
101 +}
102 +
103 +test_compiler() {
104 + $(tc-getCXX) ${CXXFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c++ - \
105 + <<<'int main() { return 0; }' &>/dev/null
106 +}
107 +
108 +src_configure() {
109 + # note: we need to do this before multilib kicks in since it will
110 + # alter the CHOST
111 + local cxxabi cxxabi_incs
112 + if use libcxxabi; then
113 + cxxabi=system-libcxxabi
114 + cxxabi_incs="${EPREFIX}/usr/include/c++/v1"
115 + else
116 + local gcc_inc="${EPREFIX}/usr/lib/gcc/${CHOST}/$(gcc-fullversion)/include/g++-v$(gcc-major-version)"
117 + cxxabi=libsupc++
118 + cxxabi_incs="${gcc_inc};${gcc_inc}/${CHOST}"
119 + fi
120 +
121 + multilib-minimal_src_configure
122 +}
123 +
124 +multilib_src_configure() {
125 + if use clang; then
126 + local -x CC=${CHOST}-clang
127 + local -x CXX=${CHOST}-clang++
128 + strip-unsupported-flags
129 + fi
130 +
131 + # link to compiler-rt
132 + local use_compiler_rt=OFF
133 + [[ $(tc-get-c-rtlib) == compiler-rt ]] && use_compiler_rt=ON
134 +
135 + # bootstrap: cmake is unhappy if compiler can't link to stdlib
136 + local nolib_flags=( -nodefaultlibs -lc )
137 + if ! test_compiler; then
138 + if test_compiler "${nolib_flags[@]}"; then
139 + local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"
140 + ewarn "${CXX} seems to lack runtime, trying with ${nolib_flags[*]}"
141 + fi
142 + fi
143 +
144 + local libdir=$(get_libdir)
145 + local mycmakeargs=(
146 + -DCMAKE_CXX_COMPILER_TARGET="${CHOST}"
147 + -DPython3_EXECUTABLE="${PYTHON}"
148 + -DLLVM_ENABLE_RUNTIMES=libcxx
149 + -DLLVM_INCLUDE_TESTS=OFF
150 + -DLLVM_LIBDIR_SUFFIX=${libdir#lib}
151 +
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_INCLUDE_BENCHMARKS=OFF
160 + -DLIBCXX_INCLUDE_TESTS=$(usex test)
161 + -DLIBCXX_USE_COMPILER_RT=${use_compiler_rt}
162 + )
163 +
164 + if use test; then
165 + mycmakeargs+=(
166 + -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
167 + -DLLVM_LIT_ARGS="$(get_lit_flags)"
168 + -DPython3_EXECUTABLE="${PYTHON}"
169 + )
170 + fi
171 + cmake_src_configure
172 +}
173 +
174 +multilib_src_compile() {
175 + cmake_src_compile
176 + if [[ ${CHOST} != *-darwin* ]] ; then
177 + gen_shared_ldscript
178 + use static-libs && gen_static_ldscript
179 + fi
180 +}
181 +
182 +multilib_src_test() {
183 + local -x LIT_PRESERVES_TMP=1
184 + cmake_build check-cxx
185 +}
186 +
187 +multilib_src_install() {
188 + cmake_src_install
189 + # since we've replaced libc++.{a,so} with ldscripts, now we have to
190 + # install the extra symlinks
191 + if [[ ${CHOST} != *-darwin* ]] ; then
192 + dolib.so lib/libc++_shared.so
193 + use static-libs && dolib.a lib/libc++_static.a
194 + fi
195 +}
196 +
197 +# Usage: deps
198 +gen_ldscript() {
199 + local output_format
200 + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
201 + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
202 +
203 + cat <<-END_LDSCRIPT
204 +/* GNU ld script
205 + Include missing dependencies
206 +*/
207 +${output_format}
208 +GROUP ( $@ )
209 +END_LDSCRIPT
210 +}
211 +
212 +gen_static_ldscript() {
213 + # Move it first.
214 + mv lib/libc++{,_static}.a || die
215 + # Generate libc++.a ldscript for inclusion of its dependencies so that
216 + # clang++ -stdlib=libc++ -static works out of the box.
217 + local deps=(
218 + libc++_static.a
219 + $(usex libcxxabi libc++abi.a libsupc++.a)
220 + )
221 + # On Linux/glibc it does not link without libpthread or libdl. It is
222 + # fine on FreeBSD.
223 + use elibc_glibc && deps+=( libpthread.a libdl.a )
224 +
225 + gen_ldscript "${deps[*]}" > lib/libc++.a || die
226 +}
227 +
228 +gen_shared_ldscript() {
229 + # Move it first.
230 + mv lib/libc++{,_shared}.so || die
231 + local deps=(
232 + libc++_shared.so
233 + # libsupc++ doesn't have a shared version
234 + $(usex libcxxabi libc++abi.so libsupc++.a)
235 + )
236 +
237 + gen_ldscript "${deps[*]}" > lib/libc++.so || die
238 +}