commit: ab967f7e20184c969a9bf03cfcc383059af7a919 Author: Michal Rostecki <vadorovsky <AT> protonmail <DOT> com> AuthorDate: Mon Aug 4 11:31:12 2025 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Wed Aug 6 12:29:14 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ab967f7e
llvm-runtimes/libunwind: Support crosspkg build Inherit the `crossdev` eclass, use clang for the current `CTARGET` and install libunwind into a cross sysroot, if package belongs to any crossdev category. That allows to bootstrap libunwind with crossdev by installing `cross_llvm-*/libunwind`. Signed-off-by: Michal Rostecki <vadorovsky <AT> protonmail.com> Part-of: https://github.com/gentoo/gentoo/pull/39280 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> Part-of: https://github.com/gentoo/gentoo/pull/39280 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> llvm-runtimes/libunwind/libunwind-19.1.7.ebuild | 23 ++++++++++++++++------ llvm-runtimes/libunwind/libunwind-20.1.8.ebuild | 21 +++++++++++++++----- .../libunwind/libunwind-21.1.0.9999.ebuild | 21 +++++++++++++++----- .../libunwind/libunwind-22.0.0.9999.ebuild | 21 +++++++++++++++----- 4 files changed, 65 insertions(+), 21 deletions(-) diff --git a/llvm-runtimes/libunwind/libunwind-19.1.7.ebuild b/llvm-runtimes/libunwind/libunwind-19.1.7.ebuild index 80038def5bc0..40caf4086be6 100644 --- a/llvm-runtimes/libunwind/libunwind-19.1.7.ebuild +++ b/llvm-runtimes/libunwind/libunwind-19.1.7.ebuild @@ -3,9 +3,9 @@ EAPI=8 -PYTHON_COMPAT=( python3_{10..13} ) -inherit cmake-multilib flag-o-matic llvm.org llvm-utils python-any-r1 -inherit toolchain-funcs +PYTHON_COMPAT=( python3_{11..13} ) +inherit cmake-multilib crossdev flag-o-matic llvm.org llvm-utils +inherit python-any-r1 toolchain-funcs DESCRIPTION="C++ runtime stack unwinder from LLVM" HOMEPAGE="https://llvm.org/docs/ExceptionHandling.html" @@ -54,8 +54,8 @@ multilib_src_configure() { filter-lto if use clang; then - local -x CC=${CHOST}-clang - local -x CXX=${CHOST}-clang++ + local -x CC=${CTARGET}-clang + local -x CXX=${CTARGET}-clang++ strip-unsupported-flags fi @@ -74,7 +74,8 @@ multilib_src_configure() { use debug || append-cppflags -DNDEBUG local mycmakeargs=( - -DCMAKE_CXX_COMPILER_TARGET="${CHOST}" + -DCMAKE_C_COMPILER_TARGET="${CTARGET}" + -DCMAKE_CXX_COMPILER_TARGET="${CTARGET}" -DPython3_EXECUTABLE="${PYTHON}" -DLLVM_ENABLE_RUNTIMES="libunwind" -DLLVM_LIBDIR_SUFFIX=${libdir#lib} @@ -91,6 +92,16 @@ multilib_src_configure() { # avoid dependency on libgcc_s if compiler-rt is used -DLIBUNWIND_USE_COMPILER_RT=${use_compiler_rt} ) + if is_crosspkg; then + 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_ENABLE_RUNTIMES="libunwind;libcxxabi;libcxx" diff --git a/llvm-runtimes/libunwind/libunwind-20.1.8.ebuild b/llvm-runtimes/libunwind/libunwind-20.1.8.ebuild index 7131693d43ef..ed7764827321 100644 --- a/llvm-runtimes/libunwind/libunwind-20.1.8.ebuild +++ b/llvm-runtimes/libunwind/libunwind-20.1.8.ebuild @@ -4,8 +4,8 @@ EAPI=8 PYTHON_COMPAT=( python3_{11..14} ) -inherit cmake-multilib flag-o-matic llvm.org llvm-utils python-any-r1 -inherit toolchain-funcs +inherit cmake-multilib crossdev flag-o-matic llvm.org llvm-utils +inherit python-any-r1 toolchain-funcs DESCRIPTION="C++ runtime stack unwinder from LLVM" HOMEPAGE="https://llvm.org/docs/ExceptionHandling.html" @@ -54,8 +54,8 @@ multilib_src_configure() { filter-lto if use clang; then - local -x CC=${CHOST}-clang - local -x CXX=${CHOST}-clang++ + local -x CC=${CTARGET}-clang + local -x CXX=${CTARGET}-clang++ strip-unsupported-flags fi @@ -74,7 +74,8 @@ multilib_src_configure() { use debug || append-cppflags -DNDEBUG local mycmakeargs=( - -DCMAKE_CXX_COMPILER_TARGET="${CHOST}" + -DCMAKE_C_COMPILER_TARGET="${CTARGET}" + -DCMAKE_CXX_COMPILER_TARGET="${CTARGET}" -DPython3_EXECUTABLE="${PYTHON}" -DLLVM_ENABLE_RUNTIMES="libunwind" -DLLVM_LIBDIR_SUFFIX=${libdir#lib} @@ -91,6 +92,16 @@ multilib_src_configure() { # avoid dependency on libgcc_s if compiler-rt is used -DLIBUNWIND_USE_COMPILER_RT=${use_compiler_rt} ) + if is_crosspkg; then + 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_ENABLE_RUNTIMES="libunwind;libcxxabi;libcxx" diff --git a/llvm-runtimes/libunwind/libunwind-21.1.0.9999.ebuild b/llvm-runtimes/libunwind/libunwind-21.1.0.9999.ebuild index 67e0900b79c6..a41965693659 100644 --- a/llvm-runtimes/libunwind/libunwind-21.1.0.9999.ebuild +++ b/llvm-runtimes/libunwind/libunwind-21.1.0.9999.ebuild @@ -4,8 +4,8 @@ EAPI=8 PYTHON_COMPAT=( python3_{11..14} ) -inherit cmake-multilib flag-o-matic llvm.org llvm-utils python-any-r1 -inherit toolchain-funcs +inherit cmake-multilib crossdev flag-o-matic llvm.org llvm-utils +inherit python-any-r1 toolchain-funcs DESCRIPTION="C++ runtime stack unwinder from LLVM" HOMEPAGE="https://llvm.org/docs/ExceptionHandling.html" @@ -53,8 +53,8 @@ multilib_src_configure() { filter-lto if use clang; then - local -x CC=${CHOST}-clang - local -x CXX=${CHOST}-clang++ + local -x CC=${CTARGET}-clang + local -x CXX=${CTARGET}-clang++ strip-unsupported-flags fi @@ -73,7 +73,8 @@ multilib_src_configure() { use debug || append-cppflags -DNDEBUG local mycmakeargs=( - -DCMAKE_CXX_COMPILER_TARGET="${CHOST}" + -DCMAKE_C_COMPILER_TARGET="${CTARGET}" + -DCMAKE_CXX_COMPILER_TARGET="${CTARGET}" -DPython3_EXECUTABLE="${PYTHON}" -DLLVM_ENABLE_RUNTIMES="libunwind" -DLLVM_LIBDIR_SUFFIX=${libdir#lib} @@ -90,6 +91,16 @@ multilib_src_configure() { # avoid dependency on libgcc_s if compiler-rt is used -DLIBUNWIND_USE_COMPILER_RT=${use_compiler_rt} ) + if is_crosspkg; then + 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_ENABLE_RUNTIMES="libunwind;libcxxabi;libcxx" diff --git a/llvm-runtimes/libunwind/libunwind-22.0.0.9999.ebuild b/llvm-runtimes/libunwind/libunwind-22.0.0.9999.ebuild index 67e0900b79c6..a41965693659 100644 --- a/llvm-runtimes/libunwind/libunwind-22.0.0.9999.ebuild +++ b/llvm-runtimes/libunwind/libunwind-22.0.0.9999.ebuild @@ -4,8 +4,8 @@ EAPI=8 PYTHON_COMPAT=( python3_{11..14} ) -inherit cmake-multilib flag-o-matic llvm.org llvm-utils python-any-r1 -inherit toolchain-funcs +inherit cmake-multilib crossdev flag-o-matic llvm.org llvm-utils +inherit python-any-r1 toolchain-funcs DESCRIPTION="C++ runtime stack unwinder from LLVM" HOMEPAGE="https://llvm.org/docs/ExceptionHandling.html" @@ -53,8 +53,8 @@ multilib_src_configure() { filter-lto if use clang; then - local -x CC=${CHOST}-clang - local -x CXX=${CHOST}-clang++ + local -x CC=${CTARGET}-clang + local -x CXX=${CTARGET}-clang++ strip-unsupported-flags fi @@ -73,7 +73,8 @@ multilib_src_configure() { use debug || append-cppflags -DNDEBUG local mycmakeargs=( - -DCMAKE_CXX_COMPILER_TARGET="${CHOST}" + -DCMAKE_C_COMPILER_TARGET="${CTARGET}" + -DCMAKE_CXX_COMPILER_TARGET="${CTARGET}" -DPython3_EXECUTABLE="${PYTHON}" -DLLVM_ENABLE_RUNTIMES="libunwind" -DLLVM_LIBDIR_SUFFIX=${libdir#lib} @@ -90,6 +91,16 @@ multilib_src_configure() { # avoid dependency on libgcc_s if compiler-rt is used -DLIBUNWIND_USE_COMPILER_RT=${use_compiler_rt} ) + if is_crosspkg; then + 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_ENABLE_RUNTIMES="libunwind;libcxxabi;libcxx"
