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: Fri, 09 Feb 2018 16:00:25
Message-Id: 1518192006.813f828361ceaae8944253e19c381a9683eb055a.mgorny@gentoo
1 commit: 813f828361ceaae8944253e19c381a9683eb055a
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Fri Feb 9 10:13:30 2018 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Feb 9 16:00:06 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=813f8283
7
8 sys-libs/libcxx: Bump to 6.0.0rc2
9
10 sys-libs/libcxx/Manifest | 1 +
11 sys-libs/libcxx/libcxx-6.0.0_rc2.ebuild | 198 ++++++++++++++++++++++++++++++++
12 2 files changed, 199 insertions(+)
13
14 diff --git a/sys-libs/libcxx/Manifest b/sys-libs/libcxx/Manifest
15 index 9e115253237..6d10cd08857 100644
16 --- a/sys-libs/libcxx/Manifest
17 +++ b/sys-libs/libcxx/Manifest
18 @@ -2,3 +2,4 @@ DIST libcxx-3.7.1.src.tar.xz 995724 BLAKE2B aab68f1b99a2c817e7154b71c04c81bd8091
19 DIST libcxx-3.9.1.src.tar.xz 1209020 BLAKE2B 510e77c2c1163babbba904933f441e8720b0d366b9f0cfa2cdde2401368c224e00efd66afc1403b0087c40549cda4ebbc4d0c4b2d0906178324fa6158502d5ad SHA512 a5976e4096624a7307b3e43f4a22ac2dc74572226e0f57af9f3ef537a14c3cff1601b7042aef9dc40a0ee53ca76b08d72eb9c253dcf34f115d3153c302db7070
20 DIST libcxx-4.0.1.src.tar.xz 1446380 BLAKE2B cd871eff4c4ca25a1fe4d27f778e913fe536a0b5863ea7dd3c8895f6b743b6f039e4df71f9ba5124c98761a8099666f68e1dfd073b5ec7b9fe0007ef09a9117d SHA512 91f3f397be606989be99865d0b279557f9afb93f7a74ed10c3a74f4440e38b5694ddf452bbf2f487cacd4391606dd5c7edfe5130f2de19e2acfd6cce619d028a
21 DIST libcxx-5.0.1.src.tar.xz 1527852 BLAKE2B 9454fbca8228ee456feb79b65a63ce5daa27bf2e47e457d79592f4974dceeace19fe6cdeee51cc51f94e9072d7ce3c03e5acb617507670153647b9c435feadbd SHA512 994681d3c79047fc2d618c5584b08e9b5c925dab48f8812fc0adc81a575b49a637e9481bb9a0f7ae6f7f352b2b33f40056c347c27123cd6c96c6c226febd002c
22 +DIST libcxx-6.0.0rc2.src.tar.xz 1554124 BLAKE2B c1d270c4c102c7622138e00628bf863f4047018ecf859386358449da2b7afdf2fe7a9cf969fa96f678960fd4cc343c26e89d6e95e594eeacef3d0d18157f9cff SHA512 3f0a032c4670076ead80bb03b3b7a565dfaf6526c9309f4453a455463038d3e7960bf93f2393f6dd2bd8b7f1ea145555b9599edae54dba7ede97cf0d8240cc4f
23
24 diff --git a/sys-libs/libcxx/libcxx-6.0.0_rc2.ebuild b/sys-libs/libcxx/libcxx-6.0.0_rc2.ebuild
25 new file mode 100644
26 index 00000000000..8d32cbd678f
27 --- /dev/null
28 +++ b/sys-libs/libcxx/libcxx-6.0.0_rc2.ebuild
29 @@ -0,0 +1,198 @@
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 python-any-r1 toolchain-funcs
43 +
44 +DESCRIPTION="New implementation of the C++ standard library, targeting C++11"
45 +HOMEPAGE="https://libcxx.llvm.org/"
46 +SRC_URI="http://prereleases.llvm.org/${PV/_//}/${P/_/}.src.tar.xz"
47 +
48 +LICENSE="|| ( UoI-NCSA MIT )"
49 +SLOT="0"
50 +KEYWORDS=""
51 +IUSE="elibc_glibc elibc_musl +libcxxabi libcxxrt +libunwind +static-libs test"
52 +REQUIRED_USE="libunwind? ( || ( libcxxabi libcxxrt ) )
53 + ?? ( libcxxabi libcxxrt )"
54 +RESTRICT="!test? ( test )"
55 +
56 +RDEPEND="
57 + libcxxabi? ( ~sys-libs/libcxxabi-${PV}[libunwind=,static-libs?,${MULTILIB_USEDEP}] )
58 + libcxxrt? ( sys-libs/libcxxrt[libunwind=,static-libs?,${MULTILIB_USEDEP}] )
59 + !libcxxabi? ( !libcxxrt? ( >=sys-devel/gcc-4.7:=[cxx] ) )"
60 +# llvm-6 for new lit options
61 +# clang-3.9.0 installs necessary target symlinks unconditionally
62 +# which removes the need for MULTILIB_USEDEP
63 +DEPEND="${RDEPEND}
64 + test? ( >=sys-devel/clang-3.9.0
65 + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]') )
66 + app-arch/xz-utils
67 + >=sys-devel/llvm-6"
68 +
69 +S=${WORKDIR}/${P/_/}.src
70 +
71 +DOCS=( CREDITS.TXT )
72 +
73 +PATCHES=(
74 + # Add link flag "-Wl,-z,defs" to avoid underlinking; this is needed in a
75 + # out-of-tree build.
76 + "${FILESDIR}/${PN}-3.9-cmake-link-flags.patch"
77 +)
78 +
79 +# least intrusive of all
80 +CMAKE_BUILD_TYPE=RelWithDebInfo
81 +
82 +python_check_deps() {
83 + has_version "dev-python/lit[${PYTHON_USEDEP}]"
84 +}
85 +
86 +pkg_setup() {
87 + llvm_pkg_setup
88 + use test && python-any-r1_pkg_setup
89 +
90 + if ! use libcxxabi && ! use libcxxrt && ! tc-is-gcc ; then
91 + eerror "To build ${PN} against libsupc++, you have to use gcc. Other"
92 + eerror "compilers are not supported. Please set CC=gcc and CXX=g++"
93 + eerror "and try again."
94 + die
95 + fi
96 + if tc-is-gcc && [[ $(gcc-version) < 4.7 ]] ; then
97 + eerror "${PN} needs to be built with gcc-4.7 or later (or other"
98 + eerror "conformant compilers). Please use gcc-config to switch to"
99 + eerror "gcc-4.7 or later version."
100 + die
101 + fi
102 +}
103 +
104 +multilib_src_configure() {
105 + local cxxabi cxxabi_incs
106 + if use libcxxabi; then
107 + cxxabi=libcxxabi
108 + cxxabi_incs="${EPREFIX}/usr/include/libcxxabi"
109 + elif use libcxxrt; then
110 + cxxabi=libcxxrt
111 + cxxabi_incs="${EPREFIX}/usr/include/libcxxrt"
112 + else
113 + local gcc_inc="${EPREFIX}/usr/lib/gcc/${CHOST}/$(gcc-fullversion)/include/g++-v$(gcc-major-version)"
114 + cxxabi=libsupc++
115 + cxxabi_incs="${gcc_inc};${gcc_inc}/${CHOST}"
116 + fi
117 +
118 + # we want -lgcc_s for unwinder, and for compiler runtime when using
119 + # gcc, clang with gcc runtime (or any unknown compiler)
120 + local extra_libs=() want_gcc_s=ON
121 + if use libunwind; then
122 + # work-around missing -lunwind upstream
123 + extra_libs+=( -lunwind )
124 + # if we're using libunwind and clang with compiler-rt, we want
125 + # to link to compiler-rt instead of -lgcc_s
126 + if tc-is-clang; then
127 + # get the full library list out of 'pretend mode'
128 + # and grep it for libclang_rt references
129 + local args=( $($(tc-getCC) -### -x c - 2>&1 | tail -n 1) )
130 + local i
131 + for i in "${args[@]}"; do
132 + if [[ ${i} == *libclang_rt* ]]; then
133 + want_gcc_s=OFF
134 + extra_libs+=( "${i}" )
135 + fi
136 + done
137 + fi
138 + fi
139 +
140 + local libdir=$(get_libdir)
141 + local mycmakeargs=(
142 + -DLIBCXX_LIBDIR_SUFFIX=${libdir#lib}
143 + -DLIBCXX_ENABLE_SHARED=ON
144 + -DLIBCXX_ENABLE_STATIC=$(usex static-libs)
145 + -DLIBCXX_CXX_ABI=${cxxabi}
146 + -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi_incs}
147 + # we're using our own mechanism for generating linker scripts
148 + -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
149 + -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
150 + -DLIBCXX_HAS_GCC_S_LIB=${want_gcc_s}
151 + -DLIBCXX_INCLUDE_TESTS=$(usex test)
152 + -DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}"
153 + )
154 +
155 + if use test; then
156 + mycmakeargs+=(
157 + -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
158 + -DLLVM_LIT_ARGS="-vv"
159 + )
160 + fi
161 + cmake-utils_src_configure
162 +}
163 +
164 +multilib_src_test() {
165 + local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
166 +
167 + [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests"
168 + sed -i -e "/cxx_under_test/s^\".*\"^\"${clang_path}\"^" test/lit.site.cfg || die
169 +
170 + cmake-utils_src_make check-libcxx
171 +}
172 +
173 +# Usage: deps
174 +gen_ldscript() {
175 + local output_format
176 + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
177 + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
178 +
179 + cat <<-END_LDSCRIPT
180 +/* GNU ld script
181 + Include missing dependencies
182 +*/
183 +${output_format}
184 +GROUP ( $@ )
185 +END_LDSCRIPT
186 +}
187 +
188 +gen_static_ldscript() {
189 + local libdir=$(get_libdir)
190 + local cxxabi_lib=$(usex libcxxabi "libc++abi.a" "$(usex libcxxrt "libcxxrt.a" "libsupc++.a")")
191 +
192 + # Move it first.
193 + mv "${ED}/usr/${libdir}/libc++.a" "${ED}/usr/${libdir}/libc++_static.a" || die
194 + # Generate libc++.a ldscript for inclusion of its dependencies so that
195 + # clang++ -stdlib=libc++ -static works out of the box.
196 + local deps="libc++_static.a ${cxxabi_lib} $(usex libunwind libunwind.a libgcc_eh.a)"
197 + # On Linux/glibc it does not link without libpthread or libdl. It is
198 + # fine on FreeBSD.
199 + use elibc_glibc && deps+=" libpthread.a libdl.a"
200 +
201 + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.a" || die
202 +}
203 +
204 +gen_shared_ldscript() {
205 + local libdir=$(get_libdir)
206 + # libsupc++ doesn't have a shared version
207 + local cxxabi_lib=$(usex libcxxabi "libc++abi.so" "$(usex libcxxrt "libcxxrt.so" "libsupc++.a")")
208 +
209 + mv "${ED}/usr/${libdir}/libc++.so" "${ED}/usr/${libdir}/libc++_shared.so" || die
210 + local deps="libc++_shared.so ${cxxabi_lib} $(usex libunwind libunwind.so libgcc_s.so)"
211 +
212 + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.so" || die
213 +}
214 +
215 +multilib_src_install() {
216 + cmake-utils_src_install
217 + gen_shared_ldscript
218 + use static-libs && gen_static_ldscript
219 +}
220 +
221 +pkg_postinst() {
222 + elog "This package (${PN}) is mainly intended as a replacement for the C++"
223 + elog "standard library when using clang."
224 + elog "To use it, instead of libstdc++, use:"
225 + elog " clang++ -stdlib=libc++"
226 + elog "to compile your C++ programs."
227 +}