commit:     6ecc3aecabbfdebdc6af5ce1fc530d6db7600c5e
Author:     Michal Rostecki <vadorovsky <AT> protonmail <DOT> com>
AuthorDate: Mon Aug  4 08:06:39 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Sep  2 13:59:06 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6ecc3aec

llvm-runtimes/libcxx: Use the partial clang configuration files

Initial installation or upgrade of libcxx happens before the main
slotted clang configuration file is created by llvm-core/clang-runtime.
Bulding libcxx requires only the linker (`-fuse-ld`) and rtlib
(`--rtlib`) configuration to be present. To fix the initial builds, we
can use the partiaon configuration provided by:

* llvm-core/clang-linker-config
* llvm-runtimes/clang-rtlib-config
* llvm-runtimes/clang-unwindlib-config

Signed-off-by: Michal Rostecki <vadorovsky <AT> protonmail.com>
Closes: https://bugs.gentoo.org/951445
Part-of: https://github.com/gentoo/gentoo/pull/42663
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Part-of: https://github.com/gentoo/gentoo/pull/42663
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 ...-22.0.0.9999.ebuild => libcxx-20.1.8-r1.ebuild} | 51 ++++++++--------------
 ...-22.0.0.9999.ebuild => libcxx-21.1.0-r1.ebuild} | 37 ++++++++--------
 llvm-runtimes/libcxx/libcxx-22.0.0.9999.ebuild     | 34 ++++++++-------
 .../libcxx/libcxx-22.0.0_pre20250831.ebuild        | 34 ++++++++-------
 4 files changed, 74 insertions(+), 82 deletions(-)

diff --git a/llvm-runtimes/libcxx/libcxx-22.0.0.9999.ebuild 
b/llvm-runtimes/libcxx/libcxx-20.1.8-r1.ebuild
similarity index 79%
copy from llvm-runtimes/libcxx/libcxx-22.0.0.9999.ebuild
copy to llvm-runtimes/libcxx/libcxx-20.1.8-r1.ebuild
index a95352f0932a..13afc91130bf 100644
--- a/llvm-runtimes/libcxx/libcxx-22.0.0.9999.ebuild
+++ b/llvm-runtimes/libcxx/libcxx-20.1.8-r1.ebuild
@@ -12,6 +12,7 @@ HOMEPAGE="https://libcxx.llvm.org/";
 
 LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
 SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~riscv ~sparc ~x86 ~arm64-macos ~x64-macos"
 IUSE="+clang +libcxxabi +static-libs test"
 REQUIRED_USE="test? ( clang )"
 RESTRICT="!test? ( test )"
@@ -29,6 +30,9 @@ DEPEND="
 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}
@@ -93,29 +97,28 @@ multilib_src_configure() {
 
        if use clang; then
                llvm_prepend_path -b "${LLVM_MAJOR}"
-               local -x CC=${CTARGET}-clang
-               local -x CXX=${CTARGET}-clang++
+               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
 
-       # 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
+       local nostdlib_flags=( -nostdlib++ )
+       if ! test_compiler && test_compiler "${nostdlib_flags[@]}"; then
+               local -x LDFLAGS="${LDFLAGS} ${nostdlib_flags[*]}"
+               ewarn "${CXX} seems to lack stdlib, trying with 
${nostdlib_flags[*]}"
        fi
 
        local libdir=$(get_libdir)
@@ -174,8 +177,6 @@ multilib_src_compile() {
 
 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
        cp 
"${BUILD_DIR}"/{lib,libcxx/test-suite-install/$(get_libdir)}/libc++_shared.so 
|| die
        if use static-libs; then
@@ -193,20 +194,6 @@ multilib_src_install() {
                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

diff --git a/llvm-runtimes/libcxx/libcxx-22.0.0.9999.ebuild 
b/llvm-runtimes/libcxx/libcxx-21.1.0-r1.ebuild
similarity index 87%
copy from llvm-runtimes/libcxx/libcxx-22.0.0.9999.ebuild
copy to llvm-runtimes/libcxx/libcxx-21.1.0-r1.ebuild
index a95352f0932a..618ec03322e9 100644
--- a/llvm-runtimes/libcxx/libcxx-22.0.0.9999.ebuild
+++ b/llvm-runtimes/libcxx/libcxx-21.1.0-r1.ebuild
@@ -12,6 +12,7 @@ HOMEPAGE="https://libcxx.llvm.org/";
 
 LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
 SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~riscv ~sparc ~x86 ~arm64-macos ~x64-macos"
 IUSE="+clang +libcxxabi +static-libs test"
 REQUIRED_USE="test? ( clang )"
 RESTRICT="!test? ( test )"
@@ -29,6 +30,9 @@ DEPEND="
 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}
@@ -93,29 +97,28 @@ multilib_src_configure() {
 
        if use clang; then
                llvm_prepend_path -b "${LLVM_MAJOR}"
-               local -x CC=${CTARGET}-clang
-               local -x CXX=${CTARGET}-clang++
+               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
 
-       # 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
+       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)
@@ -174,8 +177,6 @@ multilib_src_compile() {
 
 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
        cp 
"${BUILD_DIR}"/{lib,libcxx/test-suite-install/$(get_libdir)}/libc++_shared.so 
|| die
        if use static-libs; then

diff --git a/llvm-runtimes/libcxx/libcxx-22.0.0.9999.ebuild 
b/llvm-runtimes/libcxx/libcxx-22.0.0.9999.ebuild
index a95352f0932a..780fc7161714 100644
--- a/llvm-runtimes/libcxx/libcxx-22.0.0.9999.ebuild
+++ b/llvm-runtimes/libcxx/libcxx-22.0.0.9999.ebuild
@@ -29,6 +29,9 @@ DEPEND="
 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}
@@ -93,29 +96,28 @@ multilib_src_configure() {
 
        if use clang; then
                llvm_prepend_path -b "${LLVM_MAJOR}"
-               local -x CC=${CTARGET}-clang
-               local -x CXX=${CTARGET}-clang++
+               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
 
-       # 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
+       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)

diff --git a/llvm-runtimes/libcxx/libcxx-22.0.0_pre20250831.ebuild 
b/llvm-runtimes/libcxx/libcxx-22.0.0_pre20250831.ebuild
index a95352f0932a..780fc7161714 100644
--- a/llvm-runtimes/libcxx/libcxx-22.0.0_pre20250831.ebuild
+++ b/llvm-runtimes/libcxx/libcxx-22.0.0_pre20250831.ebuild
@@ -29,6 +29,9 @@ DEPEND="
 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}
@@ -93,29 +96,28 @@ multilib_src_configure() {
 
        if use clang; then
                llvm_prepend_path -b "${LLVM_MAJOR}"
-               local -x CC=${CTARGET}-clang
-               local -x CXX=${CTARGET}-clang++
+               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
 
-       # 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
+       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)

Reply via email to