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, 17 Jun 2021 09:05:29
Message-Id: 1623920712.f9cfc30fc541ee2eedbd23f9e9d6ef562f529c85.mgorny@gentoo
1 commit: f9cfc30fc541ee2eedbd23f9e9d6ef562f529c85
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jun 17 08:55:59 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Thu Jun 17 09:05:12 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f9cfc30f
7
8 sys-libs/libcxx: Bump to 12.0.1rc2
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_rc2.ebuild | 211 +++++++++++++++++++++++++++++++
14 2 files changed, 212 insertions(+)
15
16 diff --git a/sys-libs/libcxx/Manifest b/sys-libs/libcxx/Manifest
17 index 1fd327bcd7b..3d502aefa02 100644
18 --- a/sys-libs/libcxx/Manifest
19 +++ b/sys-libs/libcxx/Manifest
20 @@ -6,3 +6,4 @@ DIST llvmorg-10.0.1.tar.gz 120880730 BLAKE2B 30f19f56c4d1f6abcda5fec76256219d1e3
21 DIST llvmorg-11.1.0.tar.gz 122776532 BLAKE2B ca842ff4afff8f44c82b5e7383962a9c45ca1c93b64fa4c6ebcd70a1d3849dbad2b8e4e24fba02d144c6266d7fab3607ebc6999b28c229cb35256cf40f26a985 SHA512 9a8ce022a935eed42fa71a224f2a207122aadcbef58ee855fdb4825f879e7d028e4dcff22c19b9d336db1c8bf63fb84372d44981acf84615f757e54306c92b81
22 DIST llvmorg-12.0.0.tar.gz 134226215 BLAKE2B f9c3ba8c58571855caa4f206fd285c9b5be66672fb0814cb8bc0964a051f57f5d35013aa1e27cbda502652b37df1ec23474129109e76a42066847860db441dbe SHA512 0cff02155c5ac0d6db2b72d60d9819d5b5dd859663b45f721b1c7540239c2fceb1f57d9173f6870c49de851c242ed8e85c5c6d6577a1f8092a7c5dcd12513b26
23 DIST llvmorg-12.0.1-rc1.tar.gz 134261735 BLAKE2B d29510495641c06e6d7a5ac165e6d34e0ba15d1a5b786534e186e341e3a0550cdd3d8a2b61deb3e2bf44c0b0ff8561224bf7f8cebc2ce9415639cb67ceae289e SHA512 4595a26df56eed7d5941240fe92116ad2f1c61639f0f464697c2c530a601347032fbad6802d1fa915ced8574c7b30ef05bc8c0be737784c844d3860892817e6e
24 +DIST llvmorg-12.0.1-rc2.tar.gz 134274147 BLAKE2B 2d3f6ce8d5239cf2e5ea52f4b9020d6a8fedb8d6a4df02ca0d8e4398237f4eb967865e1e65570d16cd191865281b9619a63905c1e1c47b31183b881e97e49867 SHA512 cdebb954016dc92251cd9c6281804f7a36e7bc8c6f101a6817d96cc121aba4d361fb99501c259409a29c90d7749b224be670c41177fe43fa64b730ff294831b8
25
26 diff --git a/sys-libs/libcxx/libcxx-12.0.1_rc2.ebuild b/sys-libs/libcxx/libcxx-12.0.1_rc2.ebuild
27 new file mode 100644
28 index 00000000000..1f529867fb7
29 --- /dev/null
30 +++ b/sys-libs/libcxx/libcxx-12.0.1_rc2.ebuild
31 @@ -0,0 +1,211 @@
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 + -DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}"
166 + )
167 +
168 + if use test; then
169 + local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
170 + [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests"
171 +
172 + mycmakeargs+=(
173 + -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
174 + -DLLVM_LIT_ARGS="$(get_lit_flags);--param=cxx_under_test=${clang_path}"
175 + -DPython3_EXECUTABLE="${PYTHON}"
176 + )
177 + fi
178 + cmake_src_configure
179 +}
180 +
181 +multilib_src_test() {
182 + local -x LIT_PRESERVES_TMP=1
183 + cmake_build check-cxx
184 +}
185 +
186 +# Usage: deps
187 +gen_ldscript() {
188 + local output_format
189 + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
190 + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
191 +
192 + cat <<-END_LDSCRIPT
193 +/* GNU ld script
194 + Include missing dependencies
195 +*/
196 +${output_format}
197 +GROUP ( $@ )
198 +END_LDSCRIPT
199 +}
200 +
201 +gen_static_ldscript() {
202 + local libdir=$(get_libdir)
203 + local cxxabi_lib=$(usex libcxxabi "libc++abi.a" "libsupc++.a")
204 +
205 + # Move it first.
206 + mv "${ED}/usr/${libdir}/libc++.a" "${ED}/usr/${libdir}/libc++_static.a" || die
207 + # Generate libc++.a ldscript for inclusion of its dependencies so that
208 + # clang++ -stdlib=libc++ -static works out of the box.
209 + local deps="libc++_static.a ${cxxabi_lib} $(usex libunwind libunwind.a libgcc_eh.a)"
210 + # On Linux/glibc it does not link without libpthread or libdl. It is
211 + # fine on FreeBSD.
212 + use elibc_glibc && deps+=" libpthread.a libdl.a"
213 +
214 + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.a" || die
215 +}
216 +
217 +gen_shared_ldscript() {
218 + local libdir=$(get_libdir)
219 + # libsupc++ doesn't have a shared version
220 + local cxxabi_lib=$(usex libcxxabi "libc++abi.so" "libsupc++.a")
221 +
222 + mv "${ED}/usr/${libdir}/libc++.so" "${ED}/usr/${libdir}/libc++_shared.so" || die
223 + local deps="libc++_shared.so ${cxxabi_lib} $(usex libunwind libunwind.so libgcc_s.so)"
224 +
225 + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.so" || die
226 +}
227 +
228 +multilib_src_install() {
229 + cmake_src_install
230 + if [[ ${CHOST} != *-darwin* ]] ; then
231 + gen_shared_ldscript
232 + use static-libs && gen_static_ldscript
233 + fi
234 +}
235 +
236 +pkg_postinst() {
237 + elog "This package (${PN}) is mainly intended as a replacement for the C++"
238 + elog "standard library when using clang."
239 + elog "To use it, instead of libstdc++, use:"
240 + elog " clang++ -stdlib=libc++"
241 + elog "to compile your C++ programs."
242 +}