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