diff options
| author | Michał Górny <mgorny@gentoo.org> | 2025-11-08 11:36:14 +0100 |
|---|---|---|
| committer | Michał Górny <mgorny@gentoo.org> | 2025-11-08 11:36:14 +0100 |
| commit | 3787ae0582d53a6dae32b90f4c3dbed2bc02e5c7 (patch) | |
| tree | 2a35e206248c16de0ddf2fa186a3f1508dabb710 | |
| parent | 695181d358756d15e64b38e77b5b90417807a542 (diff) | |
| download | gentoo-3787ae0582d53a6dae32b90f4c3dbed2bc02e5c7.tar.gz gentoo-3787ae0582d53a6dae32b90f4c3dbed2bc02e5c7.tar.bz2 gentoo-3787ae0582d53a6dae32b90f4c3dbed2bc02e5c7.zip | |
llvm-runtimes/libcxx: Add 22.0.0_pre20251108 snapshot
Signed-off-by: Michał Górny <mgorny@gentoo.org>
| -rw-r--r-- | llvm-runtimes/libcxx/Manifest | 1 | ||||
| -rw-r--r-- | llvm-runtimes/libcxx/libcxx-22.0.0_pre20251108.ebuild | 260 |
2 files changed, 261 insertions, 0 deletions
diff --git a/llvm-runtimes/libcxx/Manifest b/llvm-runtimes/libcxx/Manifest index 461a7541787f..ba4ad5354305 100644 --- a/llvm-runtimes/libcxx/Manifest +++ b/llvm-runtimes/libcxx/Manifest @@ -1,5 +1,6 @@ DIST llvm-gentoo-patchset-15.0.7-r8.tar.xz 27904 BLAKE2B 1fc5df0dc44484ea0225438f3d861ab23739773df58eaf2b531966baeeb5e717b2a3c03f62b1cfb8bb5e316393e8b295d4fbd8be3246381723f905304f005e12 SHA512 7f0ba8ef4291de87cc3220e63ad0ac088a81491d4a46b1053dd51d9725ca6c87d3d7720c2440908b10b1ace406f7ed1c523ca28b199a7a29ed06d0973a0829a2 DIST llvm-gentoo-patchset-16.0.6-r6.tar.xz 21672 BLAKE2B b52c29a7c19b60ccd076c01014e374e35aa5da061917cdc6a9d321f9386ce4e9286d5a7cccfffc23e0f6737c6eeb32ef4ab030b9d3165f528d1c657b53b6ab17 SHA512 f8a6cdaded545219107505c57b194b3f4df8ee7a2f1f0756b8e8884633e389ad7462445e1522414615210c0a4407a0358c84882366a475441f681a2ba75dc985 +DIST llvm-project-0875755f5275dc7a84b1aeb526b7822b47a733c9.tar.gz 254111698 BLAKE2B 16bd787e9af46837e6e2962d2f9bdd2a1d13b1ab6f4dcb1a428914cc2502b6430f79ee163b0d8ad5b6a9124162f262fa394265f8c52950100b543b7027df310c SHA512 de107dd50b078d9f7e0f838b3e439e2012d6e4e14fcdd2438de344a11dd6b2542ee1efd029067fddf05b8eb9d97786f214ff199d1b6aabfd2e3459f9840bc497 DIST llvm-project-15.0.7.src.tar.xz 110936452 BLAKE2B f3d277e2029157329e5be78b78af36b0826a1dfd9a337992499bf701e33149665bfc47d5e14978e38f342559629a559f8b2ce328705ba34fdf6830f5ae9721a5 SHA512 4836d3603f32e8e54434cbfa8ef33d9d473ac5dc20ebf9c67132653c73f4524931abd1084655eaee5f20bcfcb91bcc4bbc5c4a0b603ad0c9029c556e14dc4c52 DIST llvm-project-15.0.7.src.tar.xz.sig 566 BLAKE2B 47dc8c82d86237b80c6d85f83a6c9a6e9e174cf8e7f367b071e0cd9481d7cd408e991337c5624e07f3f370f26387c814f212808575ed1c1b58404d3e3836b7df SHA512 fc6891b440dd1175eb8df3790590af8d36bc92301660f84744ae15123475aeb900a151e6a8e7998ded27ec4d86871903ad0b89cd61164943054c2e3bc8d8beb2 DIST llvm-project-16.0.6.src.tar.xz 118013488 BLAKE2B 95192d39cbd2914e5609db365965f1c00bfea6c2d653b3996bd2acef8a2b37e37f6fc8a9d2b65711ad72657e0ef52c42f733053cf65051e7822f27396c30406d SHA512 89a67ebfbbc764cc456e8825ecfa90707741f8835b1b2adffae0b227ab1fe5ca9cce75b0efaffc9ca8431cae528dc54fd838867a56a2b645344d9e82d19ab1b7 diff --git a/llvm-runtimes/libcxx/libcxx-22.0.0_pre20251108.ebuild b/llvm-runtimes/libcxx/libcxx-22.0.0_pre20251108.ebuild new file mode 100644 index 000000000000..9825200fd784 --- /dev/null +++ b/llvm-runtimes/libcxx/libcxx-22.0.0_pre20251108.ebuild @@ -0,0 +1,260 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{11..14} ) +inherit cmake-multilib crossdev flag-o-matic llvm.org llvm-utils +inherit 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" +IUSE="+clang +libcxxabi +static-libs test" +REQUIRED_USE="test? ( clang )" +RESTRICT="!test? ( test )" + +RDEPEND=" + libcxxabi? ( + ~llvm-runtimes/libcxxabi-${PV}[static-libs?,${MULTILIB_USEDEP}] + ) + !libcxxabi? ( >=sys-devel/gcc-4.7:=[cxx] ) +" +DEPEND=" + ${RDEPEND} + llvm-core/llvm:${LLVM_MAJOR} +" +BDEPEND=" + clang? ( + llvm-core/clang:${LLVM_MAJOR} + llvm-core/clang-linker-config:${LLVM_MAJOR} + llvm-runtimes/clang-rtlib-config:${LLVM_MAJOR} + llvm-runtimes/clang-unwindlib-config:${LLVM_MAJOR} + ) + !test? ( + ${PYTHON_DEPS} + ) + test? ( + dev-debug/gdb[python] + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]') + ) +" + +LLVM_COMPONENTS=( + runtimes libcxx{,abi} libc llvm/{cmake,utils/llvm-lit} cmake +) +llvm.org_set_globals + +python_check_deps() { + use test || return 0 + python_has_version "dev-python/lit[${PYTHON_USEDEP}]" +} + +pkg_setup() { + 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() { + local install_prefix=${EPREFIX} + is_crosspkg && install_prefix+=/usr/${CTARGET} + + # 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=system-libcxxabi + cxxabi_incs="${install_prefix}/usr/include/c++/v1" + 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() { + # Workaround for bgo #961153. + # TODO: Fix the multilib.eclass, so it sets CTARGET properly. + if ! is_crosspkg; then + export CTARGET=${CHOST} + fi + + if use clang; then + llvm_prepend_path -b "${LLVM_MAJOR}" + local -x CC=${CTARGET}-clang-${LLVM_MAJOR} + local -x CXX=${CTARGET}-clang++-${LLVM_MAJOR} + strip-unsupported-flags + + # The full clang configuration might not be ready yet. Use the partial + # configuration of components that libunwind depends on. + local flags=( + --config="${ESYSROOT}"/etc/clang/"${LLVM_MAJOR}"/gentoo-{rtlib,unwindlib,linker}.cfg + ) + local -x CFLAGS="${CFLAGS} ${flags[@]}" + local -x CXXFLAGS="${CXXFLAGS} ${flags[@]}" + local -x LDFLAGS="${LDFLAGS} ${flags[@]}" + fi + + # link to compiler-rt + local use_compiler_rt=OFF + [[ $(tc-get-c-rtlib) == compiler-rt ]] && use_compiler_rt=ON + + local nostdlib_flags=( -nostdlib++ ) + if ! test_compiler && test_compiler "${nostdlib_flags[@]}"; then + local -x LDFLAGS="${LDFLAGS} ${nort_flags[*]}" + ewarn "${CXX} seems to lack runtime, trying with ${nort_flags[*]}" + fi + + local libdir=$(get_libdir) + local mycmakeargs=( + -DLLVM_ROOT="${ESYSROOT}/usr/lib/llvm/${LLVM_MAJOR}" + + -DCMAKE_CXX_COMPILER_TARGET="${CTARGET}" + -DPython3_EXECUTABLE="${PYTHON}" + -DLLVM_ENABLE_RUNTIMES=libcxx + -DLLVM_INCLUDE_TESTS=OFF + -DLLVM_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=$(llvm_cmake_use_musl) + -DLIBCXX_INCLUDE_BENCHMARKS=OFF + -DLIBCXX_INCLUDE_TESTS=$(usex test) + -DLIBCXX_INSTALL_MODULES=ON + -DLIBCXX_USE_COMPILER_RT=${use_compiler_rt} + # this is broken with standalone builds, and also meaningless + -DLIBCXXABI_USE_LLVM_UNWINDER=OFF + ) + if is_crosspkg; then + # Needed to target built libc headers + local -x CFLAGS="${CFLAGS} -isystem ${ESYSROOT}/usr/${CTARGET}/usr/include" + mycmakeargs+=( + # Without this, the compiler will compile a test program + # and fail due to no builtins. + -DCMAKE_C_COMPILER_WORKS=1 + -DCMAKE_CXX_COMPILER_WORKS=1 + # Install inside the cross sysroot. + -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/${CTARGET}/usr" + ) + fi + if use test; then + mycmakeargs+=( + -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit" + -DLLVM_LIT_ARGS="$(get_lit_flags)" + -DPython3_EXECUTABLE="${PYTHON}" + ) + fi + cmake_src_configure +} + +multilib_src_compile() { + cmake_src_compile + if [[ ${CHOST} != *-darwin* ]] ; then + local libdir=$(get_libdir) + gen_shared_ldscript + use static-libs && gen_static_ldscript + fi +} + +multilib_src_test() { + local -x LIT_PRESERVES_TMP=1 + # https://github.com/llvm/llvm-project/issues/153940 + local -x LIT_XFAIL="libcxx/gdb/gdb_pretty_printer_test.sh.cpp" + cmake_build install-cxx-test-suite-prefix + if [[ ${CHOST} != *-darwin* ]] ; then + local libdir=$(get_libdir) + cp "${BUILD_DIR}"/{,libcxx/test-suite-install/}"${libdir}"/libc++_shared.so || die + if use static-libs; then + cp "${BUILD_DIR}"/{,libcxx/test-suite-install/}"${libdir}"/libc++_static.a || die + fi + fi + cmake_build check-cxx +} + +multilib_src_install() { + cmake_src_install + # since we've replaced libc++.{a,so} with ldscripts, now we have to + # install the extra symlinks + if [[ ${CHOST} != *-darwin* ]] ; then + local libdir=$(get_libdir) + is_crosspkg && into /usr/${CTARGET} + dolib.so "${libdir}"/libc++_shared.so + use static-libs && dolib.a "${libdir}"/libc++_static.a + fi + + local install_prefix= + is_crosspkg && install_prefix=/usr/${CTARGET} + insinto "${install_prefix}/usr/share/libc++/gdb" + doins ../libcxx/utils/gdb/libcxx/printers.py + + local lib_version=$(sed -n -e 's/^LIBCXX_LIBRARY_VERSION:STRING=//p' CMakeCache.txt || die) + [[ -n ${lib_version} ]] || die "Could not determine LIBCXX_LIBRARY_VERSION from CMakeCache.txt" + + insinto "${install_prefix}/usr/share/gdb/auto-load/usr/$(get_libdir)" + newins - "libc++.so.${lib_version}-gdb.py" <<-EOF + __import__("sys").path.insert(0, "${EPREFIX}/usr/share/libc++/gdb") + __import__("printers").register_libcxx_printer_loader() + EOF +} + +# 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() { + # Move it first. + mv "${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 + $(usex libcxxabi libc++abi.a libsupc++.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[*]}" > "${libdir}"/libc++.a || die +} + +gen_shared_ldscript() { + # Move it first. + mv "${libdir}"/libc++{,_shared}.so || die + local deps=( + libc++_shared.so + # libsupc++ doesn't have a shared version + $(usex libcxxabi libc++abi.so libsupc++.a) + ) + + gen_ldscript "${deps[*]}" > "${libdir}"/libc++.so || die +} |
