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, 20 Jul 2019 12:50:28
Message-Id: 1563627002.5bcf8996986b70c1e314a9f92dc24cbfe1d8b3c6.mgorny@gentoo
1 commit: 5bcf8996986b70c1e314a9f92dc24cbfe1d8b3c6
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jul 20 08:52:51 2019 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sat Jul 20 12:50:02 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5bcf8996
7
8 sys-libs/libcxx: Bump to 8.0.1
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 sys-libs/libcxx/Manifest | 1 +
13 sys-libs/libcxx/libcxx-8.0.1.ebuild | 216 ++++++++++++++++++++++++++++++++++++
14 2 files changed, 217 insertions(+)
15
16 diff --git a/sys-libs/libcxx/Manifest b/sys-libs/libcxx/Manifest
17 index cb80088d4f4..7e8a64bd013 100644
18 --- a/sys-libs/libcxx/Manifest
19 +++ b/sys-libs/libcxx/Manifest
20 @@ -1,3 +1,4 @@
21 DIST libcxx-6.0.1.src.tar.xz 1552328 BLAKE2B 65a6addd04e530c2a72e8cba207282b9e9fafc01a594d7b11f63d10b6f88eca67a3cdf90b8055e410ede358d9be1f63fbe427f308e1337833447c0260d96e1c8 SHA512 c04f628b0924d76f035f615b59d19ce42dfc19c9a8eea4fe2b22a95cfe5a037ebdb30943fd741443939df5b4cf692bc1e51c840fefefbd134e3afbe2a75fe875
22 DIST libcxx-7.1.0.src.tar.xz 1638448 BLAKE2B eca192e03f839f4323e3c37beba2e6daaf935d4e784e0bc835a4d2c3ce0790f5539bdca0466feafd668d7c6675b11b7fe14d9adb680c46fd7b28b42a3b423219 SHA512 925ce5093445f84dc17d5b1610e4297ef3606b254b7350c50f88ba042fcca62125ffd97d21cb612707d5e9511267634ca1779619199f95ce819e5f5c0c2b55d5
23 DIST libcxx-8.0.0.src.tar.xz 1752308 BLAKE2B 1e8cd8c7100f5f8b943ba8f38b0b59a0fd5e5bea834953483a67502f67de3eb51eba4ed4be17cdb54406da4ad7ebc6fef33934c59db982afa55856ce9f1f46ff SHA512 2e0fcd3e78f7e15ea894e52c51351daef8e3a2aaf53b3df7497b11403d28f5269ff49a4674bacea1d565a5faa2b24502caaaeff9cd48518f0d141563d8f9cc03
24 +DIST libcxx-8.0.1.src.tar.xz 1739524 BLAKE2B 6e641cb6bda0de12c8408d3ab33f627389ac014aa65b3391c870aa96ffd347784e6b70b953bd1ee8eba56554e0f78a723ab77b9dba5f85e6219e2b95ca50c160 SHA512 75749d08b2b343c6f5f9aefb04be63e42f6d12efc51101d3647ed6f70c7a6d050afb3ab2f3636eae78cb523f5844de67b960a7a3145ed89ab0c7015deb14921e
25
26 diff --git a/sys-libs/libcxx/libcxx-8.0.1.ebuild b/sys-libs/libcxx/libcxx-8.0.1.ebuild
27 new file mode 100644
28 index 00000000000..cf4bd1b3b35
29 --- /dev/null
30 +++ b/sys-libs/libcxx/libcxx-8.0.1.ebuild
31 @@ -0,0 +1,216 @@
32 +# Copyright 1999-2019 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=6
36 +
37 +# Ninja provides better scalability and cleaner verbose output, and is used
38 +# throughout all LLVM projects.
39 +: ${CMAKE_MAKEFILE_GENERATOR:=ninja}
40 +# (needed due to CMAKE_BUILD_TYPE != Gentoo)
41 +CMAKE_MIN_VERSION=3.7.0-r1
42 +PYTHON_COMPAT=( python2_7 )
43 +
44 +inherit cmake-multilib llvm multiprocessing python-any-r1 \
45 + toolchain-funcs
46 +
47 +MY_P=${P}.src
48 +DESCRIPTION="New implementation of the C++ standard library, targeting C++11"
49 +HOMEPAGE="https://libcxx.llvm.org/"
50 +SRC_URI="https://github.com/llvm/llvm-project/releases/download/llvmorg-${PV}/${MY_P}.tar.xz"
51 +
52 +LICENSE="|| ( UoI-NCSA MIT )"
53 +SLOT="0"
54 +KEYWORDS="~amd64 ~arm ~arm64 ~x86 ~amd64-fbsd"
55 +IUSE="elibc_glibc elibc_musl +libcxxabi libcxxrt +libunwind +static-libs test"
56 +REQUIRED_USE="libunwind? ( || ( libcxxabi libcxxrt ) )
57 + ?? ( libcxxabi libcxxrt )"
58 +RESTRICT="!test? ( test )"
59 +
60 +RDEPEND="
61 + libcxxabi? ( ~sys-libs/libcxxabi-${PV}[libunwind=,static-libs?,${MULTILIB_USEDEP}] )
62 + libcxxrt? ( sys-libs/libcxxrt[libunwind=,static-libs?,${MULTILIB_USEDEP}] )
63 + !libcxxabi? ( !libcxxrt? ( >=sys-devel/gcc-4.7:=[cxx] ) )"
64 +# llvm-6 for new lit options
65 +# clang-3.9.0 installs necessary target symlinks unconditionally
66 +# which removes the need for MULTILIB_USEDEP
67 +DEPEND="${RDEPEND}
68 + test? ( >=sys-devel/clang-3.9.0
69 + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]') )
70 + app-arch/xz-utils
71 + >=sys-devel/llvm-6"
72 +
73 +S=${WORKDIR}/${MY_P}
74 +
75 +DOCS=( CREDITS.TXT )
76 +
77 +PATCHES=(
78 + # Add link flag "-Wl,-z,defs" to avoid underlinking; this is needed in a
79 + # out-of-tree build.
80 + "${FILESDIR}/${PN}-3.9-cmake-link-flags.patch"
81 +)
82 +
83 +# least intrusive of all
84 +CMAKE_BUILD_TYPE=RelWithDebInfo
85 +
86 +python_check_deps() {
87 + has_version "dev-python/lit[${PYTHON_USEDEP}]"
88 +}
89 +
90 +pkg_setup() {
91 + llvm_pkg_setup
92 + use test && python-any-r1_pkg_setup
93 +
94 + if ! use libcxxabi && ! use libcxxrt && ! tc-is-gcc ; then
95 + eerror "To build ${PN} against libsupc++, you have to use gcc. Other"
96 + eerror "compilers are not supported. Please set CC=gcc and CXX=g++"
97 + eerror "and try again."
98 + die
99 + fi
100 + if tc-is-gcc && [[ $(gcc-version) < 4.7 ]] ; then
101 + eerror "${PN} needs to be built with gcc-4.7 or later (or other"
102 + eerror "conformant compilers). Please use gcc-config to switch to"
103 + eerror "gcc-4.7 or later version."
104 + die
105 + fi
106 +}
107 +
108 +test_compiler() {
109 + $(tc-getCXX) ${CXXFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c++ - \
110 + <<<'int main() { return 0; }' &>/dev/null
111 +}
112 +
113 +src_configure() {
114 + # note: we need to do this before multilib kicks in since it will
115 + # alter the CHOST
116 + local cxxabi cxxabi_incs
117 + if use libcxxabi; then
118 + cxxabi=libcxxabi
119 + cxxabi_incs="${EPREFIX}/usr/include/libcxxabi"
120 + elif use libcxxrt; then
121 + cxxabi=libcxxrt
122 + cxxabi_incs="${EPREFIX}/usr/include/libcxxrt"
123 + else
124 + local gcc_inc="${EPREFIX}/usr/lib/gcc/${CHOST}/$(gcc-fullversion)/include/g++-v$(gcc-major-version)"
125 + cxxabi=libsupc++
126 + cxxabi_incs="${gcc_inc};${gcc_inc}/${CHOST}"
127 + fi
128 +
129 + multilib-minimal_src_configure
130 +}
131 +
132 +multilib_src_configure() {
133 + # we want -lgcc_s for unwinder, and for compiler runtime when using
134 + # gcc, clang with gcc runtime (or any unknown compiler)
135 + local extra_libs=() want_gcc_s=ON
136 + if use libunwind; then
137 + # work-around missing -lunwind upstream
138 + extra_libs+=( -lunwind )
139 + # if we're using libunwind and clang with compiler-rt, we want
140 + # to link to compiler-rt instead of -lgcc_s
141 + if tc-is-clang; then
142 + local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \
143 + ${LDFLAGS} -print-libgcc-file-name)
144 + if [[ ${compiler_rt} == *libclang_rt* ]]; then
145 + want_gcc_s=OFF
146 + extra_libs+=( "${compiler_rt}" )
147 + fi
148 + fi
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 + -DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}"
173 + )
174 +
175 + if use test; then
176 + local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
177 + local jobs=${LIT_JOBS:-$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")}
178 +
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="-vv;-j;${jobs};--param=cxx_under_test=${clang_path}"
184 + )
185 + fi
186 + cmake-utils_src_configure
187 +}
188 +
189 +multilib_src_test() {
190 + cmake-utils_src_make check-libcxx
191 +}
192 +
193 +# Usage: deps
194 +gen_ldscript() {
195 + local output_format
196 + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
197 + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
198 +
199 + cat <<-END_LDSCRIPT
200 +/* GNU ld script
201 + Include missing dependencies
202 +*/
203 +${output_format}
204 +GROUP ( $@ )
205 +END_LDSCRIPT
206 +}
207 +
208 +gen_static_ldscript() {
209 + local libdir=$(get_libdir)
210 + local cxxabi_lib=$(usex libcxxabi "libc++abi.a" "$(usex libcxxrt "libcxxrt.a" "libsupc++.a")")
211 +
212 + # Move it first.
213 + mv "${ED}/usr/${libdir}/libc++.a" "${ED}/usr/${libdir}/libc++_static.a" || die
214 + # Generate libc++.a ldscript for inclusion of its dependencies so that
215 + # clang++ -stdlib=libc++ -static works out of the box.
216 + local deps="libc++_static.a ${cxxabi_lib} $(usex libunwind libunwind.a libgcc_eh.a)"
217 + # On Linux/glibc it does not link without libpthread or libdl. It is
218 + # fine on FreeBSD.
219 + use elibc_glibc && deps+=" libpthread.a libdl.a"
220 +
221 + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.a" || die
222 +}
223 +
224 +gen_shared_ldscript() {
225 + local libdir=$(get_libdir)
226 + # libsupc++ doesn't have a shared version
227 + local cxxabi_lib=$(usex libcxxabi "libc++abi.so" "$(usex libcxxrt "libcxxrt.so" "libsupc++.a")")
228 +
229 + mv "${ED}/usr/${libdir}/libc++.so" "${ED}/usr/${libdir}/libc++_shared.so" || die
230 + local deps="libc++_shared.so ${cxxabi_lib} $(usex libunwind libunwind.so libgcc_s.so)"
231 +
232 + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.so" || die
233 +}
234 +
235 +multilib_src_install() {
236 + cmake-utils_src_install
237 + gen_shared_ldscript
238 + use static-libs && gen_static_ldscript
239 +}
240 +
241 +pkg_postinst() {
242 + elog "This package (${PN}) is mainly intended as a replacement for the C++"
243 + elog "standard library when using clang."
244 + elog "To use it, instead of libstdc++, use:"
245 + elog " clang++ -stdlib=libc++"
246 + elog "to compile your C++ programs."
247 +}