commit:     20dbb4082fb980c0b89165d0186aa17c10fcb2c9
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 28 13:57:07 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jul 28 13:58:36 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=20dbb408

sys-libs/libcxx: Default to building w/ clang, part. fix tests

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 sys-libs/libcxx/libcxx-15.0.0.9999.ebuild | 23 ++++++++++++++++++-----
 sys-libs/libcxx/metadata.xml              |  2 ++
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/sys-libs/libcxx/libcxx-15.0.0.9999.ebuild 
b/sys-libs/libcxx/libcxx-15.0.0.9999.ebuild
index b65a070744cd..25841a822b4c 100644
--- a/sys-libs/libcxx/libcxx-15.0.0.9999.ebuild
+++ b/sys-libs/libcxx/libcxx-15.0.0.9999.ebuild
@@ -13,9 +13,12 @@ HOMEPAGE="https://libcxx.llvm.org/";
 LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
 SLOT="0"
 KEYWORDS=""
-IUSE="+libcxxabi +libunwind static-libs test"
+IUSE="+clang +libcxxabi +libunwind static-libs test"
+REQUIRED_USE="
+       libunwind? ( libcxxabi )
+       test? ( clang )
+"
 RESTRICT="!test? ( test )"
-REQUIRED_USE="libunwind? ( libcxxabi )"
 
 RDEPEND="
        libcxxabi? (
@@ -31,12 +34,14 @@ DEPEND="
        >=sys-devel/llvm-6
 "
 BDEPEND="
+       clang? (
+               sys-devel/clang
+       )
        !test? (
                ${PYTHON_DEPS}
        )
        test? (
                >=dev-util/cmake-3.16
-               >=sys-devel/clang-3.9.0
                sys-devel/gdb[python]
                $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]')
        )
@@ -90,6 +95,14 @@ src_configure() {
 }
 
 multilib_src_configure() {
+       if use clang && ! tc-is-clang; then
+               # Only do this conditionally to allow overriding with
+               # e.g. CC=clang-13 in case of breakage
+               local -x CC=${CHOST}-clang
+               local -x CXX=${CHOST}-clang++
+               strip-unsupported-flags
+       fi
+
        # 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
@@ -129,6 +142,7 @@ multilib_src_configure() {
 
        local libdir=$(get_libdir)
        local mycmakeargs=(
+               -DCMAKE_CXX_COMPILER_TARGET="${CHOST}"
                -DPython3_EXECUTABLE="${PYTHON}"
                -DLLVM_ENABLE_RUNTIMES=libcxx
                -DLLVM_INCLUDE_TESTS=OFF
@@ -155,8 +169,7 @@ multilib_src_configure() {
 
                mycmakeargs+=(
                        -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
-                       
-DLLVM_LIT_ARGS="$(get_lit_flags);--param=cxx_under_test=${clang_path}"
-                       -DLIBCXX_LINK_TESTS_WITH_SHARED_LIBCXXABI=ON
+                       -DLLVM_LIT_ARGS="$(get_lit_flags)"
                        -DPython3_EXECUTABLE="${PYTHON}"
                )
        fi

diff --git a/sys-libs/libcxx/metadata.xml b/sys-libs/libcxx/metadata.xml
index 88b259915838..81bfc59aae3f 100644
--- a/sys-libs/libcxx/metadata.xml
+++ b/sys-libs/libcxx/metadata.xml
@@ -10,6 +10,8 @@
                <name>LLVM Project</name>
        </maintainer>
        <use>
+               <flag name="clang">Force building using installed clang (rather
+                       than the default CC/CXX; required for testing).</flag>
                <flag name="libcxxabi">Build on top of 
<pkg>sys-libs/libcxxabi</pkg> instead of gcc's libsupc++ (avoids depending on 
gcc).</flag>
                <flag name="libunwind">Use libunwind instead of libgcc_s for 
stack unwinding, thus avoiding dependence on gcc.</flag>
        </use>

Reply via email to