Gentoo Archives: gentoo-commits

From: Jory Pratt <anarchy@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/musl:master commit in: sys-libs/libcxx/files/, sys-libs/libcxxabi/files/, sys-libs/libcxx/, ...
Date: Sat, 24 Jun 2017 04:00:36
Message-Id: 1498276733.1d974185dbc38218f03d6a571e148a307f8e4f64.anarchy@gentoo
1 commit: 1d974185dbc38218f03d6a571e148a307f8e4f64
2 Author: Jory A. Pratt <anarchy <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jun 24 03:58:53 2017 +0000
4 Commit: Jory Pratt <anarchy <AT> gentoo <DOT> org>
5 CommitDate: Sat Jun 24 03:58:53 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=1d974185
7
8 sys-libs/libcxx{,abi}: Fix build for max_align_t
9
10 sys-libs/libcxx/Manifest | 5 +
11 .../0001-check-for-musl-libcs-max_align_t.patch | 26 +++
12 .../libcxx/files/libcxx-3.9-cmake-link-flags.patch | 23 +++
13 sys-libs/libcxx/libcxx-4.0.0.ebuild | 200 +++++++++++++++++++++
14 sys-libs/libcxx/metadata.xml | 21 +++
15 sys-libs/libcxxabi/Manifest | 5 +
16 .../0001-check-for-musl-libcs-max_align_t.patch | 26 +++
17 sys-libs/libcxxabi/libcxxabi-4.0.0.ebuild | 97 ++++++++++
18 sys-libs/libcxxabi/metadata.xml | 10 ++
19 9 files changed, 413 insertions(+)
20
21 diff --git a/sys-libs/libcxx/Manifest b/sys-libs/libcxx/Manifest
22 new file mode 100644
23 index 0000000..06387ac
24 --- /dev/null
25 +++ b/sys-libs/libcxx/Manifest
26 @@ -0,0 +1,5 @@
27 +AUX 0001-check-for-musl-libcs-max_align_t.patch 725 SHA256 83810d4a065ba8554ac626e9281711bab4e68135b719a1891dd61f71a5efd1bd SHA512 0e151920d5325f73a7735d20baf5d14bb96d20351e7169ccd5dd98617a6e46c0add8e24b359f00430d211f9c0a27d519cb2e4b6f51be8121de21ccf53981940f WHIRLPOOL bc7dfe9b65d02f45539f5d9e55fb55202fda2bb212d31963a61d145513b5087d1fff033fac15d78cc5a93daddbdab7c3043077b97d38ca2d7789fe513fc231ee
28 +AUX libcxx-3.9-cmake-link-flags.patch 1014 SHA256 2a67d309f5aa802a8cb3d7fe76dff0a9c797e88a63f43fda758f9626afc8d4d0 SHA512 5df85c66bf865900197effe3905976bf165b4c4d79b8d14352753f6baca93ab5dc26bf735fd9478a0c13df489b860d8b629240134b7e26be6233138ea95dbab3 WHIRLPOOL b99590b6a0e1f4c0738d6bf95b4b379685a5ca5a32370938928656481234e22cf1acc788075a6af331406a70c8d8b0f81111ad392454df72ef58181d07d76d56
29 +DIST libcxx-4.0.0.src.tar.xz 1450376 SHA256 4f4d33c4ad69bf9e360eebe6b29b7b19486948b1a41decf89d4adec12473cf96 SHA512 6dad794c00919955e14710def169cdcde8a1743431479e993c4a6a3c87c2fd9f5dbd6e17542e524981eed0783dce70384c356b74ef3c6d70598c6ff03454b1dd WHIRLPOOL 2c5074087e306d100c96ae5b7175e1e1792f0317c7be6231692c80423ec716732c08293fe14fe6da5cd52d8709d6ce0a240009df24e717ab0eb9093ac7679af7
30 +EBUILD libcxx-4.0.0.ebuild 6360 SHA256 0b91ce9074adf0efe985110457d9ed59b405c263c6dbbdf0b30a4a0de981bd23 SHA512 0bd6c446a6073f3ebb6d41893d8fe45b527404590cfa38e352486ec612f010e2ca56ccb2fe19ffc23c98442464e48525e62717d0ad4928c45f9b0d0143180700 WHIRLPOOL 2ef81c93ef940240ebea9415f8b3a9024dc4b5932abd0446038a6548a528322fdf9c1240c186e42d81a79f7b46813106a6d9cb74b619cdf0747d2f95ed2e408d
31 +MISC metadata.xml 854 SHA256 3ec547619ec9246a8013afa8185cc2ec300c77ea5f7794627765fa54e5b8f621 SHA512 8ef3feab266e09442a42baced2d72667fa8b1290624c2c84bab7b173ead72669568847f6e995388fc1d7bc722381f60805d87b2a0cc2d04ae0c49e36bec3802a WHIRLPOOL 3ef9e4095a710085257d418bbb2ad7f10bfe026d65f1684fb75a36418ccd3c314521cb24ec7afd552551a114edc958aa7d3cafab5e8b38975f697767c6adb355
32
33 diff --git a/sys-libs/libcxx/files/0001-check-for-musl-libcs-max_align_t.patch b/sys-libs/libcxx/files/0001-check-for-musl-libcs-max_align_t.patch
34 new file mode 100644
35 index 0000000..d1094c9
36 --- /dev/null
37 +++ b/sys-libs/libcxx/files/0001-check-for-musl-libcs-max_align_t.patch
38 @@ -0,0 +1,26 @@
39 +From 7a72799513088762bef49b55438f3c42acc50ab2 Mon Sep 17 00:00:00 2001
40 +From:
41 +Date: Fri, 23 Jun 2017 22:27:04 -0500
42 +Subject: [PATCH] check-for-musl-libcs-max_align_t
43 +
44 +---
45 + include/stddef.h | 3 ++-
46 + 1 file changed, 2 insertions(+), 1 deletion(-)
47 +
48 +diff --git a/include/stddef.h b/include/stddef.h
49 +index 8841bbe..faf8552 100644
50 +--- a/include/stddef.h
51 ++++ b/include/stddef.h
52 +@@ -53,7 +53,8 @@ using std::nullptr_t;
53 + }
54 +
55 + // Re-use the compiler's <stddef.h> max_align_t where possible.
56 +-#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T)
57 ++#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) && \
58 ++ !defined(__DEFINED_max_align_t)
59 + typedef long double max_align_t;
60 + #endif
61 +
62 +--
63 +2.13.1
64 +
65
66 diff --git a/sys-libs/libcxx/files/libcxx-3.9-cmake-link-flags.patch b/sys-libs/libcxx/files/libcxx-3.9-cmake-link-flags.patch
67 new file mode 100644
68 index 0000000..bef5bc1
69 --- /dev/null
70 +++ b/sys-libs/libcxx/files/libcxx-3.9-cmake-link-flags.patch
71 @@ -0,0 +1,23 @@
72 +diff --git a/CMakeLists.txt b/CMakeLists.txt
73 +index d618e83..0e76525 100644
74 +--- a/CMakeLists.txt
75 ++++ b/CMakeLists.txt
76 +@@ -293,6 +293,18 @@ remove_flags(-DNDEBUG -UNDEBUG -D_DEBUG
77 + # so they don't get transformed into -Wno and -errors respectivly.
78 + remove_flags(-Wno-pedantic -pedantic-errors -pedantic)
79 +
80 ++# FIXME: this is cribbed from HandleLLVMOptions.cmake.
81 ++if(LIBCXX_STANDALONE_BUILD)
82 ++ # Pass -Wl,-z,defs. This makes sure all symbols are defined. Otherwise a DSO
83 ++ # build might work on ELF but fail on MachO/COFF.
84 ++ if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR WIN32 OR CYGWIN OR
85 ++ ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR
86 ++ ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") AND
87 ++ NOT LLVM_USE_SANITIZER)
88 ++ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")
89 ++ endif()
90 ++endif()
91 ++
92 + # Required flags ==============================================================
93 + add_compile_flags_if_supported(-std=c++11)
94 + if (NOT MSVC AND NOT LIBCXX_SUPPORTS_STD_EQ_CXX11_FLAG)
95
96 diff --git a/sys-libs/libcxx/libcxx-4.0.0.ebuild b/sys-libs/libcxx/libcxx-4.0.0.ebuild
97 new file mode 100644
98 index 0000000..dad54c2
99 --- /dev/null
100 +++ b/sys-libs/libcxx/libcxx-4.0.0.ebuild
101 @@ -0,0 +1,200 @@
102 +# Copyright 1999-2017 Gentoo Foundation
103 +# Distributed under the terms of the GNU General Public License v2
104 +
105 +EAPI=6
106 +
107 +# Ninja provides better scalability and cleaner verbose output, and is used
108 +# throughout all LLVM projects.
109 +: ${CMAKE_MAKEFILE_GENERATOR:=ninja}
110 +# (needed due to CMAKE_BUILD_TYPE != Gentoo)
111 +CMAKE_MIN_VERSION=3.7.0-r1
112 +PYTHON_COMPAT=( python2_7 )
113 +
114 +inherit cmake-multilib llvm python-any-r1 toolchain-funcs
115 +
116 +DESCRIPTION="New implementation of the C++ standard library, targeting C++11"
117 +HOMEPAGE="http://libcxx.llvm.org/"
118 +SRC_URI="http://releases.llvm.org/${PV/_//}/${P/_/}.src.tar.xz"
119 +
120 +LICENSE="|| ( UoI-NCSA MIT )"
121 +SLOT="0"
122 +KEYWORDS="~amd64 ~arm64 ~x86"
123 +IUSE="elibc_glibc elibc_musl +libcxxabi libcxxrt +libunwind +static-libs test"
124 +REQUIRED_USE="libunwind? ( || ( libcxxabi libcxxrt ) )
125 + ?? ( libcxxabi libcxxrt )"
126 +
127 +RDEPEND="
128 + libcxxabi? ( ~sys-libs/libcxxabi-${PV}[libunwind=,static-libs?,${MULTILIB_USEDEP}] )
129 + libcxxrt? ( sys-libs/libcxxrt[libunwind=,static-libs?,${MULTILIB_USEDEP}] )
130 + !libcxxabi? ( !libcxxrt? ( >=sys-devel/gcc-4.7:=[cxx] ) )"
131 +# LLVM 4 required for llvm-config --cmakedir
132 +# clang-3.9.0 installs necessary target symlinks unconditionally
133 +# which removes the need for MULTILIB_USEDEP
134 +DEPEND="${RDEPEND}
135 + test? ( >=sys-devel/clang-3.9.0
136 + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]') )
137 + app-arch/xz-utils
138 + >=sys-devel/llvm-4"
139 +
140 +S=${WORKDIR}/${P/_/}.src
141 +
142 +DOCS=( CREDITS.TXT )
143 +
144 +PATCHES=(
145 + # Add link flag "-Wl,-z,defs" to avoid underlinking; this is needed in a
146 + # out-of-tree build.
147 + "${FILESDIR}/${PN}-3.9-cmake-link-flags.patch"
148 + "${FILESDIR}/0001-check-for-musl-libcs-max_align_t.patch"
149 +)
150 +
151 +# least intrusive of all
152 +CMAKE_BUILD_TYPE=RelWithDebInfo
153 +
154 +python_check_deps() {
155 + has_version "dev-python/lit[${PYTHON_USEDEP}]"
156 +}
157 +
158 +pkg_setup() {
159 + llvm_pkg_setup
160 + use test && python-any-r1_pkg_setup
161 +
162 + if ! use libcxxabi && ! use libcxxrt && ! tc-is-gcc ; then
163 + eerror "To build ${PN} against libsupc++, you have to use gcc. Other"
164 + eerror "compilers are not supported. Please set CC=gcc and CXX=g++"
165 + eerror "and try again."
166 + die
167 + fi
168 + if tc-is-gcc && [[ $(gcc-version) < 4.7 ]] ; then
169 + eerror "${PN} needs to be built with gcc-4.7 or later (or other"
170 + eerror "conformant compilers). Please use gcc-config to switch to"
171 + eerror "gcc-4.7 or later version."
172 + die
173 + fi
174 +}
175 +
176 +multilib_src_configure() {
177 + local cxxabi cxxabi_incs
178 + if use libcxxabi; then
179 + cxxabi=libcxxabi
180 + cxxabi_incs="${EPREFIX}/usr/include/libcxxabi"
181 + elif use libcxxrt; then
182 + cxxabi=libcxxrt
183 + cxxabi_incs="${EPREFIX}/usr/include/libcxxrt"
184 + else
185 + local gcc_inc="${EPREFIX}/usr/lib/gcc/${CHOST}/$(gcc-fullversion)/include/g++-v$(gcc-major-version)"
186 + cxxabi=libsupc++
187 + cxxabi_incs="${gcc_inc};${gcc_inc}/${CHOST}"
188 + fi
189 +
190 + # we want -lgcc_s for unwinder, and for compiler runtime when using
191 + # gcc, clang with gcc runtime (or any unknown compiler)
192 + local extra_libs=() want_gcc_s=ON
193 + if use libunwind; then
194 + # work-around missing -lunwind upstream
195 + extra_libs+=( -lunwind )
196 + # if we're using libunwind and clang with compiler-rt, we want
197 + # to link to compiler-rt instead of -lgcc_s
198 + if tc-is-clang; then
199 + # get the full library list out of 'pretend mode'
200 + # and grep it for libclang_rt references
201 + local args=( $($(tc-getCC) -### -x c - 2>&1 | tail -n 1) )
202 + local i
203 + for i in "${args[@]}"; do
204 + if [[ ${i} == *libclang_rt* ]]; then
205 + want_gcc_s=OFF
206 + extra_libs+=( "${i}" )
207 + fi
208 + done
209 + fi
210 + fi
211 +
212 + local libdir=$(get_libdir)
213 + local mycmakeargs=(
214 + -DLIBCXX_LIBDIR_SUFFIX=${libdir#lib}
215 + -DLIBCXX_ENABLE_SHARED=ON
216 + -DLIBCXX_ENABLE_STATIC=$(usex static-libs)
217 + -DLIBCXX_CXX_ABI=${cxxabi}
218 + -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi_incs}
219 + # we're using our own mechanism for generating linker scripts
220 + -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
221 + -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
222 + -DLIBCXX_HAS_GCC_S_LIB=${want_gcc_s}
223 + -DLIBCXX_INCLUDE_TESTS=$(usex test)
224 + -DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}"
225 + )
226 +
227 + if use test; then
228 + mycmakeargs+=(
229 + # this can be any directory, it just needs to exist...
230 + # FIXME: remove this once https://reviews.llvm.org/D25093 is merged
231 + -DLLVM_MAIN_SRC_DIR="${T}"
232 + -DLIT_COMMAND="${EPREFIX}"/usr/bin/lit
233 + )
234 + fi
235 + cmake-utils_src_configure
236 +}
237 +
238 +multilib_src_test() {
239 + local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
240 +
241 + [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests"
242 + sed -i -e "/cxx_under_test/s^\".*\"^\"${clang_path}\"^" test/lit.site.cfg || die
243 +
244 + cmake-utils_src_make check-libcxx
245 +}
246 +
247 +# Usage: deps
248 +gen_ldscript() {
249 + local output_format
250 + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
251 + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
252 +
253 + cat <<-END_LDSCRIPT
254 +/* GNU ld script
255 + Include missing dependencies
256 +*/
257 +${output_format}
258 +GROUP ( $@ )
259 +END_LDSCRIPT
260 +}
261 +
262 +gen_static_ldscript() {
263 + local libdir=$(get_libdir)
264 + local cxxabi_lib=$(usex libcxxabi "libc++abi.a" "$(usex libcxxrt "libcxxrt.a" "libsupc++.a")")
265 +
266 + # Move it first.
267 + mv "${ED}/usr/${libdir}/libc++.a" "${ED}/usr/${libdir}/libc++_static.a" || die
268 + # Generate libc++.a ldscript for inclusion of its dependencies so that
269 + # clang++ -stdlib=libc++ -static works out of the box.
270 + local deps="libc++_static.a ${cxxabi_lib} $(usex libunwind libunwind.a libgcc_eh.a)"
271 + # On Linux/glibc it does not link without libpthread or libdl. It is
272 + # fine on FreeBSD.
273 + use elibc_glibc && deps+=" libpthread.a libdl.a"
274 +
275 + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.a" || die
276 +}
277 +
278 +gen_shared_ldscript() {
279 + local libdir=$(get_libdir)
280 + # libsupc++ doesn't have a shared version
281 + local cxxabi_lib=$(usex libcxxabi "libc++abi.so" "$(usex libcxxrt "libcxxrt.so" "libsupc++.a")")
282 +
283 + mv "${ED}/usr/${libdir}/libc++.so" "${ED}/usr/${libdir}/libc++_shared.so" || die
284 + local deps="libc++_shared.so ${cxxabi_lib} $(usex libunwind libunwind.so libgcc_s.so)"
285 +
286 + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.so" || die
287 +}
288 +
289 +multilib_src_install() {
290 + cmake-utils_src_install
291 + gen_shared_ldscript
292 + use static-libs && gen_static_ldscript
293 +}
294 +
295 +pkg_postinst() {
296 + elog "This package (${PN}) is mainly intended as a replacement for the C++"
297 + elog "standard library when using clang."
298 + elog "To use it, instead of libstdc++, use:"
299 + elog " clang++ -stdlib=libc++"
300 + elog "to compile your C++ programs."
301 +}
302
303 diff --git a/sys-libs/libcxx/metadata.xml b/sys-libs/libcxx/metadata.xml
304 new file mode 100644
305 index 0000000..df0c52d
306 --- /dev/null
307 +++ b/sys-libs/libcxx/metadata.xml
308 @@ -0,0 +1,21 @@
309 +<?xml version="1.0" encoding="UTF-8"?>
310 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
311 +<pkgmetadata>
312 + <maintainer type="person">
313 + <email>aballier@g.o</email>
314 + <name>Alexis Ballier</name>
315 + </maintainer>
316 + <maintainer type="project">
317 + <email>bsd@g.o</email>
318 + <name>BSD Project</name>
319 + </maintainer>
320 + <maintainer type="project">
321 + <email>llvm@g.o</email>
322 + <name>LLVM Project</name>
323 + </maintainer>
324 + <use>
325 + <flag name="libcxxabi">Build on top of <pkg>sys-libs/libcxxabi</pkg> instead of gcc's libsupc++ (avoids depending on gcc).</flag>
326 + <flag name="libcxxrt">Build on top of <pkg>sys-libs/libcxxrt</pkg> instead of gcc's libsupc++ (avoids depending on gcc).</flag>
327 + <flag name="libunwind">Use libunwind instead of libgcc_s for stack unwinding, thus avoiding dependence on gcc.</flag>
328 + </use>
329 +</pkgmetadata>
330
331 diff --git a/sys-libs/libcxxabi/Manifest b/sys-libs/libcxxabi/Manifest
332 new file mode 100644
333 index 0000000..e94736b
334 --- /dev/null
335 +++ b/sys-libs/libcxxabi/Manifest
336 @@ -0,0 +1,5 @@
337 +AUX 0001-check-for-musl-libcs-max_align_t.patch 725 SHA256 83810d4a065ba8554ac626e9281711bab4e68135b719a1891dd61f71a5efd1bd SHA512 0e151920d5325f73a7735d20baf5d14bb96d20351e7169ccd5dd98617a6e46c0add8e24b359f00430d211f9c0a27d519cb2e4b6f51be8121de21ccf53981940f WHIRLPOOL bc7dfe9b65d02f45539f5d9e55fb55202fda2bb212d31963a61d145513b5087d1fff033fac15d78cc5a93daddbdab7c3043077b97d38ca2d7789fe513fc231ee
338 +DIST libcxx-4.0.0.src.tar.xz 1450376 SHA256 4f4d33c4ad69bf9e360eebe6b29b7b19486948b1a41decf89d4adec12473cf96 SHA512 6dad794c00919955e14710def169cdcde8a1743431479e993c4a6a3c87c2fd9f5dbd6e17542e524981eed0783dce70384c356b74ef3c6d70598c6ff03454b1dd WHIRLPOOL 2c5074087e306d100c96ae5b7175e1e1792f0317c7be6231692c80423ec716732c08293fe14fe6da5cd52d8709d6ce0a240009df24e717ab0eb9093ac7679af7
339 +DIST libcxxabi-4.0.0.src.tar.xz 515560 SHA256 dca9cb619662ad2d3a0d685c4366078345247218c3702dd35bcaaa23f63481d8 SHA512 b69933a0bde00321323e98962cd54b78a48bc5e93448d7a5124cb5ef844497ba7648cd92fcbe476186c60c7742e3121841f150c142c2a14c1bf2aa26a8b93d64 WHIRLPOOL 1ec297df8fd7d2e8910f2db006cc5ae53abcca37cfab3f03c5371156f69fff39c1f9193eafa0cd907bb881c35948381b85cd86710e17c83e5b90be90e3841256
340 +EBUILD libcxxabi-4.0.0.ebuild 2587 SHA256 a56f8b2024f6053162ad6edb86f37c41653eab35e941518ff4e48a5232294b25 SHA512 872c1d3d0e53febbf3c56ddfe2d98aa3f067f52334c6eea0ac04d4c4fd8a88388afacfd5ff846bef45d239e05617275e40e8c0da8c2e1bc735383baf56ddfb01 WHIRLPOOL bd5f94b7f8bd7c3c8ef3e6c730a33c1a0c4b14dcae83c2d0963eda7b63e768548f9067d3d07d8678d400f135f1f6b93a8803181cedbc93a35af646c37747131b
341 +MISC metadata.xml 350 SHA256 19efe268c0747e237a6e9f54dde3471b5b562fa6d7f698853bc09a06aa1b0460 SHA512 317dd7b59a711dd0461b5369f7e31ea196882b018e047e1dbae8077274d06cb68542c8762efb852cce0b8021bedea69c19aa0c124b9414a36cf1a9c00e0b9703 WHIRLPOOL 0f5edd5b7c2c2bed62c5a69286bf2f8f465b31716a8670549717b10f1f78a5b529d225244869ca2fc5680ccf043208905e1e34508dc4f74c639572d938db9d6e
342
343 diff --git a/sys-libs/libcxxabi/files/0001-check-for-musl-libcs-max_align_t.patch b/sys-libs/libcxxabi/files/0001-check-for-musl-libcs-max_align_t.patch
344 new file mode 100644
345 index 0000000..d1094c9
346 --- /dev/null
347 +++ b/sys-libs/libcxxabi/files/0001-check-for-musl-libcs-max_align_t.patch
348 @@ -0,0 +1,26 @@
349 +From 7a72799513088762bef49b55438f3c42acc50ab2 Mon Sep 17 00:00:00 2001
350 +From:
351 +Date: Fri, 23 Jun 2017 22:27:04 -0500
352 +Subject: [PATCH] check-for-musl-libcs-max_align_t
353 +
354 +---
355 + include/stddef.h | 3 ++-
356 + 1 file changed, 2 insertions(+), 1 deletion(-)
357 +
358 +diff --git a/include/stddef.h b/include/stddef.h
359 +index 8841bbe..faf8552 100644
360 +--- a/include/stddef.h
361 ++++ b/include/stddef.h
362 +@@ -53,7 +53,8 @@ using std::nullptr_t;
363 + }
364 +
365 + // Re-use the compiler's <stddef.h> max_align_t where possible.
366 +-#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T)
367 ++#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) && \
368 ++ !defined(__DEFINED_max_align_t)
369 + typedef long double max_align_t;
370 + #endif
371 +
372 +--
373 +2.13.1
374 +
375
376 diff --git a/sys-libs/libcxxabi/libcxxabi-4.0.0.ebuild b/sys-libs/libcxxabi/libcxxabi-4.0.0.ebuild
377 new file mode 100644
378 index 0000000..c1b0a60
379 --- /dev/null
380 +++ b/sys-libs/libcxxabi/libcxxabi-4.0.0.ebuild
381 @@ -0,0 +1,97 @@
382 +# Copyright 1999-2017 Gentoo Foundation
383 +# Distributed under the terms of the GNU General Public License v2
384 +
385 +EAPI=6
386 +
387 +: ${CMAKE_MAKEFILE_GENERATOR:=ninja}
388 +# (needed due to CMAKE_BUILD_TYPE != Gentoo)
389 +CMAKE_MIN_VERSION=3.7.0-r1
390 +PYTHON_COMPAT=( python2_7 )
391 +
392 +inherit cmake-multilib llvm python-any-r1
393 +
394 +DESCRIPTION="Low level support for a standard C++ library"
395 +HOMEPAGE="http://libcxxabi.llvm.org/"
396 +SRC_URI="http://releases.llvm.org/${PV/_//}/${P/_/}.src.tar.xz
397 + http://releases.llvm.org/${PV/_//}/libcxx-${PV/_/}.src.tar.xz"
398 +
399 +LICENSE="|| ( UoI-NCSA MIT )"
400 +SLOT="0"
401 +KEYWORDS="~amd64 ~arm64 ~x86"
402 +IUSE="+libunwind +static-libs test"
403 +
404 +RDEPEND="
405 + libunwind? (
406 + || (
407 + >=sys-libs/libunwind-1.0.1-r1[static-libs?,${MULTILIB_USEDEP}]
408 + >=sys-libs/llvm-libunwind-3.9.0-r1[static-libs?,${MULTILIB_USEDEP}]
409 + )
410 + )"
411 +# LLVM 4 required for llvm-config --cmakedir
412 +DEPEND="${RDEPEND}
413 + >=sys-devel/llvm-4
414 + test? ( >=sys-devel/clang-3.9.0
415 + ~sys-libs/libcxx-${PV}[libcxxabi(-)]
416 + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]') )"
417 +
418 +S=${WORKDIR}/${P/_/}.src
419 +S1=${WORKDIR}/libcxx
420 +
421 +# least intrusive of all
422 +CMAKE_BUILD_TYPE=RelWithDebInfo
423 +
424 +python_check_deps() {
425 + has_version "dev-python/lit[${PYTHON_USEDEP}]"
426 +}
427 +
428 +pkg_setup() {
429 + llvm_pkg_setup
430 + use test && python-any-r1_pkg_setup
431 +}
432 +
433 +src_unpack() {
434 + default
435 +
436 + mv libcxx-* libcxx || die
437 + cd ${S1}
438 + eapply "${FILESDIR}"/0001-check-for-musl-libcs-max_align_t.patch
439 +}
440 +
441 +multilib_src_configure() {
442 + local libdir=$(get_libdir)
443 + local mycmakeargs=(
444 + -DLIBCXXABI_LIBDIR_SUFFIX=${libdir#lib}
445 + -DLIBCXXABI_ENABLE_SHARED=ON
446 + -DLIBCXXABI_ENABLE_STATIC=$(usex static-libs)
447 + -DLIBCXXABI_USE_LLVM_UNWINDER=$(usex libunwind)
448 + -DLIBCXXABI_INCLUDE_TESTS=$(usex test)
449 +
450 + -DLIBCXXABI_LIBCXX_INCLUDES="${WORKDIR}"/libcxx/include
451 + # upstream is omitting standard search path for this
452 + # probably because gcc & clang are bundling their own unwind.h
453 + -DLIBCXXABI_LIBUNWIND_INCLUDES="${EPREFIX}"/usr/include
454 + # this only needs to exist, it does not have to make sense
455 + # FIXME: remove this once https://reviews.llvm.org/D25314 is merged
456 + -DLIBCXXABI_LIBUNWIND_SOURCES="${T}"
457 + )
458 + if use test; then
459 + mycmakeargs+=(
460 + -DLIT_COMMAND="${EPREFIX}"/usr/bin/lit
461 + )
462 + fi
463 + cmake-utils_src_configure
464 +}
465 +
466 +multilib_src_test() {
467 + local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
468 +
469 + [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests"
470 + sed -i -e "/cxx_under_test/s^\".*\"^\"${clang_path}\"^" test/lit.site.cfg || die
471 +
472 + cmake-utils_src_make check-libcxxabi
473 +}
474 +
475 +multilib_src_install_all() {
476 + insinto /usr/include/libcxxabi
477 + doins -r include/.
478 +}
479
480 diff --git a/sys-libs/libcxxabi/metadata.xml b/sys-libs/libcxxabi/metadata.xml
481 new file mode 100644
482 index 0000000..78c7d7d
483 --- /dev/null
484 +++ b/sys-libs/libcxxabi/metadata.xml
485 @@ -0,0 +1,10 @@
486 +<?xml version="1.0" encoding="UTF-8"?>
487 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
488 +<pkgmetadata>
489 + <maintainer type="project">
490 + <email>llvm@g.o</email>
491 + </maintainer>
492 + <use>
493 + <flag name="libunwind">Use libunwind instead of libgcc_s for stack unwinding, thus avoiding dependency on gcc</flag>
494 + </use>
495 +</pkgmetadata>