summaryrefslogtreecommitdiff
path: root/sys-libs/libcxx
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2019-12-15 18:09:03 +0000
committerV3n3RiX <venerix@redcorelinux.org>2019-12-15 18:09:03 +0000
commit7bc9c63c9da678a7e6fceb095d56c634afd22c56 (patch)
tree4a67d50a439e9af63947e5f8b6ba3719af98b6c9 /sys-libs/libcxx
parentb284a3168fa91a038925d2ecf5e4791011ea5e7d (diff)
gentoo resync : 15.12.2019
Diffstat (limited to 'sys-libs/libcxx')
-rw-r--r--sys-libs/libcxx/Manifest12
-rw-r--r--sys-libs/libcxx/libcxx-10.0.0.9999.ebuild4
-rw-r--r--sys-libs/libcxx/libcxx-9.0.0.ebuild4
-rw-r--r--sys-libs/libcxx/libcxx-9.0.1.9999.ebuild4
-rw-r--r--sys-libs/libcxx/libcxx-9.0.1_rc2.ebuild (renamed from sys-libs/libcxx/libcxx-6.0.1.ebuild)34
-rw-r--r--sys-libs/libcxx/libcxx-9.0.1_rc3.ebuild211
6 files changed, 242 insertions, 27 deletions
diff --git a/sys-libs/libcxx/Manifest b/sys-libs/libcxx/Manifest
index 83ce7e973e97..6bd927f4a91c 100644
--- a/sys-libs/libcxx/Manifest
+++ b/sys-libs/libcxx/Manifest
@@ -1,12 +1,14 @@
AUX libcxx-3.9-cmake-link-flags.patch 1014 BLAKE2B 8e86059e00a5ebcd7a1528882876607c80ab14bcd0ebf2c8dbec87f71a48761e6433ff94db92b41192edb6e3cc74972cd9fb518f18a657229bd30afa3a65bdf8 SHA512 5df85c66bf865900197effe3905976bf165b4c4d79b8d14352753f6baca93ab5dc26bf735fd9478a0c13df489b860d8b629240134b7e26be6233138ea95dbab3
-DIST libcxx-6.0.1.src.tar.xz 1552328 BLAKE2B 65a6addd04e530c2a72e8cba207282b9e9fafc01a594d7b11f63d10b6f88eca67a3cdf90b8055e410ede358d9be1f63fbe427f308e1337833447c0260d96e1c8 SHA512 c04f628b0924d76f035f615b59d19ce42dfc19c9a8eea4fe2b22a95cfe5a037ebdb30943fd741443939df5b4cf692bc1e51c840fefefbd134e3afbe2a75fe875
DIST libcxx-7.1.0.src.tar.xz 1638448 BLAKE2B eca192e03f839f4323e3c37beba2e6daaf935d4e784e0bc835a4d2c3ce0790f5539bdca0466feafd668d7c6675b11b7fe14d9adb680c46fd7b28b42a3b423219 SHA512 925ce5093445f84dc17d5b1610e4297ef3606b254b7350c50f88ba042fcca62125ffd97d21cb612707d5e9511267634ca1779619199f95ce819e5f5c0c2b55d5
DIST libcxx-8.0.1.src.tar.xz 1739524 BLAKE2B 6e641cb6bda0de12c8408d3ab33f627389ac014aa65b3391c870aa96ffd347784e6b70b953bd1ee8eba56554e0f78a723ab77b9dba5f85e6219e2b95ca50c160 SHA512 75749d08b2b343c6f5f9aefb04be63e42f6d12efc51101d3647ed6f70c7a6d050afb3ab2f3636eae78cb523f5844de67b960a7a3145ed89ab0c7015deb14921e
DIST libcxx-9.0.0.src.tar.xz 1814388 BLAKE2B 59b8967706d1f85b1c0d2b9932bd637aae7118ae461e2b31e1d17c9a2ee2e02ea0ea8b344074a9fc4b430b5c742b8ad30c10a0c44e5290528fdecd7571352879 SHA512 cbaca724c4f3e3a270dfd53aac50cbb920190fe55486b164d52e73845819dd22afb10c23f5875da59d433fd5b96a0f153208746117309ac1267a38fa56f4818e
-EBUILD libcxx-10.0.0.9999.ebuild 6529 BLAKE2B 25b1b79a7dd2be15557ae27ea2c66697937a18aa8f8223eab8cd84ce41d46fd168463c279ecbcefb1b62a1596af7876bd17f9953c73e5d23ac6c86a30edb45db SHA512 ca3492679b80dbc7e746709166c7831f3e8bc7be0cc2b7f674b1a0186851a5f3a7975a066035293b12333e673df6948e1043c24a4c14b27a43df049bfaf697ad
-EBUILD libcxx-6.0.1.ebuild 6734 BLAKE2B 5871a241d06ab0a449a2a375d3dd89d1b79f7d0712954061df88da89e350612ac00f7e9252ca8e93e9373fe45a66f89730d304865f713a75c6f1ab43565054f1 SHA512 af9fb74c62ecf1a5b188752ddc9fe0bf6ab3443f25704b024c6544b150cd33bcc92492e172119685d3fec2032689a4382dab6bb9f3662f4412323c4f6537c552
+DIST llvmorg-9.0.1-rc2.tar.gz 113203311 BLAKE2B 6e426060853e1587febedb75189444a1451236b713f800a4f3401c54318e48b0f5e0c484e9e4ef261faceed9b43b445a4153b061d4dadcc617047f9320b4f56a SHA512 fececd9365645920b9afdad1e94d5e10553ad4a39d84b3ac811b86014c395d51f7e4dabe54bb095a99481400c408bee3c9a2044168724d5e094e3258587a5d2c
+DIST llvmorg-9.0.1-rc3.tar.gz 113205740 BLAKE2B 3ca81e812833ecc2ac1bacfdeb86f54609ee125ba7390ce6af0113e949496149102360f35a9a0194dff93fb5cb6ade40a68382a03a7e55771a13198abb7ca9de SHA512 ea56a4ee57aacdd00a1d6551cdc768ecce3124a0eb6a9d09fe060bb147019a5119b2a9eaca576474be42e0296293daa923edd86dadb6759df0c2d7fc7a74f9f1
+EBUILD libcxx-10.0.0.9999.ebuild 6621 BLAKE2B 43dfdeb6687377b335760e12aa5a7a9c3f99783a7ceb69dc3983779db414867b24bb3368cd9a056fdd0d60ebf2e84d631f07a37c4e0572491fd3a5ed13141103 SHA512 cca25472753a88da4a9fb6f356c102100a91d8d0e0af029ee0647432de1fe4d7f5cb0f187fd0e1a4a675ec1568c76b85da51134a4f020012b0531e86b5559257
EBUILD libcxx-7.1.0.ebuild 6734 BLAKE2B ccf745bc3f3ea12361f877637970090b3588febd096fff2118359afc1664a2c5eb7e55e90372a5f5dc711b7a12310fcbe9fd2fd7f047b9bce117b8c99c7da393 SHA512 cea3065bf397c3d1615ac3d6a92910bc84ae439597c4972fdcd4eb41ce0fb1dd34dbdbd1cdfb95c0f46fb8a217f31f5b23da4c358204b349d48e1d433a3d9735
EBUILD libcxx-8.0.1.ebuild 6773 BLAKE2B b1f95dfaa74faf6ec4299c7241330d5047c1eabc69351f2bbeea296c41a3671c87e99689cda85c65aa29c513eca148321806719f15229b283b0c82a5f9bd1c93 SHA512 0060d986d79514416681cab707ed8075a7f8c461146457724acfbd04e269836827b4adbf791b1afb3a4b8fec13d44678c459861b749ce4001fd5c4a65b97121c
-EBUILD libcxx-9.0.0.ebuild 6552 BLAKE2B bf5b5360f86e4673abaf6af0de2b111ba90b205538a8ad22ff1f97c0be1f4c1c145f9863b74a0a93513adfb3c7539a19f837cc6c5a1090c2e3db0b25ab8272d9 SHA512 344b64dbffa364b12f8f53fc76453d9566805f73b3322084aee7879b63e154a387c6d32a9205a81d7c828ee8c062c7bb10596e58f99ac0ee19392a76956033fe
-EBUILD libcxx-9.0.1.9999.ebuild 6529 BLAKE2B 25b1b79a7dd2be15557ae27ea2c66697937a18aa8f8223eab8cd84ce41d46fd168463c279ecbcefb1b62a1596af7876bd17f9953c73e5d23ac6c86a30edb45db SHA512 ca3492679b80dbc7e746709166c7831f3e8bc7be0cc2b7f674b1a0186851a5f3a7975a066035293b12333e673df6948e1043c24a4c14b27a43df049bfaf697ad
+EBUILD libcxx-9.0.0.ebuild 6644 BLAKE2B dc5cd0c95cbd0e3c68b991f00725f1e930b2cecfff11cfe92bb5552b79a3e2c20d67e13a7f27cd16cb9564c95b5d876505e168de54f03645454e2be2f6a19aa5 SHA512 6265a227bfeacc5ac35bd9be869e570005ff927140e99c091da552474f7206d1f78214d72d4453fb3adc88043b820a4fd25958fa8db1eabdfcba0e404dfbd171
+EBUILD libcxx-9.0.1.9999.ebuild 6621 BLAKE2B 43dfdeb6687377b335760e12aa5a7a9c3f99783a7ceb69dc3983779db414867b24bb3368cd9a056fdd0d60ebf2e84d631f07a37c4e0572491fd3a5ed13141103 SHA512 cca25472753a88da4a9fb6f356c102100a91d8d0e0af029ee0647432de1fe4d7f5cb0f187fd0e1a4a675ec1568c76b85da51134a4f020012b0531e86b5559257
+EBUILD libcxx-9.0.1_rc2.ebuild 6644 BLAKE2B dc5cd0c95cbd0e3c68b991f00725f1e930b2cecfff11cfe92bb5552b79a3e2c20d67e13a7f27cd16cb9564c95b5d876505e168de54f03645454e2be2f6a19aa5 SHA512 6265a227bfeacc5ac35bd9be869e570005ff927140e99c091da552474f7206d1f78214d72d4453fb3adc88043b820a4fd25958fa8db1eabdfcba0e404dfbd171
+EBUILD libcxx-9.0.1_rc3.ebuild 6644 BLAKE2B dc5cd0c95cbd0e3c68b991f00725f1e930b2cecfff11cfe92bb5552b79a3e2c20d67e13a7f27cd16cb9564c95b5d876505e168de54f03645454e2be2f6a19aa5 SHA512 6265a227bfeacc5ac35bd9be869e570005ff927140e99c091da552474f7206d1f78214d72d4453fb3adc88043b820a4fd25958fa8db1eabdfcba0e404dfbd171
MISC metadata.xml 751 BLAKE2B cc513b45c7283d41728236781558b47c535885612a93bcae2a41be20531bab0e01c159e918670c91ce7b4addb0390d5996ea735fc5856b61af7cf28a9b6286a9 SHA512 3620f5415cc80bc99f16eaaf98a712f1288895bdf1e98898103d680304930db89c3b8b55ca3f4d20d4738fc3aa3e314b81c9989971b23d7f66e2137095a35d4d
diff --git a/sys-libs/libcxx/libcxx-10.0.0.9999.ebuild b/sys-libs/libcxx/libcxx-10.0.0.9999.ebuild
index f5f67053d776..db9250d5440b 100644
--- a/sys-libs/libcxx/libcxx-10.0.0.9999.ebuild
+++ b/sys-libs/libcxx/libcxx-10.0.0.9999.ebuild
@@ -93,7 +93,7 @@ src_configure() {
multilib_src_configure() {
# 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
+ local extra_libs=() want_gcc_s=ON want_compiler_rt=OFF
if use libunwind; then
# work-around missing -lunwind upstream
extra_libs+=( -lunwind )
@@ -104,6 +104,7 @@ multilib_src_configure() {
${LDFLAGS} -print-libgcc-file-name)
if [[ ${compiler_rt} == *libclang_rt* ]]; then
want_gcc_s=OFF
+ want_compiler_rt=ON
extra_libs+=( "${compiler_rt}" )
fi
fi
@@ -130,6 +131,7 @@ multilib_src_configure() {
-DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
-DLIBCXX_HAS_GCC_S_LIB=${want_gcc_s}
-DLIBCXX_INCLUDE_TESTS=$(usex test)
+ -DLIBCXX_USE_COMPILER_RT=${want_compiler_rt}
-DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}"
)
diff --git a/sys-libs/libcxx/libcxx-9.0.0.ebuild b/sys-libs/libcxx/libcxx-9.0.0.ebuild
index 76ae63ba35ad..41c96a83d618 100644
--- a/sys-libs/libcxx/libcxx-9.0.0.ebuild
+++ b/sys-libs/libcxx/libcxx-9.0.0.ebuild
@@ -93,7 +93,7 @@ src_configure() {
multilib_src_configure() {
# 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
+ local extra_libs=() want_gcc_s=ON want_compiler_rt=OFF
if use libunwind; then
# work-around missing -lunwind upstream
extra_libs+=( -lunwind )
@@ -104,6 +104,7 @@ multilib_src_configure() {
${LDFLAGS} -print-libgcc-file-name)
if [[ ${compiler_rt} == *libclang_rt* ]]; then
want_gcc_s=OFF
+ want_compiler_rt=ON
extra_libs+=( "${compiler_rt}" )
fi
fi
@@ -130,6 +131,7 @@ multilib_src_configure() {
-DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
-DLIBCXX_HAS_GCC_S_LIB=${want_gcc_s}
-DLIBCXX_INCLUDE_TESTS=$(usex test)
+ -DLIBCXX_USE_COMPILER_RT=${want_compiler_rt}
-DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}"
)
diff --git a/sys-libs/libcxx/libcxx-9.0.1.9999.ebuild b/sys-libs/libcxx/libcxx-9.0.1.9999.ebuild
index f5f67053d776..db9250d5440b 100644
--- a/sys-libs/libcxx/libcxx-9.0.1.9999.ebuild
+++ b/sys-libs/libcxx/libcxx-9.0.1.9999.ebuild
@@ -93,7 +93,7 @@ src_configure() {
multilib_src_configure() {
# 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
+ local extra_libs=() want_gcc_s=ON want_compiler_rt=OFF
if use libunwind; then
# work-around missing -lunwind upstream
extra_libs+=( -lunwind )
@@ -104,6 +104,7 @@ multilib_src_configure() {
${LDFLAGS} -print-libgcc-file-name)
if [[ ${compiler_rt} == *libclang_rt* ]]; then
want_gcc_s=OFF
+ want_compiler_rt=ON
extra_libs+=( "${compiler_rt}" )
fi
fi
@@ -130,6 +131,7 @@ multilib_src_configure() {
-DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
-DLIBCXX_HAS_GCC_S_LIB=${want_gcc_s}
-DLIBCXX_INCLUDE_TESTS=$(usex test)
+ -DLIBCXX_USE_COMPILER_RT=${want_compiler_rt}
-DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}"
)
diff --git a/sys-libs/libcxx/libcxx-6.0.1.ebuild b/sys-libs/libcxx/libcxx-9.0.1_rc2.ebuild
index 23be36cbff62..41c96a83d618 100644
--- a/sys-libs/libcxx/libcxx-6.0.1.ebuild
+++ b/sys-libs/libcxx/libcxx-9.0.1_rc2.ebuild
@@ -1,25 +1,20 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-EAPI=6
+EAPI=7
-# 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 multiprocessing python-any-r1 \
+PYTHON_COMPAT=( python{2_7,3_{5,6,7}} )
+inherit cmake-multilib llvm llvm.org multiprocessing python-any-r1 \
toolchain-funcs
DESCRIPTION="New implementation of the C++ standard library, targeting C++11"
HOMEPAGE="https://libcxx.llvm.org/"
-SRC_URI="https://releases.llvm.org/${PV/_//}/${P/_/}.src.tar.xz"
+LLVM_COMPONENTS=( libcxx )
+llvm.org_set_globals
-LICENSE="|| ( UoI-NCSA MIT )"
+LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
SLOT="0"
-KEYWORDS="amd64 ~arm64 x86"
+KEYWORDS="~amd64 ~arm ~arm64 ~x86"
IUSE="elibc_glibc elibc_musl +libcxxabi libcxxrt +libunwind +static-libs test"
REQUIRED_USE="libunwind? ( || ( libcxxabi libcxxrt ) )
?? ( libcxxabi libcxxrt )"
@@ -33,12 +28,10 @@ RDEPEND="
# 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-6"
-
-S=${WORKDIR}/${P/_/}.src
+BDEPEND="
+ test? ( >=sys-devel/clang-3.9.0
+ $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]') )"
DOCS=( CREDITS.TXT )
@@ -100,7 +93,7 @@ src_configure() {
multilib_src_configure() {
# 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
+ local extra_libs=() want_gcc_s=ON want_compiler_rt=OFF
if use libunwind; then
# work-around missing -lunwind upstream
extra_libs+=( -lunwind )
@@ -111,6 +104,7 @@ multilib_src_configure() {
${LDFLAGS} -print-libgcc-file-name)
if [[ ${compiler_rt} == *libclang_rt* ]]; then
want_gcc_s=OFF
+ want_compiler_rt=ON
extra_libs+=( "${compiler_rt}" )
fi
fi
@@ -137,6 +131,7 @@ multilib_src_configure() {
-DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
-DLIBCXX_HAS_GCC_S_LIB=${want_gcc_s}
-DLIBCXX_INCLUDE_TESTS=$(usex test)
+ -DLIBCXX_USE_COMPILER_RT=${want_compiler_rt}
-DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}"
)
@@ -155,6 +150,7 @@ multilib_src_configure() {
}
multilib_src_test() {
+ local -x LIT_PRESERVES_TMP=1
cmake-utils_src_make check-libcxx
}
diff --git a/sys-libs/libcxx/libcxx-9.0.1_rc3.ebuild b/sys-libs/libcxx/libcxx-9.0.1_rc3.ebuild
new file mode 100644
index 000000000000..41c96a83d618
--- /dev/null
+++ b/sys-libs/libcxx/libcxx-9.0.1_rc3.ebuild
@@ -0,0 +1,211 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python{2_7,3_{5,6,7}} )
+inherit cmake-multilib llvm llvm.org multiprocessing python-any-r1 \
+ toolchain-funcs
+
+DESCRIPTION="New implementation of the C++ standard library, targeting C++11"
+HOMEPAGE="https://libcxx.llvm.org/"
+LLVM_COMPONENTS=( libcxx )
+llvm.org_set_globals
+
+LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~x86"
+IUSE="elibc_glibc elibc_musl +libcxxabi libcxxrt +libunwind +static-libs test"
+REQUIRED_USE="libunwind? ( || ( libcxxabi libcxxrt ) )
+ ?? ( libcxxabi libcxxrt )"
+RESTRICT="!test? ( test )"
+
+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-6 for new lit options
+# clang-3.9.0 installs necessary target symlinks unconditionally
+# which removes the need for MULTILIB_USEDEP
+DEPEND="${RDEPEND}
+ >=sys-devel/llvm-6"
+BDEPEND="
+ test? ( >=sys-devel/clang-3.9.0
+ $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]') )"
+
+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"
+)
+
+# 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
+}
+
+test_compiler() {
+ $(tc-getCXX) ${CXXFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c++ - \
+ <<<'int main() { return 0; }' &>/dev/null
+}
+
+src_configure() {
+ # note: we need to do this before multilib kicks in since it will
+ # alter the CHOST
+ 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
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ # 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 want_compiler_rt=OFF
+ 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
+ local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \
+ ${LDFLAGS} -print-libgcc-file-name)
+ if [[ ${compiler_rt} == *libclang_rt* ]]; then
+ want_gcc_s=OFF
+ want_compiler_rt=ON
+ extra_libs+=( "${compiler_rt}" )
+ fi
+ fi
+ fi
+
+ # bootstrap: cmake is unhappy if compiler can't link to stdlib
+ local nolib_flags=( -nodefaultlibs -lc )
+ if ! test_compiler; then
+ if test_compiler "${nolib_flags[@]}"; then
+ local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"
+ ewarn "${CXX} seems to lack runtime, trying with ${nolib_flags[*]}"
+ 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)
+ -DLIBCXX_USE_COMPILER_RT=${want_compiler_rt}
+ -DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}"
+ )
+
+ if use test; then
+ local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null)
+ local jobs=${LIT_JOBS:-$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")}
+
+ [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests"
+
+ mycmakeargs+=(
+ -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
+ -DLLVM_LIT_ARGS="-vv;-j;${jobs};--param=cxx_under_test=${clang_path}"
+ )
+ fi
+ cmake-utils_src_configure
+}
+
+multilib_src_test() {
+ local -x LIT_PRESERVES_TMP=1
+ 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."
+}