--- libcxx-11.0.0.mainline.ebuild 2020-11-30 15:51:51.000000000 -0600 +++ libcxx-11.0.0.ebuild 2020-12-09 19:02:46.000000000 -0600 @@ -14,9 +14,10 @@ LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )" SLOT="0" -KEYWORDS="amd64 arm arm64 x86" -IUSE="elibc_glibc elibc_musl +libcxxabi +libunwind +static-libs test" -REQUIRED_USE="libunwind? ( libcxxabi )" +KEYWORDS="amd64 arm arm64 x86 ~x64-macos" +IUSE="elibc_Darwin elibc_glibc elibc_musl +libcxxabi +libunwind +static-libs test bootstrap" +REQUIRED_USE="libunwind? ( libcxxabi ) + elibc_Darwin? ( libcxxabi )" RESTRICT="!test? ( test )" RDEPEND=" @@ -41,7 +42,7 @@ } pkg_setup() { - llvm_pkg_setup + use bootstrap || llvm_pkg_setup use test && python-any-r1_pkg_setup if ! use libcxxabi && ! tc-is-gcc ; then @@ -58,6 +59,11 @@ eapply "${FILESDIR}/${PN}-3.9-cmake-link-flags.patch" llvm.org_src_prepare + + # eprefixify static path references to libc++abi for symbol re-export to + # avoid linking against it twice in both /usr/lib and ${EPREFIX}/usr/lib + local lcpa=/usr/lib/libc++abi.dylib + sed -i -e "s,${lcpa},${EPREFIX}${lcpa},g" lib/CMakeLists.txt } test_compiler() { @@ -100,6 +106,8 @@ fi fi fi + # Darwin has libunwind in its system + [[ ${CHOST} == *-darwin* ]] && want_gcc_s=OFF # bootstrap: cmake is unhappy if compiler can't link to stdlib local nolib_flags=( -nodefaultlibs -lc ) @@ -188,8 +196,10 @@ multilib_src_install() { cmake_src_install - gen_shared_ldscript - use static-libs && gen_static_ldscript + if [[ ${CHOST} != *-darwin* ]] ; then + gen_shared_ldscript + use static-libs && gen_static_ldscript + fi } pkg_postinst() {