llvm-runtimes/libcxx: Add 22.0.0_pre20250815 snapshot

Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny
2025-08-16 15:05:11 +02:00
parent c5f1f487ab
commit d10590883e
2 changed files with 252 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ DIST llvm-project-18.1.8.src.tar.xz.sig 566 BLAKE2B 6ab0efc5b38d4483f4e32e8b8577
DIST llvm-project-19.1.7.src.tar.xz 141249332 BLAKE2B 1259ed7f9aca7b35e89d818befdee20fd8bed4d2dc2c2c6f6f56451fd43d35ac03a0a5a406e142d22b25137999dc5b17471c196f8fcf79f20a8296832d900f6d SHA512 c7d63286d662707a9cd54758c9e3aaf52794a91900c484c4a6efa62d90bc719d5e7a345e4192feeb0c9fd11c82570d64677c781e5be1d645556b6aa018e47ec8
DIST llvm-project-19.1.7.src.tar.xz.sig 438 BLAKE2B 4015140f4ba77de45039bdbdfbaf6f30e75705123d067ea97175d91d7a5b6a75008df01d99ae7aa16aaa3b101f3f41e38d01f04158f95a261d617b3ede0254cd SHA512 195797b06ac80a742e0ccbc03a50dc06dd2e04377d783d5474e3e72c5a75203b60292b047929312a411d22b137a239943fba414a4d136a2be14cbff978eb6bda
DIST llvm-project-190fcc28af585cb06480b026afd14ed87b18adb8.tar.gz 243483242 BLAKE2B f53d743ca332dfffe1f98d51f0528e14b61e4c11904ec20c4b4c9b285f8ca7eb25eb2ce8549e21566e63ab393697c74acd4a41fddc7bab282535aa8ccf9195da SHA512 b6bcf8647f35fee209fbd8a8c297f7d89f1aac9cac4e3c62abd73171350c4c7a98572ccd175ca0a8fce8d2fe00bf5cfbeea329689b687ab6261586e894397150
DIST llvm-project-1c7720ef78dc5eb9196d6c178afe03b60f201b78.tar.gz 245239122 BLAKE2B 74342ef3a8105915201f6260aa8c633ccd67821894d33605d82ca0f02d0d0766fe3198e834c4c5cae8123d911b5a20849c04ea02aea52f57f8d1a09e17c18199 SHA512 10a63bdf7d790c5964274414dc01b480a976318f27b5807ca47d9149b97106530264a75930c689ca7cc417de3df44142280cd92559ff7873190f1045d79e7856
DIST llvm-project-20.1.7.src.tar.xz 147245448 BLAKE2B f7c57d1eba4e97e875b624dec3fb1b261a0203de7200366de5b3edcfbca2a170c41df46e91cd9cb78ae2af66120aef95334f5eb9628a1489e921c6bdf4cccfe8 SHA512 c2dbf6a468a8152409db7ff52902ecf8768a1d0328e386999f4f3672613903e1c10bddbba66b8553a6222952f8edb66266947f1fb21d0b09ae741e6249b6d1fa
DIST llvm-project-20.1.7.src.tar.xz.sig 566 BLAKE2B 72ce2a18c211cfce9581a9e3e71f1c55cf18672aa355267581220e1a89e3327f9e16107970b69bb8f10f390baa5e286487bdc4cc0a7d9155ec13a4977cd3f472 SHA512 eff885059d547f57b98bda1fc9631f716ca6c650cd48203d9ed5443a6afb9a2d4d91d3f5c8618e307c0a44b3040bce61fdc6bce965073adc537655755d9f2112
DIST llvm-project-20.1.8.src.tar.xz 147242952 BLAKE2B 7657ac0b26acc5affb1bfc91b912ade3191c5d77f3979d5a80d5f6ce52f56a7d1c448bd257398390bf10838f02faa6f3ece37a7327cced69d165ec2e2e699316 SHA512 f330e72e6a1da468569049437cc0ba7a41abb816ccece7367189344f7ebfef730f4788ac7af2bef0aa8a49341c15ab1d31e941ffa782f264d11fe0dc05470773

View File

@@ -0,0 +1,251 @@
# 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}
)
!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
local -x CXX=${CTARGET}-clang++
strip-unsupported-flags
fi
# link to compiler-rt
local use_compiler_rt=OFF
[[ $(tc-get-c-rtlib) == compiler-rt ]] && use_compiler_rt=ON
# Scenarios to consider:
#
# 1. Compiler test works with the default flags.
# 2. There is a runtime library, but no stdlib. In that case, leave the
# LDFLAGS untouched, since there is no self-dependency in libc++.
# 3. There is no runtime library nor stdlib. In that case, overwrite the
# LDFLAGS.
local nostdlib_flags=( -nostdlib --rtlib=compiler-rt -lc )
local nort_flags=( -nodefaultlibs -lc )
if ! test_compiler && ! test_compiler "${nostdlib_flags[@]}"; then
if test_compiler "${nort_flags[@]}"; then
local -x LDFLAGS="${LDFLAGS} ${nort_flags[*]}"
ewarn "${CXX} seems to lack runtime, trying with ${nort_flags[*]}"
fi
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
gen_shared_ldscript
use static-libs && gen_static_ldscript
fi
}
multilib_src_test() {
local -x LIT_PRESERVES_TMP=1
cmake_build install-cxx-test-suite-prefix
cp "${BUILD_DIR}"/{lib,libcxx/test-suite-install/$(get_libdir)}/libc++_shared.so || die
if use static-libs; then
cp "${BUILD_DIR}"/{lib,libcxx/test-suite-install/$(get_libdir)}/libc++_static.a || die
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
is_crosspkg && into /usr/${CTARGET}
dolib.so lib/libc++_shared.so
use static-libs && dolib.a lib/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 lib/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[*]}" > lib/libc++.a || die
}
gen_shared_ldscript() {
# Move it first.
mv lib/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[*]}" > lib/libc++.so || die
}