Gentoo Archives: gentoo-commits

From: Alexis Ballier <aballier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/libcxx/
Date: Tue, 05 Jan 2016 08:34:44
Message-Id: 1451982422.38c169737779f639a3434bd8effe7b7a76d98ff3.aballier@gentoo
1 commit: 38c169737779f639a3434bd8effe7b7a76d98ff3
2 Author: Alexis Ballier <aballier <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 5 07:43:13 2016 +0000
4 Commit: Alexis Ballier <aballier <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 5 08:27:02 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=38c16973
7
8 sys-libs/libcxx: bump to 3.7.1
9
10 Package-Manager: portage-2.2.26
11 Signed-off-by: Alexis Ballier <aballier <AT> gentoo.org>
12
13 sys-libs/libcxx/Manifest | 1 +
14 sys-libs/libcxx/libcxx-3.7.1.ebuild | 170 ++++++++++++++++++++++++++++++++++++
15 2 files changed, 171 insertions(+)
16
17 diff --git a/sys-libs/libcxx/Manifest b/sys-libs/libcxx/Manifest
18 index 39d0adb..49261ca 100644
19 --- a/sys-libs/libcxx/Manifest
20 +++ b/sys-libs/libcxx/Manifest
21 @@ -1 +1,2 @@
22 DIST libcxx-3.7.0.src.tar.xz 994580 SHA256 c18f3c8333cd7e678c1424a57fe5e25efe740ca7caf62ac67152b4723f3ad08e SHA512 e71d04efa0fafab129a97ca6f4fd7b5f185258de7455c7a25d0964f459bc6068c69c5d67199f6d7cd3541bdce630106cbaf3b7099e4737dddbdd57c77a3fe054 WHIRLPOOL 26672e3f6e0772504e7ee174c37e5fc20079c730ac8bd0d2563d5415ca9589360aa3be42a8aac15eb5a63c69227bd4911aa822b158b9a35e3d74ec0d71bb1300
23 +DIST libcxx-3.7.1.src.tar.xz 995724 SHA256 357fbd4288ce99733ba06ae2bec6f503413d258aeebaab8b6a791201e6f7f144 SHA512 08d2399a8b36aa15290733256c896c9fa43f1a1223bc5c73bbcd014fddf8880e514d2a6dcc456bcf18b537c01fb6911b092e6d9958bccd8e64e9f375ed7a1ab9 WHIRLPOOL 19f77946abf48cbdd3e7ea21fd009ca3cc5f607dfe0512a44b102847044bb1d5ae4b16f503f18b14ebd9ea115256e87af07409907ba2a65f6061e217a502a359
24
25 diff --git a/sys-libs/libcxx/libcxx-3.7.1.ebuild b/sys-libs/libcxx/libcxx-3.7.1.ebuild
26 new file mode 100644
27 index 0000000..92689d8
28 --- /dev/null
29 +++ b/sys-libs/libcxx/libcxx-3.7.1.ebuild
30 @@ -0,0 +1,170 @@
31 +# Copyright 1999-2015 Gentoo Foundation
32 +# Distributed under the terms of the GNU General Public License v2
33 +# $Id$
34 +
35 +EAPI=5
36 +
37 +ESVN_REPO_URI="http://llvm.org/svn/llvm-project/libcxx/trunk"
38 +
39 +[ "${PV%9999}" != "${PV}" ] && SCM="subversion" || SCM=""
40 +
41 +inherit ${SCM} flag-o-matic toolchain-funcs multilib multilib-minimal
42 +
43 +DESCRIPTION="New implementation of the C++ standard library, targeting C++11"
44 +HOMEPAGE="http://libcxx.llvm.org/"
45 +if [ "${PV%9999}" = "${PV}" ] ; then
46 + SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz"
47 + S="${WORKDIR}/${P}.src"
48 +else
49 + SRC_URI=""
50 +fi
51 +
52 +LICENSE="|| ( UoI-NCSA MIT )"
53 +SLOT="0"
54 +if [ "${PV%9999}" = "${PV}" ] ; then
55 + KEYWORDS="~amd64 ~mips ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
56 +else
57 + KEYWORDS=""
58 +fi
59 +IUSE="elibc_glibc +libcxxrt +static-libs test"
60 +
61 +RDEPEND="libcxxrt? ( >=sys-libs/libcxxrt-0.0_p20130725[static-libs?,${MULTILIB_USEDEP}] )
62 + !libcxxrt? ( >=sys-devel/gcc-4.7:=[cxx] )"
63 +DEPEND="${RDEPEND}
64 + test? ( sys-devel/clang )
65 + app-arch/xz-utils"
66 +
67 +DOCS=( CREDITS.TXT )
68 +
69 +pkg_setup() {
70 + if ! use libcxxrt ; then
71 + ewarn "You have disabled USE=libcxxrt. This will build ${PN} against"
72 + ewarn "libsupc++. Please note that this is not well supported."
73 + ewarn "In particular, static linking will not work."
74 + fi
75 + if [[ $(gcc-version) < 4.7 ]] && [[ $(tc-getCXX) != *clang++* ]] ; then
76 + eerror "${PN} needs to be built with clang++ or gcc-4.7 or later."
77 + eerror "Please use gcc-config to switch to gcc-4.7 or later version."
78 + die
79 + fi
80 +}
81 +
82 +src_prepare() {
83 + cp -f "${FILESDIR}/Makefile" lib/ || die
84 + multilib_copy_sources
85 +}
86 +
87 +src_configure() {
88 + export LIBS="-lpthread -lrt -lc -lgcc_s"
89 + if use libcxxrt ; then
90 + append-cppflags -DLIBCXXRT "-I${EPREFIX}/usr/include/libcxxrt/"
91 + LIBS="-lcxxrt ${LIBS}"
92 + cp "${EPREFIX}/usr/include/libcxxrt/"*.h "${S}/include"
93 + else
94 + # Very hackish, see $HOMEPAGE
95 + # If someone has a clever idea, please share it!
96 + 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' ' ')"
97 + local libcxx_gcc_dirs="$(echo | ${CHOST}-g++ -Wp,-v -x c++ - -fsyntax-only 2>&1 | grep -C 2 '#include.*<...>' | tail -n 2 | tr '\n' ' ')"
98 + append-cppflags -D__GLIBCXX__ ${includes}
99 + LIBS="-lsupc++ ${LIBS}"
100 + 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"
101 + for i in ${libsupcxx_includes} ; do
102 + local found=""
103 + [ -d "${S}/include/$(dirname ${i})/" ] || mkdir -p "${S}/include/$(dirname ${i})"
104 + for j in ${libcxx_gcc_dirs} ; do
105 + if [ -f "${j}/${i}" ] ; then
106 + cp "${j}/${i}" "${S}/include/$(dirname ${i})/" || die
107 + found=yes
108 + fi
109 + done
110 + [ -n "${found}" ] || die "Header not found: ${i}"
111 + done
112 + fi
113 +
114 + tc-export AR CC CXX
115 +
116 + append-ldflags "-Wl,-z,defs" # make sure we are not underlinked
117 +}
118 +
119 +multilib_src_compile() {
120 + cd "${BUILD_DIR}/lib" || die
121 + emake shared
122 + use static-libs && emake static
123 +}
124 +
125 +# Tests fail for now, if anybody is able to fix them, help is very welcome.
126 +multilib_src_test() {
127 + cd "${BUILD_DIR}/test"
128 + LD_LIBRARY_PATH="${BUILD_DIR}/lib:${LD_LIBRARY_PATH}" \
129 + CC="clang++ $(get_abi_CFLAGS) ${CXXFLAGS}" \
130 + HEADER_INCLUDE="-I${BUILD_DIR}/include" \
131 + SOURCE_LIB="-L${BUILD_DIR}/lib" \
132 + LIBS="-lm $(usex libcxxrt -lcxxrt "")" \
133 + ./testit || die
134 + # TODO: fix link against libsupc++
135 +}
136 +
137 +# Usage: deps
138 +gen_ldscript() {
139 + local output_format
140 + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
141 + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
142 +
143 + cat <<-END_LDSCRIPT
144 +/* GNU ld script
145 + Include missing dependencies
146 +*/
147 +${output_format}
148 +GROUP ( $@ )
149 +END_LDSCRIPT
150 +}
151 +
152 +gen_static_ldscript() {
153 + if use libcxxrt ; then
154 + # Move it first.
155 + mv "${ED}/usr/$(get_libdir)/libc++.a" "${ED}/usr/$(get_libdir)/libc++_static.a" || die
156 +
157 + # Generate libc++.a ldscript for inclusion of its dependencies so that
158 + # clang++ -stdlib=libc++ -static works out of the box.
159 + local deps="${EPREFIX}/usr/$(get_libdir)/libc++_static.a ${EPREFIX}/usr/$(get_libdir)/libcxxrt.a"
160 + # On Linux/glibc it does not link without libpthread or libdl. It is
161 + # fine on FreeBSD.
162 + use elibc_glibc && deps="${deps} ${EPREFIX}/usr/$(get_libdir)/libpthread.a ${EPREFIX}/usr/$(get_libdir)/libdl.a"
163 +
164 + gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.a"
165 + fi
166 + # TODO: Generate a libc++.a ldscript when building against libsupc++
167 +}
168 +
169 +gen_shared_ldscript() {
170 + if use libcxxrt ; then
171 + mv "${ED}/usr/$(get_libdir)/libc++.so" "${ED}/usr/$(get_libdir)/libc++_shared.so" || die
172 + local deps="${EPREFIX}/usr/$(get_libdir)/libc++_shared.so ${EPREFIX}/usr/$(get_libdir)/libcxxrt.so"
173 + gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.so"
174 + fi
175 + # TODO: Generate the linker script for other confiurations too.
176 +}
177 +
178 +multilib_src_install() {
179 + cd "${BUILD_DIR}/lib"
180 + if use static-libs ; then
181 + dolib.a libc++.a
182 + gen_static_ldscript
183 + fi
184 + dolib.so libc++.so*
185 + gen_shared_ldscript
186 +}
187 +
188 +multilib_src_install_all() {
189 + einstalldocs
190 + insinto /usr/include/c++/v1
191 + doins -r include/*
192 +}
193 +
194 +pkg_postinst() {
195 + elog "This package (${PN}) is mainly intended as a replacement for the C++"
196 + elog "standard library when using clang."
197 + elog "To use it, instead of libstdc++, use:"
198 + elog " clang++ -stdlib=libc++"
199 + elog "to compile your C++ programs."
200 +}