Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/prefix:master commit in: sys-libs/libcxx/
Date: Wed, 07 Sep 2016 07:36:32
Message-Id: 1473233743.edbcba87f78cc4b316e7fa1a3db36fb34bd11486.grobian@gentoo
1 commit: edbcba87f78cc4b316e7fa1a3db36fb34bd11486
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Wed Sep 7 07:33:59 2016 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Wed Sep 7 07:35:43 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=edbcba87
7
8 sys-libs/libcxx: sync to 3.8.1 version
9
10 Package-Manager: portage-2.2.28-prefix
11
12 sys-libs/libcxx/Manifest | 1 +
13 sys-libs/libcxx/libcxx-3.8.1.ebuild | 240 ++++++++++++++++++++++++++++++++++++
14 sys-libs/libcxx/metadata.xml | 5 +-
15 3 files changed, 245 insertions(+), 1 deletion(-)
16
17 diff --git a/sys-libs/libcxx/Manifest b/sys-libs/libcxx/Manifest
18 index 11bf65d..507db25 100644
19 --- a/sys-libs/libcxx/Manifest
20 +++ b/sys-libs/libcxx/Manifest
21 @@ -1,2 +1,3 @@
22 DIST libcxx-3.5.1.src.tar.xz 912248 SHA256 a16d0ae0c0cf2c8cebb94fafcb907022cd4f8579ebac99a4c9919990a37ad475 SHA512 3be33787c79aa5d03a3f507be20ef986215d6008e4f0370e3c5906d76a620bf27c9ed4c35f4561c1ac507a1b217fa7fc7577611e7205f3f2433c677bf86b8632 WHIRLPOOL 725892f113a918168b8ae8b5e93401130ccb1080c207445ba943c4fc06e481002939d37cfbbb59dc2791f91ccd7c673274ee523ec96418ed04ca22c8d11e2bec
23 DIST libcxx-3.7.1.src.tar.xz 995724 SHA256 357fbd4288ce99733ba06ae2bec6f503413d258aeebaab8b6a791201e6f7f144 SHA512 08d2399a8b36aa15290733256c896c9fa43f1a1223bc5c73bbcd014fddf8880e514d2a6dcc456bcf18b537c01fb6911b092e6d9958bccd8e64e9f375ed7a1ab9 WHIRLPOOL 19f77946abf48cbdd3e7ea21fd009ca3cc5f607dfe0512a44b102847044bb1d5ae4b16f503f18b14ebd9ea115256e87af07409907ba2a65f6061e217a502a359
24 +DIST libcxx-3.8.1.src.tar.xz 1074164 SHA256 77d7f3784c88096d785bd705fa1bab7031ce184cd91ba8a7008abf55264eeecc SHA512 782ff3cdb85d02e92404e943474d0266ff601725c202f0667d60e7807f1ba3cfdebbdb062e27a52fec96be1c99339044be93a88ba7e396682f98d99c9ac175b2 WHIRLPOOL a729c44060972edee79b0019fd4c6c23fa56dd625e564f4c5965682d9fc79be4094df0643f67c5d2ffa3ae3c743c892c3c9ba19719b2307aada35775f64ed104
25
26 diff --git a/sys-libs/libcxx/libcxx-3.8.1.ebuild b/sys-libs/libcxx/libcxx-3.8.1.ebuild
27 new file mode 100644
28 index 0000000..10fac31
29 --- /dev/null
30 +++ b/sys-libs/libcxx/libcxx-3.8.1.ebuild
31 @@ -0,0 +1,240 @@
32 +# Copyright 1999-2016 Gentoo Foundation
33 +# Distributed under the terms of the GNU General Public License v2
34 +# $Id $
35 +
36 +EAPI=5
37 +
38 +ESVN_REPO_URI="http://llvm.org/svn/llvm-project/libcxx/trunk"
39 +
40 +[ "${PV%9999}" != "${PV}" ] && SCM="subversion" || SCM=""
41 +
42 +inherit ${SCM} flag-o-matic toolchain-funcs multilib multilib-minimal
43 +
44 +DESCRIPTION="New implementation of the C++ standard library, targeting C++11"
45 +HOMEPAGE="http://libcxx.llvm.org/"
46 +if [ "${PV%9999}" = "${PV}" ] ; then
47 + SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz"
48 + S="${WORKDIR}/${P}.src"
49 +else
50 + SRC_URI=""
51 +fi
52 +
53 +LICENSE="|| ( UoI-NCSA MIT )"
54 +SLOT="0"
55 +if [ "${PV%9999}" = "${PV}" ] ; then
56 + KEYWORDS="~x64-macos ~x86-macos"
57 +else
58 + KEYWORDS=""
59 +fi
60 +IUSE="elibc_glibc +libcxxrt static-libs test"
61 +
62 +REQUIRED_USE="kernel_Darwin? ( libcxxrt !static-libs )"
63 +RDEPEND="
64 + !kernel_Darwin? (
65 + libcxxrt? ( >=sys-libs/libcxxrt-0.0_p20130725[static-libs?,${MULTILIB_USEDEP}] )
66 + !libcxxrt? ( >=sys-devel/gcc-4.7[cxx] )
67 + )
68 + kernel_Darwin? (
69 + =sys-libs/libcxx-headers-${PV}
70 + =sys-libs/libcxxabi-${PV}
71 + sys-devel/clang
72 + )"
73 +DEPEND="${RDEPEND}
74 + test? ( sys-devel/clang )
75 + app-arch/xz-utils"
76 +
77 +DOCS=( CREDITS.TXT )
78 +
79 +pkg_setup() {
80 + if [[ ${CHOST} == *darwin* ]] ; then
81 + MY_CC=$(tc-getCC)
82 + MY_CXX=$(tc-getCXX)
83 + if [[ ${MY_CC} != *clang* || ${MY_CXX} != *clang++* ]] ; then
84 + eerror "${PN} needs to be built with clang++. Please do not override"
85 + eerror "CC ($MY_CC) and CXX ($MY_CXX)"
86 + eerror "or point them at clang and clang++ respectively."
87 + die
88 + fi
89 + return
90 + fi
91 + if ! use libcxxrt ; then
92 + ewarn "You have disabled USE=libcxxrt. This will build ${PN} against"
93 + ewarn "libsupc++. Please note that this is not well supported."
94 + ewarn "In particular, static linking will not work."
95 + fi
96 + if [[ $(gcc-version) < 4.7 ]] && [[ $(tc-getCXX) != *clang++* ]] ; then
97 + eerror "${PN} needs to be built with clang++ or gcc-4.7 or later."
98 + eerror "Please use gcc-config to switch to gcc-4.7 or later version."
99 + die
100 + fi
101 +}
102 +
103 +src_prepare() {
104 + cp -f "${FILESDIR}/Makefile" lib/ || die
105 +
106 + if [[ ${CHOST} == *darwin* ]] ; then
107 + epatch "${FILESDIR}"/${PN}-3.5.1-olddarwin.patch
108 +
109 + [[ "${CHOST##*-darwin}" -le 10 ]] && \
110 + epatch "${FILESDIR}"/${PN}-3.5.1-cmath-conv.patch
111 +
112 + # libc++abi needs stack unwinding functions provided by libSystem on
113 + # Mac OS X >= 10.6. On < 10.6 they're in libgcc_s. So force link
114 + # against that. Additionally, the crt1.o provided by our gcc-apple
115 + # toolchain isn't universal. Since that's needed for linking any
116 + # program on OS X < 10.7, universal support is effectively broken on
117 + # those older OS Xes even if clang and libc++{,abi} were to support it.
118 + # So we can just disable universal compilation.
119 + gcc_s=gcc_s.1
120 + [[ "${CHOST##*-darwin}" -eq 9 ]] && gcc_s=gcc_s.10.5
121 + [[ "${CHOST##*-darwin}" -eq 8 ]] && gcc_s=gcc_s.10.4
122 + [[ "${CHOST##*-darwin}" -le 9 ]] && \
123 + sed -i -e "s,/usr/lib/libSystem.B.dylib,-lSystem -l${gcc_s},g" \
124 + -e "s,-arch i386 -arch x86_64,,g" \
125 + lib/buildit
126 +
127 + if [[ "${CHOST##*-darwin}" -le 8 ]] ; then
128 + epatch "${FILESDIR}"/${PN}-3.5.1-availability.patch
129 + epatch "${FILESDIR}"/${PN}-3.5.1-eprintf.patch
130 + fi
131 +
132 + # fix library install names
133 + sed -i \
134 + -e "s,/usr/lib/libc++abi\.dylib,${EPREFIX}/usr/lib/libc++abi.dylib,g" \
135 + -e "s,/usr/lib/libc++\.1\.dylib,${EPREFIX}/usr/lib/libc++.1.dylib,g" \
136 + lib/buildit
137 + fi
138 +
139 + multilib_copy_sources
140 +}
141 +
142 +src_configure() {
143 + tc-export AR CC CXX
144 +
145 + # on Darwin we're all set
146 + [[ ${CHOST} == *darwin* ]] && return
147 +
148 + export LIBS="-lpthread -lrt -lc -lgcc_s"
149 + if use libcxxrt ; then
150 + append-cppflags -DLIBCXXRT "-I${EPREFIX}/usr/include/libcxxrt/"
151 + LIBS="-lcxxrt ${LIBS}"
152 + cp "${EPREFIX}/usr/include/libcxxrt/"*.h "${S}/include"
153 + else
154 + # Very hackish, see $HOMEPAGE
155 + # If someone has a clever idea, please share it!
156 + local includes="$(echo | ${CHOST}-g++ -Wp,-v -x c++ - -fsyntax-only 2>&1 | grep -C 2 '#include.*<...>' | tail -n 2 | sed -e 's/^ /-I/' | tr '\n' ' ')"
157 + local libcxx_gcc_dirs="$(echo | ${CHOST}-g++ -Wp,-v -x c++ - -fsyntax-only 2>&1 | grep -C 2 '#include.*<...>' | tail -n 2 | tr '\n' ' ')"
158 + append-cppflags -D__GLIBCXX__ ${includes}
159 + LIBS="-lsupc++ ${LIBS}"
160 + local libsupcxx_includes="cxxabi.h bits/c++config.h bits/os_defines.h bits/cpu_defines.h bits/cxxabi_tweaks.h bits/cxxabi_forced.h"
161 + for i in ${libsupcxx_includes} ; do
162 + local found=""
163 + [ -d "${S}/include/$(dirname ${i})/" ] || mkdir -p "${S}/include/$(dirname ${i})"
164 + for j in ${libcxx_gcc_dirs} ; do
165 + if [ -f "${j}/${i}" ] ; then
166 + cp "${j}/${i}" "${S}/include/$(dirname ${i})/" || die
167 + found=yes
168 + fi
169 + done
170 + [ -n "${found}" ] || die "Header not found: ${i}"
171 + done
172 + fi
173 +
174 + append-ldflags "-Wl,-z,defs" # make sure we are not underlinked
175 +}
176 +
177 +multilib_src_compile() {
178 + cd "${BUILD_DIR}/lib" || die
179 + if [[ ${CHOST} == *darwin* ]] ; then
180 + TRIPLE=-apple- ./buildit || die
181 + return
182 + fi
183 +
184 + emake shared
185 + use static-libs && emake static
186 +}
187 +
188 +# Tests fail for now, if anybody is able to fix them, help is very welcome.
189 +multilib_src_test() {
190 + cd "${BUILD_DIR}/test"
191 + LD_LIBRARY_PATH="${BUILD_DIR}/lib:${LD_LIBRARY_PATH}" \
192 + CC="clang++ $(get_abi_CFLAGS) ${CXXFLAGS}" \
193 + HEADER_INCLUDE="-I${BUILD_DIR}/include" \
194 + SOURCE_LIB="-L${BUILD_DIR}/lib" \
195 + LIBS="-lm $(usex libcxxrt -lcxxrt "")" \
196 + ./testit || die
197 + # TODO: fix link against libsupc++
198 +}
199 +
200 +# Usage: deps
201 +gen_ldscript() {
202 + local output_format
203 + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
204 + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
205 +
206 + cat <<-END_LDSCRIPT
207 +/* GNU ld script
208 + Include missing dependencies
209 +*/
210 +${output_format}
211 +GROUP ( $@ )
212 +END_LDSCRIPT
213 +}
214 +
215 +gen_static_ldscript() {
216 + if use libcxxrt ; then
217 + # Move it first.
218 + mv "${ED}/usr/$(get_libdir)/libc++.a" "${ED}/usr/$(get_libdir)/libc++_static.a" || die
219 +
220 + # Generate libc++.a ldscript for inclusion of its dependencies so that
221 + # clang++ -stdlib=libc++ -static works out of the box.
222 + local deps="${EPREFIX}/usr/$(get_libdir)/libc++_static.a ${EPREFIX}/usr/$(get_libdir)/libcxxrt.a"
223 + # On Linux/glibc it does not link without libpthread or libdl. It is
224 + # fine on FreeBSD.
225 + use elibc_glibc && deps="${deps} ${EPREFIX}/usr/$(get_libdir)/libpthread.a ${EPREFIX}/usr/$(get_libdir)/libdl.a"
226 +
227 + gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.a"
228 + fi
229 + # TODO: Generate a libc++.a ldscript when building against libsupc++
230 +}
231 +
232 +gen_shared_ldscript() {
233 + if use libcxxrt ; then
234 + mv "${ED}/usr/$(get_libdir)/libc++.so" "${ED}/usr/$(get_libdir)/libc++_shared.so" || die
235 + local deps="${EPREFIX}/usr/$(get_libdir)/libc++_shared.so ${EPREFIX}/usr/$(get_libdir)/libcxxrt.so"
236 + gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.so"
237 + fi
238 + # TODO: Generate the linker script for other confiurations too.
239 +}
240 +
241 +multilib_src_install() {
242 + cd "${BUILD_DIR}/lib"
243 + if [[ ${CHOST} == *darwin* ]] ; then
244 + dolib.so libc++*dylib
245 + return
246 + fi
247 +
248 + if use static-libs ; then
249 + dolib.a libc++.a
250 + gen_static_ldscript
251 + fi
252 + dolib.so libc++.so*
253 + gen_shared_ldscript
254 +}
255 +
256 +multilib_src_install_all() {
257 + einstalldocs
258 + # libc++abi needs the libc++ headers and we need libc++abi so the headers
259 + # are already installed
260 + [[ ${CHOST} == *darwin* ]] && return
261 + insinto /usr/include/c++/v1
262 + doins -r include/*
263 +}
264 +
265 +pkg_postinst() {
266 + elog "This package (${PN}) is mainly intended as a replacement for the C++"
267 + elog "standard library when using clang."
268 + elog "To use it, instead of libstdc++, use:"
269 + elog " clang++ -stdlib=libc++"
270 + elog "to compile your C++ programs."
271 +}
272
273 diff --git a/sys-libs/libcxx/metadata.xml b/sys-libs/libcxx/metadata.xml
274 index 6795d17..4269b68 100644
275 --- a/sys-libs/libcxx/metadata.xml
276 +++ b/sys-libs/libcxx/metadata.xml
277 @@ -1,7 +1,10 @@
278 <?xml version="1.0" encoding="UTF-8"?>
279 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
280 <pkgmetadata>
281 - <herd>prefix</herd>
282 + <maintainer type="project">
283 + <email>prefix@g.o</email>
284 + <name>Prefix Project</name>
285 + </maintainer>
286 <use>
287 <flag name="libcxxrt">Build against <pkg>sys-libs/libcxxr</pkg></flag>
288 </use>