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: Wed, 09 Feb 2022 13:02:45
Message-Id: 1644411727.feb6a419822af6398802f1bc0cd955e450ec49d2.mgorny@gentoo
1 commit: feb6a419822af6398802f1bc0cd955e450ec49d2
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Wed Feb 9 09:48:54 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Feb 9 13:02:07 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=feb6a419
7
8 sys-libs/libcxx: Bump to 14.0.0_rc1
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 sys-libs/libcxx/Manifest | 1 +
13 sys-libs/libcxx/libcxx-14.0.0_rc1.ebuild | 215 +++++++++++++++++++++++++++++++
14 2 files changed, 216 insertions(+)
15
16 diff --git a/sys-libs/libcxx/Manifest b/sys-libs/libcxx/Manifest
17 index 37ef36710d84..479b5d61de60 100644
18 --- a/sys-libs/libcxx/Manifest
19 +++ b/sys-libs/libcxx/Manifest
20 @@ -7,3 +7,4 @@ DIST llvmorg-11.1.0.tar.gz 122776532 BLAKE2B ca842ff4afff8f44c82b5e7383962a9c45c
21 DIST llvmorg-12.0.1.tar.gz 134259748 BLAKE2B f41de787bc73ff2edfda1b22cc8602be6f65f37dd9e4c8888533cfa8c3ccdcf4f108aaab9de23ab0ab987966eb160f2a553a0bdff99461e71ddd5bfcd086090d SHA512 6eb0dc18e2c25935fabfdfc48b0114be0939158dfdef7b85b395fe2e71042672446af0e68750aae003c9847d10d1f63316fe95d3df738d18f249174292b1b9e1
22 DIST llvmorg-13.0.0.tar.gz 147270176 BLAKE2B 628f316b580e1edf3a58d4825b724df759e6ed2a4116802470c04562caefc392fa325c91f388036365a2e45a9595cca6d3557fab12984fc8bcfef29c9116d822 SHA512 8004c05d32b9720fb3391783621690c1df9bd1e97e72cbff9192ed88a84b0acd303b61432145fa917b5b5e548c8cee29b24ef8547dcc8677adf4816e7a8a0eb2
23 DIST llvmorg-13.0.1.tar.gz 147290251 BLAKE2B 2a44b012a672501761d0c27c6b3a315b69bfef0cd13b078a7e7d2fccc4a9c8c0f2bee0f164c4271c9106b0a99cb06e8b64986f66253b613336719fb86b82541b SHA512 9a8cb5d11964ba88b7624f19ec861fb28701f23956ea3c92f6ac644332d5f41fde97bd8933dd3ee70ed378058c252fa3a3887c8d1af90d219970c2b27691166f
24 +DIST llvmorg-14.0.0-rc1.tar.gz 158019694 BLAKE2B c0494bfa5cc92be73d2a2736ce04a1ce11003aba477393639a6fc1b4114bb604ddd1929f288f831997693d2d3d7feb9eb7aa4bc1a2eb60d4b01777314ab90973 SHA512 62aac6a033ef0e321aef5060dcc61eb721b115a9cc1b7570497f72183d9e70a66b5910e90df14428bf56d33a44d4582c919e19f4477c0cfb3209e249b53fe534
25
26 diff --git a/sys-libs/libcxx/libcxx-14.0.0_rc1.ebuild b/sys-libs/libcxx/libcxx-14.0.0_rc1.ebuild
27 new file mode 100644
28 index 000000000000..20569c4eb465
29 --- /dev/null
30 +++ b/sys-libs/libcxx/libcxx-14.0.0_rc1.ebuild
31 @@ -0,0 +1,215 @@
32 +# Copyright 1999-2022 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_{8..10} )
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="+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 + sys-devel/gdb[python]
64 + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]')
65 + )"
66 +
67 +DOCS=( CREDITS.TXT )
68 +
69 +LLVM_COMPONENTS=( libcxx{,abi} llvm/{cmake,utils/llvm-lit} cmake )
70 +LLVM_PATCHSET=9999-1
71 +llvm.org_set_globals
72 +
73 +python_check_deps() {
74 + has_version "dev-python/lit[${PYTHON_USEDEP}]"
75 +}
76 +
77 +pkg_setup() {
78 + # Darwin Prefix builds do not have llvm installed yet, so rely on
79 + # bootstrap-prefix to set the appropriate path vars to LLVM instead
80 + # of using llvm_pkg_setup.
81 + if [[ ${CHOST} != *-darwin* ]] || has_version dev-lang/llvm; then
82 + llvm_pkg_setup
83 + fi
84 + use test && python-any-r1_pkg_setup
85 +
86 + if ! use libcxxabi && ! tc-is-gcc ; then
87 + eerror "To build ${PN} against libsupc++, you have to use gcc. Other"
88 + eerror "compilers are not supported. Please set CC=gcc and CXX=g++"
89 + eerror "and try again."
90 + die
91 + fi
92 +}
93 +
94 +test_compiler() {
95 + $(tc-getCXX) ${CXXFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c++ - \
96 + <<<'int main() { return 0; }' &>/dev/null
97 +}
98 +
99 +src_configure() {
100 + # note: we need to do this before multilib kicks in since it will
101 + # alter the CHOST
102 + local cxxabi cxxabi_incs
103 + if use libcxxabi; then
104 + cxxabi=libcxxabi
105 + cxxabi_incs="${EPREFIX}/usr/include/libcxxabi"
106 + else
107 + local gcc_inc="${EPREFIX}/usr/lib/gcc/${CHOST}/$(gcc-fullversion)/include/g++-v$(gcc-major-version)"
108 + cxxabi=libsupc++
109 + cxxabi_incs="${gcc_inc};${gcc_inc}/${CHOST}"
110 + fi
111 +
112 + multilib-minimal_src_configure
113 +}
114 +
115 +multilib_src_configure() {
116 + # we want -lgcc_s for unwinder, and for compiler runtime when using
117 + # gcc, clang with gcc runtime (or any unknown compiler)
118 + local extra_libs=() want_gcc_s=ON want_compiler_rt=OFF
119 + if use libunwind; then
120 + # work-around missing -lunwind upstream
121 + extra_libs+=( -lunwind )
122 + # if we're using libunwind and clang with compiler-rt, we want
123 + # to link to compiler-rt instead of -lgcc_s
124 + if tc-is-clang; then
125 + local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \
126 + ${LDFLAGS} -print-libgcc-file-name)
127 + if [[ ${compiler_rt} == *libclang_rt* ]]; then
128 + want_gcc_s=OFF
129 + want_compiler_rt=ON
130 + extra_libs+=( "${compiler_rt}" )
131 + fi
132 + fi
133 + elif [[ ${CHOST} == *-darwin* ]] && tc-is-clang; then
134 + # clang-based darwin prefix disables libunwind useflag during
135 + # bootstrap, because libunwind is not in the prefix yet.
136 + # override the default, though, because clang based libcxx
137 + # should never use gcc_s on Darwin.
138 + want_gcc_s=OFF
139 + # compiler_rt is not available in EPREFIX during bootstrap,
140 + # so we cannot link to it yet anyway, so keep the defaults
141 + # of want_compiler_rt=OFF and extra_libs=()
142 + fi
143 +
144 + # bootstrap: cmake is unhappy if compiler can't link to stdlib
145 + local nolib_flags=( -nodefaultlibs -lc )
146 + if ! test_compiler; then
147 + if test_compiler "${nolib_flags[@]}"; then
148 + local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"
149 + ewarn "${CXX} seems to lack runtime, trying with ${nolib_flags[*]}"
150 + fi
151 + fi
152 +
153 + local libdir=$(get_libdir)
154 + local mycmakeargs=(
155 + -DLIBCXX_LIBDIR_SUFFIX=${libdir#lib}
156 + -DLIBCXX_ENABLE_SHARED=ON
157 + -DLIBCXX_ENABLE_STATIC=$(usex static-libs)
158 + -DLIBCXX_CXX_ABI=${cxxabi}
159 + -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi_incs}
160 + # we're using our own mechanism for generating linker scripts
161 + -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
162 + -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
163 + -DLIBCXX_HAS_GCC_S_LIB=${want_gcc_s}
164 + -DLIBCXX_INCLUDE_TESTS=$(usex test)
165 + -DLIBCXX_USE_COMPILER_RT=${want_compiler_rt}
166 + -DLIBCXX_HAS_ATOMIC_LIB=${want_gcc_s}
167 + -DLIBCXX_TARGET_TRIPLE="${CHOST}"
168 + -DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}"
169 + )
170 +
171 + if use test; then
172 + local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
173 + [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests"
174 +
175 + mycmakeargs+=(
176 + -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
177 + -DLLVM_LIT_ARGS="$(get_lit_flags);--param=cxx_under_test=${clang_path}"
178 + -DLIBCXX_LINK_TESTS_WITH_SHARED_LIBCXXABI=ON
179 + -DPython3_EXECUTABLE="${PYTHON}"
180 + )
181 + fi
182 + cmake_src_configure
183 +}
184 +
185 +multilib_src_test() {
186 + local -x LIT_PRESERVES_TMP=1
187 + cmake_build check-cxx
188 +}
189 +
190 +# Usage: deps
191 +gen_ldscript() {
192 + local output_format
193 + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
194 + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
195 +
196 + cat <<-END_LDSCRIPT
197 +/* GNU ld script
198 + Include missing dependencies
199 +*/
200 +${output_format}
201 +GROUP ( $@ )
202 +END_LDSCRIPT
203 +}
204 +
205 +gen_static_ldscript() {
206 + local libdir=$(get_libdir)
207 + local cxxabi_lib=$(usex libcxxabi "libc++abi.a" "libsupc++.a")
208 +
209 + # Move it first.
210 + mv "${ED}/usr/${libdir}/libc++.a" "${ED}/usr/${libdir}/libc++_static.a" || die
211 + # Generate libc++.a ldscript for inclusion of its dependencies so that
212 + # clang++ -stdlib=libc++ -static works out of the box.
213 + local deps="libc++_static.a ${cxxabi_lib} $(usex libunwind libunwind.a libgcc_eh.a)"
214 + # On Linux/glibc it does not link without libpthread or libdl. It is
215 + # fine on FreeBSD.
216 + use elibc_glibc && deps+=" libpthread.a libdl.a"
217 +
218 + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.a" || die
219 +}
220 +
221 +gen_shared_ldscript() {
222 + local libdir=$(get_libdir)
223 + # libsupc++ doesn't have a shared version
224 + local cxxabi_lib=$(usex libcxxabi "libc++abi.so" "libsupc++.a")
225 +
226 + mv "${ED}/usr/${libdir}/libc++.so" "${ED}/usr/${libdir}/libc++_shared.so" || die
227 + local deps="libc++_shared.so ${cxxabi_lib} $(usex libunwind libunwind.so libgcc_s.so)"
228 +
229 + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.so" || die
230 +}
231 +
232 +multilib_src_install() {
233 + cmake_src_install
234 + if [[ ${CHOST} != *-darwin* ]] ; then
235 + gen_shared_ldscript
236 + use static-libs && gen_static_ldscript
237 + fi
238 +}
239 +
240 +pkg_postinst() {
241 + elog "This package (${PN}) is mainly intended as a replacement for the C++"
242 + elog "standard library when using clang."
243 + elog "To use it, instead of libstdc++, use:"
244 + elog " clang++ -stdlib=libc++"
245 + elog "to compile your C++ programs."
246 +}