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