--- libcxx-11.0.0.mainline.ebuild 2020-11-30 15:51:51.000000000 -0600 +++ libcxx-11.0.0.ebuild 2020-12-01 23:17:06.000000000 -0600 @@ -5,6 +5,7 @@ CMAKE_ECLASS=cmake PYTHON_COMPAT=( python3_{6..9} ) +# prefix change might need flag-o-matic inherit cmake-multilib llvm llvm.org python-any-r1 toolchain-funcs DESCRIPTION="New implementation of the C++ standard library, targeting C++11" @@ -14,9 +15,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" +REQUIRED_USE="libunwind? ( libcxxabi ) + elibc_Darwin? ( libcxxabi )" RESTRICT="!test? ( test )" RDEPEND=" @@ -58,6 +60,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 +107,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 ) @@ -136,6 +145,12 @@ -DPython3_EXECUTABLE="${PYTHON}" ) fi + + # prefix change needed? + # make sure we build multilib on OSX, because llvm insists on + # building multilib too + #[[ ${CHOST} == *86*-darwin* ]] && append-flags -arch i386 -arch x86_64 + cmake_src_configure } @@ -188,8 +203,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() {