mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-09 18:47:16 -08:00
llvm-runtimes/libcxx: Add 24.0.0_pre20260929 snapshot
Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
@@ -15,3 +15,4 @@ DIST llvm-project-23.1.1.src.tar.xz.sig 466 BLAKE2B fd062ee7b6a59295f1ba558ed35f
|
||||
DIST llvm-project-23.1.2.src.tar.xz 179200068 BLAKE2B 554cddd2a3e273ba876da7815e5b0b6999319d2d2c0016603def4e31ce064fe119422aca0033ea0ab2e36ea22d46985ea042b891eed60647b119687c19f9b556 SHA512 91174e69ea787034f8a6b17120aae5f139204e13292119d1b066b4930dcea586c76b82228d3db281d8d4211384c7cb74c6b61fdef41b39d310908a8c7cf080cc
|
||||
DIST llvm-project-23.1.2.src.tar.xz.sig 119 BLAKE2B 20a19a2a584c6298841e20f95bf13e42c5f591f82087abd26f77f1d7f87b575dc661fd8bc72f6a7faad485cf75ff4219fb810fbb3a73b0a5992014157e5094fc SHA512 fe76751211cfb1a56935f0e6fd9536309eb02111acb3f32f4badf7e45e6f0283125cf2ece00baa420afc488667c7e1fbb06f0567aa33ff9459f41281cb25e10c
|
||||
DIST llvm-project-3dcd66d0110335d7d1a5921fd085914b66ffbd3c.tar.gz 317468883 BLAKE2B af57748bf462852a7d09751162e43c52b7d8fa4d1e3e9b021062b11132ad2268b2ddefd0e2d0b2391de1e8120b751fe46a368bc58dce83b8d5e4413716701031 SHA512 678027e165bf444eb522a70b5c52018dba4b41828fa7db353bd1155ec326633adfe64e20e5975b672fc2669c6fd7e0dec0dbd8c63ee89e0393264d9af5ab3090
|
||||
DIST llvm-project-9fe649af67007493c02108b484c8b9259e3d522e.tar.gz 318504162 BLAKE2B 43f10fa26c665d9986a093fa8287f302b54dee2b0e74c3c835fd7642c233a3574b3e03e82380f24b1d277b1063ae3bca05a2061b9fa794559f695aa9689e5134 SHA512 7000bf65c5d696a1a870ba8a7f645958970f535a3b68cc7df8da8f3fa31afe4fb02049532919a5974721618b212b3ed7796fd0e1e63de69484517cd91a2289e9
|
||||
|
||||
@@ -0,0 +1,262 @@
|
||||
# Copyright 1999-2026 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
PYTHON_COMPAT=( python3_{12..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} 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} ${nostdlib_flags[*]}"
|
||||
ewarn "${CXX} seems to lack runtime, trying with ${nostdlib_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 kernel_Darwin; then
|
||||
# For Darwin it ships libc++ in system by default, conflicting prefix
|
||||
mycmakeargs+=( -DLIBCXX_ABI_NAMESPACE=__gentoo1 )
|
||||
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
|
||||
cmake_build libcxx-test-suite-install-cxx
|
||||
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}/usr
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user