From e748ba9741f6540f4675c23e3e37b73e822c13a4 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 31 May 2021 20:59:14 +0100 Subject: gentoo resync : 31.05.2021 --- sys-libs/libcxx/Manifest | 4 +- sys-libs/libcxx/libcxx-12.0.0.9999.ebuild | 211 ------------------------------ sys-libs/libcxx/libcxx-12.0.1.9999.ebuild | 211 ++++++++++++++++++++++++++++++ sys-libs/libcxx/libcxx-12.0.1_rc1.ebuild | 211 ++++++++++++++++++++++++++++++ 4 files changed, 425 insertions(+), 212 deletions(-) delete mode 100644 sys-libs/libcxx/libcxx-12.0.0.9999.ebuild create mode 100644 sys-libs/libcxx/libcxx-12.0.1.9999.ebuild create mode 100644 sys-libs/libcxx/libcxx-12.0.1_rc1.ebuild (limited to 'sys-libs/libcxx') diff --git a/sys-libs/libcxx/Manifest b/sys-libs/libcxx/Manifest index 21fc6a8b8c82..bad1472d2164 100644 --- a/sys-libs/libcxx/Manifest +++ b/sys-libs/libcxx/Manifest @@ -5,9 +5,11 @@ DIST llvm-gentoo-patchset-9999-1.tar.xz 4032 BLAKE2B b9413484dafed8ae0c68c2c164b DIST llvmorg-10.0.1.tar.gz 120880730 BLAKE2B 30f19f56c4d1f6abcda5fec76256219d1e3c8a6ff1a1f152f94bfe362c07884339fe571ff7fe903ed3b3deb150b2fa868c387887a0dea2930dc08b81db71a5b1 SHA512 48078fff9293a87f1a973f3348f79506f04c3da774295f5eb67d74dd2d1aa94f0973f8ced3f4ab9e8339902071f82c603b43d5608ad7227046c4da769c5d2151 DIST llvmorg-11.1.0.tar.gz 122776532 BLAKE2B ca842ff4afff8f44c82b5e7383962a9c45ca1c93b64fa4c6ebcd70a1d3849dbad2b8e4e24fba02d144c6266d7fab3607ebc6999b28c229cb35256cf40f26a985 SHA512 9a8ce022a935eed42fa71a224f2a207122aadcbef58ee855fdb4825f879e7d028e4dcff22c19b9d336db1c8bf63fb84372d44981acf84615f757e54306c92b81 DIST llvmorg-12.0.0.tar.gz 134226215 BLAKE2B f9c3ba8c58571855caa4f206fd285c9b5be66672fb0814cb8bc0964a051f57f5d35013aa1e27cbda502652b37df1ec23474129109e76a42066847860db441dbe SHA512 0cff02155c5ac0d6db2b72d60d9819d5b5dd859663b45f721b1c7540239c2fceb1f57d9173f6870c49de851c242ed8e85c5c6d6577a1f8092a7c5dcd12513b26 +DIST llvmorg-12.0.1-rc1.tar.gz 134261735 BLAKE2B d29510495641c06e6d7a5ac165e6d34e0ba15d1a5b786534e186e341e3a0550cdd3d8a2b61deb3e2bf44c0b0ff8561224bf7f8cebc2ce9415639cb67ceae289e SHA512 4595a26df56eed7d5941240fe92116ad2f1c61639f0f464697c2c530a601347032fbad6802d1fa915ced8574c7b30ef05bc8c0be737784c844d3860892817e6e EBUILD libcxx-10.0.1.ebuild 5796 BLAKE2B c3c1e4d49ad96de1338998d35b0495ba2aa448db3558988bbbc9e5d4603d3d2ded354b1c04b186b0134be930edd72c931240ac3a068744e72e18087fc1550160 SHA512 7fbae29d2658305ddac7854a96e353ccf1901fcc6b1c15370d7a69a602f41b7d9f1afdd91018ea5be949955b3f8f1424903b5bac13d840e8f8c72ffcf7d7d34d EBUILD libcxx-11.1.0.ebuild 6661 BLAKE2B 93445de819484ea32a708d2ff616501d715e7fd3a3f4204f143e64c40bc89ebceb8e50c80215c6b54d7c8a3cce00fcecaac099298b41e010bf77655563d30a20 SHA512 ce56f24e7b4aed1405e682af6b3cb48bad6617d5b7e2ecf5b990fae4f7d6badc479a583ef24801e34b0155c12354a7b76a414402f89c31f228315eb92f279a62 -EBUILD libcxx-12.0.0.9999.ebuild 6622 BLAKE2B b525c9be28a7ac16ec07275c59e68fb003a7423512c94c297014f884d40323b6776313ced81e09f5e15cc1489e95e42b561f8e3e961bc461b37e58ab928edf62 SHA512 335d114c131ed3a6653f59f3a66bdb4115f277b2d8aacd3c2fbc78519b9fdaedaade3a2f53a66f36c18feb3cde8a6fb95fe8e34889626c17dd896bd6a8f8cfad EBUILD libcxx-12.0.0.ebuild 6914 BLAKE2B e06a7f82b838785de55c9c936cedd9d4bd3ca819812cf43a98ce533c5f7551d60dec4040f11820068850a23af1111d0a156d398ad8dafefbcc301ed41254855f SHA512 76afcac7759e44a70bc10adc1217446c7c1665f9f1264c2c49363732023e684683df2490d0bc4abd565a04ca1dbf355c8e1bc4d7b88bb2932e0fe35527e0e746 +EBUILD libcxx-12.0.1.9999.ebuild 6622 BLAKE2B b525c9be28a7ac16ec07275c59e68fb003a7423512c94c297014f884d40323b6776313ced81e09f5e15cc1489e95e42b561f8e3e961bc461b37e58ab928edf62 SHA512 335d114c131ed3a6653f59f3a66bdb4115f277b2d8aacd3c2fbc78519b9fdaedaade3a2f53a66f36c18feb3cde8a6fb95fe8e34889626c17dd896bd6a8f8cfad +EBUILD libcxx-12.0.1_rc1.ebuild 6622 BLAKE2B b525c9be28a7ac16ec07275c59e68fb003a7423512c94c297014f884d40323b6776313ced81e09f5e15cc1489e95e42b561f8e3e961bc461b37e58ab928edf62 SHA512 335d114c131ed3a6653f59f3a66bdb4115f277b2d8aacd3c2fbc78519b9fdaedaade3a2f53a66f36c18feb3cde8a6fb95fe8e34889626c17dd896bd6a8f8cfad EBUILD libcxx-13.0.0.9999.ebuild 6622 BLAKE2B b525c9be28a7ac16ec07275c59e68fb003a7423512c94c297014f884d40323b6776313ced81e09f5e15cc1489e95e42b561f8e3e961bc461b37e58ab928edf62 SHA512 335d114c131ed3a6653f59f3a66bdb4115f277b2d8aacd3c2fbc78519b9fdaedaade3a2f53a66f36c18feb3cde8a6fb95fe8e34889626c17dd896bd6a8f8cfad MISC metadata.xml 621 BLAKE2B d8b68920ece0e3a700f1e425cf72a4ca7e75cf4b0b35e1ac6db9374d32020fc9f62b434da2108ad5b3538a46a2a7f4f5de7aa1640cd4b10046f2480ebb89450d SHA512 e1b0c874a6d229e098ffe7c0c2827502f2cdbf74fb7a0254687a0ca75dde74db06ef2bc79bfe8b526c413b13beac27b8261eab8d0b8df36011790dada3eae421 diff --git a/sys-libs/libcxx/libcxx-12.0.0.9999.ebuild b/sys-libs/libcxx/libcxx-12.0.0.9999.ebuild deleted file mode 100644 index 1f529867fb7b..000000000000 --- a/sys-libs/libcxx/libcxx-12.0.0.9999.ebuild +++ /dev/null @@ -1,211 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -CMAKE_ECLASS=cmake -PYTHON_COMPAT=( python3_{7..9} ) -inherit cmake-multilib llvm llvm.org python-any-r1 toolchain-funcs - -DESCRIPTION="New implementation of the C++ standard library, targeting C++11" -HOMEPAGE="https://libcxx.llvm.org/" - -LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )" -SLOT="0" -KEYWORDS="" -IUSE="elibc_glibc elibc_musl +libcxxabi +libunwind static-libs test" -REQUIRED_USE="libunwind? ( libcxxabi )" -RESTRICT="!test? ( test )" - -RDEPEND=" - libcxxabi? ( ~sys-libs/libcxxabi-${PV}[libunwind=,static-libs?,${MULTILIB_USEDEP}] ) - !libcxxabi? ( >=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? ( - >=dev-util/cmake-3.16 - >=sys-devel/clang-3.9.0 - $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]') - )" - -DOCS=( CREDITS.TXT ) - -LLVM_COMPONENTS=( libcxx{,abi} llvm/{cmake/modules,utils/llvm-lit} ) -LLVM_PATCHSET=9999-1 -llvm.org_set_globals - -python_check_deps() { - has_version "dev-python/lit[${PYTHON_USEDEP}]" -} - -pkg_setup() { - # Darwin Prefix builds do not have llvm installed yet, so rely on - # bootstrap-prefix to set the appropriate path vars to LLVM instead - # of using llvm_pkg_setup. - if [[ ${CHOST} != *-darwin* ]] || has_version dev-lang/llvm; then - llvm_pkg_setup - fi - use test && python-any-r1_pkg_setup - - if ! use libcxxabi && ! 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 -} - -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" - 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 - elif [[ ${CHOST} == *-darwin* ]] && tc-is-clang; then - # clang-based darwin prefix disables libunwind useflag during - # bootstrap, because libunwind is not in the prefix yet. - # override the default, though, because clang based libcxx - # should never use gcc_s on Darwin. - want_gcc_s=OFF - # compiler_rt is not available in EPREFIX during bootstrap, - # so we cannot link to it yet anyway, so keep the defaults - # of want_compiler_rt=OFF and extra_libs=() - 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) - [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests" - - mycmakeargs+=( - -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit" - -DLLVM_LIT_ARGS="$(get_lit_flags);--param=cxx_under_test=${clang_path}" - -DPython3_EXECUTABLE="${PYTHON}" - ) - fi - cmake_src_configure -} - -multilib_src_test() { - local -x LIT_PRESERVES_TMP=1 - cmake_build check-cxx -} - -# 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" "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" "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_src_install - if [[ ${CHOST} != *-darwin* ]] ; then - gen_shared_ldscript - use static-libs && gen_static_ldscript - fi -} - -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/libcxx-12.0.1.9999.ebuild b/sys-libs/libcxx/libcxx-12.0.1.9999.ebuild new file mode 100644 index 000000000000..1f529867fb7b --- /dev/null +++ b/sys-libs/libcxx/libcxx-12.0.1.9999.ebuild @@ -0,0 +1,211 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +CMAKE_ECLASS=cmake +PYTHON_COMPAT=( python3_{7..9} ) +inherit cmake-multilib llvm llvm.org python-any-r1 toolchain-funcs + +DESCRIPTION="New implementation of the C++ standard library, targeting C++11" +HOMEPAGE="https://libcxx.llvm.org/" + +LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )" +SLOT="0" +KEYWORDS="" +IUSE="elibc_glibc elibc_musl +libcxxabi +libunwind static-libs test" +REQUIRED_USE="libunwind? ( libcxxabi )" +RESTRICT="!test? ( test )" + +RDEPEND=" + libcxxabi? ( ~sys-libs/libcxxabi-${PV}[libunwind=,static-libs?,${MULTILIB_USEDEP}] ) + !libcxxabi? ( >=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? ( + >=dev-util/cmake-3.16 + >=sys-devel/clang-3.9.0 + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]') + )" + +DOCS=( CREDITS.TXT ) + +LLVM_COMPONENTS=( libcxx{,abi} llvm/{cmake/modules,utils/llvm-lit} ) +LLVM_PATCHSET=9999-1 +llvm.org_set_globals + +python_check_deps() { + has_version "dev-python/lit[${PYTHON_USEDEP}]" +} + +pkg_setup() { + # Darwin Prefix builds do not have llvm installed yet, so rely on + # bootstrap-prefix to set the appropriate path vars to LLVM instead + # of using llvm_pkg_setup. + if [[ ${CHOST} != *-darwin* ]] || has_version dev-lang/llvm; then + llvm_pkg_setup + fi + use test && python-any-r1_pkg_setup + + if ! use libcxxabi && ! 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 +} + +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" + 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 + elif [[ ${CHOST} == *-darwin* ]] && tc-is-clang; then + # clang-based darwin prefix disables libunwind useflag during + # bootstrap, because libunwind is not in the prefix yet. + # override the default, though, because clang based libcxx + # should never use gcc_s on Darwin. + want_gcc_s=OFF + # compiler_rt is not available in EPREFIX during bootstrap, + # so we cannot link to it yet anyway, so keep the defaults + # of want_compiler_rt=OFF and extra_libs=() + 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) + [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests" + + mycmakeargs+=( + -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit" + -DLLVM_LIT_ARGS="$(get_lit_flags);--param=cxx_under_test=${clang_path}" + -DPython3_EXECUTABLE="${PYTHON}" + ) + fi + cmake_src_configure +} + +multilib_src_test() { + local -x LIT_PRESERVES_TMP=1 + cmake_build check-cxx +} + +# 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" "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" "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_src_install + if [[ ${CHOST} != *-darwin* ]] ; then + gen_shared_ldscript + use static-libs && gen_static_ldscript + fi +} + +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/libcxx-12.0.1_rc1.ebuild b/sys-libs/libcxx/libcxx-12.0.1_rc1.ebuild new file mode 100644 index 000000000000..1f529867fb7b --- /dev/null +++ b/sys-libs/libcxx/libcxx-12.0.1_rc1.ebuild @@ -0,0 +1,211 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +CMAKE_ECLASS=cmake +PYTHON_COMPAT=( python3_{7..9} ) +inherit cmake-multilib llvm llvm.org python-any-r1 toolchain-funcs + +DESCRIPTION="New implementation of the C++ standard library, targeting C++11" +HOMEPAGE="https://libcxx.llvm.org/" + +LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )" +SLOT="0" +KEYWORDS="" +IUSE="elibc_glibc elibc_musl +libcxxabi +libunwind static-libs test" +REQUIRED_USE="libunwind? ( libcxxabi )" +RESTRICT="!test? ( test )" + +RDEPEND=" + libcxxabi? ( ~sys-libs/libcxxabi-${PV}[libunwind=,static-libs?,${MULTILIB_USEDEP}] ) + !libcxxabi? ( >=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? ( + >=dev-util/cmake-3.16 + >=sys-devel/clang-3.9.0 + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]') + )" + +DOCS=( CREDITS.TXT ) + +LLVM_COMPONENTS=( libcxx{,abi} llvm/{cmake/modules,utils/llvm-lit} ) +LLVM_PATCHSET=9999-1 +llvm.org_set_globals + +python_check_deps() { + has_version "dev-python/lit[${PYTHON_USEDEP}]" +} + +pkg_setup() { + # Darwin Prefix builds do not have llvm installed yet, so rely on + # bootstrap-prefix to set the appropriate path vars to LLVM instead + # of using llvm_pkg_setup. + if [[ ${CHOST} != *-darwin* ]] || has_version dev-lang/llvm; then + llvm_pkg_setup + fi + use test && python-any-r1_pkg_setup + + if ! use libcxxabi && ! 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 +} + +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" + 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 + elif [[ ${CHOST} == *-darwin* ]] && tc-is-clang; then + # clang-based darwin prefix disables libunwind useflag during + # bootstrap, because libunwind is not in the prefix yet. + # override the default, though, because clang based libcxx + # should never use gcc_s on Darwin. + want_gcc_s=OFF + # compiler_rt is not available in EPREFIX during bootstrap, + # so we cannot link to it yet anyway, so keep the defaults + # of want_compiler_rt=OFF and extra_libs=() + 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) + [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests" + + mycmakeargs+=( + -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit" + -DLLVM_LIT_ARGS="$(get_lit_flags);--param=cxx_under_test=${clang_path}" + -DPython3_EXECUTABLE="${PYTHON}" + ) + fi + cmake_src_configure +} + +multilib_src_test() { + local -x LIT_PRESERVES_TMP=1 + cmake_build check-cxx +} + +# 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" "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" "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_src_install + if [[ ${CHOST} != *-darwin* ]] ; then + gen_shared_ldscript + use static-libs && gen_static_ldscript + fi +} + +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." +} -- cgit v1.2.3