aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJory A. Pratt <anarchy@gentoo.org>2017-06-23 22:58:53 -0500
committerJory A. Pratt <anarchy@gentoo.org>2017-06-23 22:58:53 -0500
commit1d974185dbc38218f03d6a571e148a307f8e4f64 (patch)
tree93c74acc39880335069b0e3e222eced4ab64f9ff
parentnet-libs/webkit-gtk: version bump to 2.16.4 (diff)
downloadmusl-1d974185.tar.gz
musl-1d974185.tar.bz2
musl-1d974185.zip
sys-libs/libcxx{,abi}: Fix build for max_align_t
-rw-r--r--sys-libs/libcxx/Manifest5
-rw-r--r--sys-libs/libcxx/files/0001-check-for-musl-libcs-max_align_t.patch26
-rw-r--r--sys-libs/libcxx/files/libcxx-3.9-cmake-link-flags.patch23
-rw-r--r--sys-libs/libcxx/libcxx-4.0.0.ebuild200
-rw-r--r--sys-libs/libcxx/metadata.xml21
-rw-r--r--sys-libs/libcxxabi/Manifest5
-rw-r--r--sys-libs/libcxxabi/files/0001-check-for-musl-libcs-max_align_t.patch26
-rw-r--r--sys-libs/libcxxabi/libcxxabi-4.0.0.ebuild97
-rw-r--r--sys-libs/libcxxabi/metadata.xml10
9 files changed, 413 insertions, 0 deletions
diff --git a/sys-libs/libcxx/Manifest b/sys-libs/libcxx/Manifest
new file mode 100644
index 00000000..06387ac8
--- /dev/null
+++ b/sys-libs/libcxx/Manifest
@@ -0,0 +1,5 @@
+AUX 0001-check-for-musl-libcs-max_align_t.patch 725 SHA256 83810d4a065ba8554ac626e9281711bab4e68135b719a1891dd61f71a5efd1bd SHA512 0e151920d5325f73a7735d20baf5d14bb96d20351e7169ccd5dd98617a6e46c0add8e24b359f00430d211f9c0a27d519cb2e4b6f51be8121de21ccf53981940f WHIRLPOOL bc7dfe9b65d02f45539f5d9e55fb55202fda2bb212d31963a61d145513b5087d1fff033fac15d78cc5a93daddbdab7c3043077b97d38ca2d7789fe513fc231ee
+AUX libcxx-3.9-cmake-link-flags.patch 1014 SHA256 2a67d309f5aa802a8cb3d7fe76dff0a9c797e88a63f43fda758f9626afc8d4d0 SHA512 5df85c66bf865900197effe3905976bf165b4c4d79b8d14352753f6baca93ab5dc26bf735fd9478a0c13df489b860d8b629240134b7e26be6233138ea95dbab3 WHIRLPOOL b99590b6a0e1f4c0738d6bf95b4b379685a5ca5a32370938928656481234e22cf1acc788075a6af331406a70c8d8b0f81111ad392454df72ef58181d07d76d56
+DIST libcxx-4.0.0.src.tar.xz 1450376 SHA256 4f4d33c4ad69bf9e360eebe6b29b7b19486948b1a41decf89d4adec12473cf96 SHA512 6dad794c00919955e14710def169cdcde8a1743431479e993c4a6a3c87c2fd9f5dbd6e17542e524981eed0783dce70384c356b74ef3c6d70598c6ff03454b1dd WHIRLPOOL 2c5074087e306d100c96ae5b7175e1e1792f0317c7be6231692c80423ec716732c08293fe14fe6da5cd52d8709d6ce0a240009df24e717ab0eb9093ac7679af7
+EBUILD libcxx-4.0.0.ebuild 6360 SHA256 0b91ce9074adf0efe985110457d9ed59b405c263c6dbbdf0b30a4a0de981bd23 SHA512 0bd6c446a6073f3ebb6d41893d8fe45b527404590cfa38e352486ec612f010e2ca56ccb2fe19ffc23c98442464e48525e62717d0ad4928c45f9b0d0143180700 WHIRLPOOL 2ef81c93ef940240ebea9415f8b3a9024dc4b5932abd0446038a6548a528322fdf9c1240c186e42d81a79f7b46813106a6d9cb74b619cdf0747d2f95ed2e408d
+MISC metadata.xml 854 SHA256 3ec547619ec9246a8013afa8185cc2ec300c77ea5f7794627765fa54e5b8f621 SHA512 8ef3feab266e09442a42baced2d72667fa8b1290624c2c84bab7b173ead72669568847f6e995388fc1d7bc722381f60805d87b2a0cc2d04ae0c49e36bec3802a WHIRLPOOL 3ef9e4095a710085257d418bbb2ad7f10bfe026d65f1684fb75a36418ccd3c314521cb24ec7afd552551a114edc958aa7d3cafab5e8b38975f697767c6adb355
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
new file mode 100644
index 00000000..d1094c9e
--- /dev/null
+++ b/sys-libs/libcxx/files/0001-check-for-musl-libcs-max_align_t.patch
@@ -0,0 +1,26 @@
+From 7a72799513088762bef49b55438f3c42acc50ab2 Mon Sep 17 00:00:00 2001
+From:
+Date: Fri, 23 Jun 2017 22:27:04 -0500
+Subject: [PATCH] check-for-musl-libcs-max_align_t
+
+---
+ include/stddef.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/include/stddef.h b/include/stddef.h
+index 8841bbe..faf8552 100644
+--- a/include/stddef.h
++++ b/include/stddef.h
+@@ -53,7 +53,8 @@ using std::nullptr_t;
+ }
+
+ // Re-use the compiler's <stddef.h> max_align_t where possible.
+-#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T)
++#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) && \
++ !defined(__DEFINED_max_align_t)
+ typedef long double max_align_t;
+ #endif
+
+--
+2.13.1
+
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
new file mode 100644
index 00000000..bef5bc18
--- /dev/null
+++ b/sys-libs/libcxx/files/libcxx-3.9-cmake-link-flags.patch
@@ -0,0 +1,23 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index d618e83..0e76525 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -293,6 +293,18 @@ remove_flags(-DNDEBUG -UNDEBUG -D_DEBUG
+ # so they don't get transformed into -Wno and -errors respectivly.
+ remove_flags(-Wno-pedantic -pedantic-errors -pedantic)
+
++# FIXME: this is cribbed from HandleLLVMOptions.cmake.
++if(LIBCXX_STANDALONE_BUILD)
++ # Pass -Wl,-z,defs. This makes sure all symbols are defined. Otherwise a DSO
++ # build might work on ELF but fail on MachO/COFF.
++ if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR WIN32 OR CYGWIN OR
++ ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR
++ ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") AND
++ NOT LLVM_USE_SANITIZER)
++ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")
++ endif()
++endif()
++
+ # Required flags ==============================================================
+ add_compile_flags_if_supported(-std=c++11)
+ if (NOT MSVC AND NOT LIBCXX_SUPPORTS_STD_EQ_CXX11_FLAG)
diff --git a/sys-libs/libcxx/libcxx-4.0.0.ebuild b/sys-libs/libcxx/libcxx-4.0.0.ebuild
new file mode 100644
index 00000000..dad54c23
--- /dev/null
+++ b/sys-libs/libcxx/libcxx-4.0.0.ebuild
@@ -0,0 +1,200 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+# Ninja provides better scalability and cleaner verbose output, and is used
+# throughout all LLVM projects.
+: ${CMAKE_MAKEFILE_GENERATOR:=ninja}
+# (needed due to CMAKE_BUILD_TYPE != Gentoo)
+CMAKE_MIN_VERSION=3.7.0-r1
+PYTHON_COMPAT=( python2_7 )
+
+inherit cmake-multilib llvm python-any-r1 toolchain-funcs
+
+DESCRIPTION="New implementation of the C++ standard library, targeting C++11"
+HOMEPAGE="http://libcxx.llvm.org/"
+SRC_URI="http://releases.llvm.org/${PV/_//}/${P/_/}.src.tar.xz"
+
+LICENSE="|| ( UoI-NCSA MIT )"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~x86"
+IUSE="elibc_glibc elibc_musl +libcxxabi libcxxrt +libunwind +static-libs test"
+REQUIRED_USE="libunwind? ( || ( libcxxabi libcxxrt ) )
+ ?? ( libcxxabi libcxxrt )"
+
+RDEPEND="
+ libcxxabi? ( ~sys-libs/libcxxabi-${PV}[libunwind=,static-libs?,${MULTILIB_USEDEP}] )
+ libcxxrt? ( sys-libs/libcxxrt[libunwind=,static-libs?,${MULTILIB_USEDEP}] )
+ !libcxxabi? ( !libcxxrt? ( >=sys-devel/gcc-4.7:=[cxx] ) )"
+# LLVM 4 required for llvm-config --cmakedir
+# clang-3.9.0 installs necessary target symlinks unconditionally
+# which removes the need for MULTILIB_USEDEP
+DEPEND="${RDEPEND}
+ test? ( >=sys-devel/clang-3.9.0
+ $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]') )
+ app-arch/xz-utils
+ >=sys-devel/llvm-4"
+
+S=${WORKDIR}/${P/_/}.src
+
+DOCS=( CREDITS.TXT )
+
+PATCHES=(
+ # Add link flag "-Wl,-z,defs" to avoid underlinking; this is needed in a
+ # out-of-tree build.
+ "${FILESDIR}/${PN}-3.9-cmake-link-flags.patch"
+ "${FILESDIR}/0001-check-for-musl-libcs-max_align_t.patch"
+)
+
+# least intrusive of all
+CMAKE_BUILD_TYPE=RelWithDebInfo
+
+python_check_deps() {
+ has_version "dev-python/lit[${PYTHON_USEDEP}]"
+}
+
+pkg_setup() {
+ llvm_pkg_setup
+ use test && python-any-r1_pkg_setup
+
+ if ! use libcxxabi && ! use libcxxrt && ! tc-is-gcc ; then
+ eerror "To build ${PN} against libsupc++, you have to use gcc. Other"
+ eerror "compilers are not supported. Please set CC=gcc and CXX=g++"
+ eerror "and try again."
+ die
+ fi
+ if tc-is-gcc && [[ $(gcc-version) < 4.7 ]] ; then
+ eerror "${PN} needs to be built with gcc-4.7 or later (or other"
+ eerror "conformant compilers). Please use gcc-config to switch to"
+ eerror "gcc-4.7 or later version."
+ die
+ fi
+}
+
+multilib_src_configure() {
+ local cxxabi cxxabi_incs
+ if use libcxxabi; then
+ cxxabi=libcxxabi
+ cxxabi_incs="${EPREFIX}/usr/include/libcxxabi"
+ elif use libcxxrt; then
+ cxxabi=libcxxrt
+ cxxabi_incs="${EPREFIX}/usr/include/libcxxrt"
+ else
+ local gcc_inc="${EPREFIX}/usr/lib/gcc/${CHOST}/$(gcc-fullversion)/include/g++-v$(gcc-major-version)"
+ cxxabi=libsupc++
+ cxxabi_incs="${gcc_inc};${gcc_inc}/${CHOST}"
+ fi
+
+ # we want -lgcc_s for unwinder, and for compiler runtime when using
+ # gcc, clang with gcc runtime (or any unknown compiler)
+ local extra_libs=() want_gcc_s=ON
+ if use libunwind; then
+ # work-around missing -lunwind upstream
+ extra_libs+=( -lunwind )
+ # if we're using libunwind and clang with compiler-rt, we want
+ # to link to compiler-rt instead of -lgcc_s
+ if tc-is-clang; then
+ # get the full library list out of 'pretend mode'
+ # and grep it for libclang_rt references
+ local args=( $($(tc-getCC) -### -x c - 2>&1 | tail -n 1) )
+ local i
+ for i in "${args[@]}"; do
+ if [[ ${i} == *libclang_rt* ]]; then
+ want_gcc_s=OFF
+ extra_libs+=( "${i}" )
+ fi
+ done
+ fi
+ fi
+
+ local libdir=$(get_libdir)
+ local mycmakeargs=(
+ -DLIBCXX_LIBDIR_SUFFIX=${libdir#lib}
+ -DLIBCXX_ENABLE_SHARED=ON
+ -DLIBCXX_ENABLE_STATIC=$(usex static-libs)
+ -DLIBCXX_CXX_ABI=${cxxabi}
+ -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi_incs}
+ # we're using our own mechanism for generating linker scripts
+ -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
+ -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
+ -DLIBCXX_HAS_GCC_S_LIB=${want_gcc_s}
+ -DLIBCXX_INCLUDE_TESTS=$(usex test)
+ -DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}"
+ )
+
+ if use test; then
+ mycmakeargs+=(
+ # this can be any directory, it just needs to exist...
+ # FIXME: remove this once https://reviews.llvm.org/D25093 is merged
+ -DLLVM_MAIN_SRC_DIR="${T}"
+ -DLIT_COMMAND="${EPREFIX}"/usr/bin/lit
+ )
+ fi
+ cmake-utils_src_configure
+}
+
+multilib_src_test() {
+ local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
+
+ [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests"
+ sed -i -e "/cxx_under_test/s^\".*\"^\"${clang_path}\"^" test/lit.site.cfg || die
+
+ cmake-utils_src_make check-libcxx
+}
+
+# Usage: deps
+gen_ldscript() {
+ local output_format
+ output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
+ [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
+
+ cat <<-END_LDSCRIPT
+/* GNU ld script
+ Include missing dependencies
+*/
+${output_format}
+GROUP ( $@ )
+END_LDSCRIPT
+}
+
+gen_static_ldscript() {
+ local libdir=$(get_libdir)
+ local cxxabi_lib=$(usex libcxxabi "libc++abi.a" "$(usex libcxxrt "libcxxrt.a" "libsupc++.a")")
+
+ # Move it first.
+ mv "${ED}/usr/${libdir}/libc++.a" "${ED}/usr/${libdir}/libc++_static.a" || die
+ # Generate libc++.a ldscript for inclusion of its dependencies so that
+ # clang++ -stdlib=libc++ -static works out of the box.
+ local deps="libc++_static.a ${cxxabi_lib} $(usex libunwind libunwind.a libgcc_eh.a)"
+ # On Linux/glibc it does not link without libpthread or libdl. It is
+ # fine on FreeBSD.
+ use elibc_glibc && deps+=" libpthread.a libdl.a"
+
+ gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.a" || die
+}
+
+gen_shared_ldscript() {
+ local libdir=$(get_libdir)
+ # libsupc++ doesn't have a shared version
+ local cxxabi_lib=$(usex libcxxabi "libc++abi.so" "$(usex libcxxrt "libcxxrt.so" "libsupc++.a")")
+
+ mv "${ED}/usr/${libdir}/libc++.so" "${ED}/usr/${libdir}/libc++_shared.so" || die
+ local deps="libc++_shared.so ${cxxabi_lib} $(usex libunwind libunwind.so libgcc_s.so)"
+
+ gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.so" || die
+}
+
+multilib_src_install() {
+ cmake-utils_src_install
+ gen_shared_ldscript
+ use static-libs && gen_static_ldscript
+}
+
+pkg_postinst() {
+ elog "This package (${PN}) is mainly intended as a replacement for the C++"
+ elog "standard library when using clang."
+ elog "To use it, instead of libstdc++, use:"
+ elog " clang++ -stdlib=libc++"
+ elog "to compile your C++ programs."
+}
diff --git a/sys-libs/libcxx/metadata.xml b/sys-libs/libcxx/metadata.xml
new file mode 100644
index 00000000..df0c52dc
--- /dev/null
+++ b/sys-libs/libcxx/metadata.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>aballier@gentoo.org</email>
+ <name>Alexis Ballier</name>
+ </maintainer>
+ <maintainer type="project">
+ <email>bsd@gentoo.org</email>
+ <name>BSD Project</name>
+ </maintainer>
+ <maintainer type="project">
+ <email>llvm@gentoo.org</email>
+ <name>LLVM Project</name>
+ </maintainer>
+ <use>
+ <flag name="libcxxabi">Build on top of <pkg>sys-libs/libcxxabi</pkg> instead of gcc's libsupc++ (avoids depending on gcc).</flag>
+ <flag name="libcxxrt">Build on top of <pkg>sys-libs/libcxxrt</pkg> instead of gcc's libsupc++ (avoids depending on gcc).</flag>
+ <flag name="libunwind">Use libunwind instead of libgcc_s for stack unwinding, thus avoiding dependence on gcc.</flag>
+ </use>
+</pkgmetadata>
diff --git a/sys-libs/libcxxabi/Manifest b/sys-libs/libcxxabi/Manifest
new file mode 100644
index 00000000..e94736bf
--- /dev/null
+++ b/sys-libs/libcxxabi/Manifest
@@ -0,0 +1,5 @@
+AUX 0001-check-for-musl-libcs-max_align_t.patch 725 SHA256 83810d4a065ba8554ac626e9281711bab4e68135b719a1891dd61f71a5efd1bd SHA512 0e151920d5325f73a7735d20baf5d14bb96d20351e7169ccd5dd98617a6e46c0add8e24b359f00430d211f9c0a27d519cb2e4b6f51be8121de21ccf53981940f WHIRLPOOL bc7dfe9b65d02f45539f5d9e55fb55202fda2bb212d31963a61d145513b5087d1fff033fac15d78cc5a93daddbdab7c3043077b97d38ca2d7789fe513fc231ee
+DIST libcxx-4.0.0.src.tar.xz 1450376 SHA256 4f4d33c4ad69bf9e360eebe6b29b7b19486948b1a41decf89d4adec12473cf96 SHA512 6dad794c00919955e14710def169cdcde8a1743431479e993c4a6a3c87c2fd9f5dbd6e17542e524981eed0783dce70384c356b74ef3c6d70598c6ff03454b1dd WHIRLPOOL 2c5074087e306d100c96ae5b7175e1e1792f0317c7be6231692c80423ec716732c08293fe14fe6da5cd52d8709d6ce0a240009df24e717ab0eb9093ac7679af7
+DIST libcxxabi-4.0.0.src.tar.xz 515560 SHA256 dca9cb619662ad2d3a0d685c4366078345247218c3702dd35bcaaa23f63481d8 SHA512 b69933a0bde00321323e98962cd54b78a48bc5e93448d7a5124cb5ef844497ba7648cd92fcbe476186c60c7742e3121841f150c142c2a14c1bf2aa26a8b93d64 WHIRLPOOL 1ec297df8fd7d2e8910f2db006cc5ae53abcca37cfab3f03c5371156f69fff39c1f9193eafa0cd907bb881c35948381b85cd86710e17c83e5b90be90e3841256
+EBUILD libcxxabi-4.0.0.ebuild 2587 SHA256 a56f8b2024f6053162ad6edb86f37c41653eab35e941518ff4e48a5232294b25 SHA512 872c1d3d0e53febbf3c56ddfe2d98aa3f067f52334c6eea0ac04d4c4fd8a88388afacfd5ff846bef45d239e05617275e40e8c0da8c2e1bc735383baf56ddfb01 WHIRLPOOL bd5f94b7f8bd7c3c8ef3e6c730a33c1a0c4b14dcae83c2d0963eda7b63e768548f9067d3d07d8678d400f135f1f6b93a8803181cedbc93a35af646c37747131b
+MISC metadata.xml 350 SHA256 19efe268c0747e237a6e9f54dde3471b5b562fa6d7f698853bc09a06aa1b0460 SHA512 317dd7b59a711dd0461b5369f7e31ea196882b018e047e1dbae8077274d06cb68542c8762efb852cce0b8021bedea69c19aa0c124b9414a36cf1a9c00e0b9703 WHIRLPOOL 0f5edd5b7c2c2bed62c5a69286bf2f8f465b31716a8670549717b10f1f78a5b529d225244869ca2fc5680ccf043208905e1e34508dc4f74c639572d938db9d6e
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
new file mode 100644
index 00000000..d1094c9e
--- /dev/null
+++ b/sys-libs/libcxxabi/files/0001-check-for-musl-libcs-max_align_t.patch
@@ -0,0 +1,26 @@
+From 7a72799513088762bef49b55438f3c42acc50ab2 Mon Sep 17 00:00:00 2001
+From:
+Date: Fri, 23 Jun 2017 22:27:04 -0500
+Subject: [PATCH] check-for-musl-libcs-max_align_t
+
+---
+ include/stddef.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/include/stddef.h b/include/stddef.h
+index 8841bbe..faf8552 100644
+--- a/include/stddef.h
++++ b/include/stddef.h
+@@ -53,7 +53,8 @@ using std::nullptr_t;
+ }
+
+ // Re-use the compiler's <stddef.h> max_align_t where possible.
+-#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T)
++#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) && \
++ !defined(__DEFINED_max_align_t)
+ typedef long double max_align_t;
+ #endif
+
+--
+2.13.1
+
diff --git a/sys-libs/libcxxabi/libcxxabi-4.0.0.ebuild b/sys-libs/libcxxabi/libcxxabi-4.0.0.ebuild
new file mode 100644
index 00000000..c1b0a603
--- /dev/null
+++ b/sys-libs/libcxxabi/libcxxabi-4.0.0.ebuild
@@ -0,0 +1,97 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+: ${CMAKE_MAKEFILE_GENERATOR:=ninja}
+# (needed due to CMAKE_BUILD_TYPE != Gentoo)
+CMAKE_MIN_VERSION=3.7.0-r1
+PYTHON_COMPAT=( python2_7 )
+
+inherit cmake-multilib llvm python-any-r1
+
+DESCRIPTION="Low level support for a standard C++ library"
+HOMEPAGE="http://libcxxabi.llvm.org/"
+SRC_URI="http://releases.llvm.org/${PV/_//}/${P/_/}.src.tar.xz
+ http://releases.llvm.org/${PV/_//}/libcxx-${PV/_/}.src.tar.xz"
+
+LICENSE="|| ( UoI-NCSA MIT )"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~x86"
+IUSE="+libunwind +static-libs test"
+
+RDEPEND="
+ libunwind? (
+ || (
+ >=sys-libs/libunwind-1.0.1-r1[static-libs?,${MULTILIB_USEDEP}]
+ >=sys-libs/llvm-libunwind-3.9.0-r1[static-libs?,${MULTILIB_USEDEP}]
+ )
+ )"
+# LLVM 4 required for llvm-config --cmakedir
+DEPEND="${RDEPEND}
+ >=sys-devel/llvm-4
+ test? ( >=sys-devel/clang-3.9.0
+ ~sys-libs/libcxx-${PV}[libcxxabi(-)]
+ $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]') )"
+
+S=${WORKDIR}/${P/_/}.src
+S1=${WORKDIR}/libcxx
+
+# least intrusive of all
+CMAKE_BUILD_TYPE=RelWithDebInfo
+
+python_check_deps() {
+ has_version "dev-python/lit[${PYTHON_USEDEP}]"
+}
+
+pkg_setup() {
+ llvm_pkg_setup
+ use test && python-any-r1_pkg_setup
+}
+
+src_unpack() {
+ default
+
+ mv libcxx-* libcxx || die
+ cd ${S1}
+ eapply "${FILESDIR}"/0001-check-for-musl-libcs-max_align_t.patch
+}
+
+multilib_src_configure() {
+ local libdir=$(get_libdir)
+ local mycmakeargs=(
+ -DLIBCXXABI_LIBDIR_SUFFIX=${libdir#lib}
+ -DLIBCXXABI_ENABLE_SHARED=ON
+ -DLIBCXXABI_ENABLE_STATIC=$(usex static-libs)
+ -DLIBCXXABI_USE_LLVM_UNWINDER=$(usex libunwind)
+ -DLIBCXXABI_INCLUDE_TESTS=$(usex test)
+
+ -DLIBCXXABI_LIBCXX_INCLUDES="${WORKDIR}"/libcxx/include
+ # upstream is omitting standard search path for this
+ # probably because gcc & clang are bundling their own unwind.h
+ -DLIBCXXABI_LIBUNWIND_INCLUDES="${EPREFIX}"/usr/include
+ # this only needs to exist, it does not have to make sense
+ # FIXME: remove this once https://reviews.llvm.org/D25314 is merged
+ -DLIBCXXABI_LIBUNWIND_SOURCES="${T}"
+ )
+ if use test; then
+ mycmakeargs+=(
+ -DLIT_COMMAND="${EPREFIX}"/usr/bin/lit
+ )
+ fi
+ cmake-utils_src_configure
+}
+
+multilib_src_test() {
+ local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
+
+ [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests"
+ sed -i -e "/cxx_under_test/s^\".*\"^\"${clang_path}\"^" test/lit.site.cfg || die
+
+ cmake-utils_src_make check-libcxxabi
+}
+
+multilib_src_install_all() {
+ insinto /usr/include/libcxxabi
+ doins -r include/.
+}
diff --git a/sys-libs/libcxxabi/metadata.xml b/sys-libs/libcxxabi/metadata.xml
new file mode 100644
index 00000000..78c7d7d9
--- /dev/null
+++ b/sys-libs/libcxxabi/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>llvm@gentoo.org</email>
+ </maintainer>
+ <use>
+ <flag name="libunwind">Use libunwind instead of libgcc_s for stack unwinding, thus avoiding dependency on gcc</flag>
+ </use>
+</pkgmetadata>