commit: bde0805b5bcca1a2058ab57b2c3a3723d9024384
Author: Michal Rostecki <vadorovsky <AT> protonmail <DOT> com>
AuthorDate: Mon Dec 2 14:04:37 2024 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Mar 17 06:21:35 2025 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bde0805b
sys-libs/llvm-libunwind: Support cross build
Inherit the `crossdev` eclass and use a cross sysroot when a custom
target is specified. That allows to bootstrap llvm-libunwind with
crossdev.
Signed-off-by: Michal Rostecki <vadorovsky <AT> protonmail.com>
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
...nd-20.1.0.ebuild => libunwind-19.1.7-r1.ebuild} | 25 ++++++++++++++++------
llvm-runtimes/libunwind/libunwind-20.1.0.ebuild | 23 +++++++++++++++-----
.../libunwind/libunwind-21.0.0.9999.ebuild | 23 +++++++++++++++-----
3 files changed, 55 insertions(+), 16 deletions(-)
diff --git a/llvm-runtimes/libunwind/libunwind-20.1.0.ebuild
b/llvm-runtimes/libunwind/libunwind-19.1.7-r1.ebuild
similarity index 82%
copy from llvm-runtimes/libunwind/libunwind-20.1.0.ebuild
copy to llvm-runtimes/libunwind/libunwind-19.1.7-r1.ebuild
index 1fce26a90bfc..e78633a452af 100644
--- a/llvm-runtimes/libunwind/libunwind-20.1.0.ebuild
+++ b/llvm-runtimes/libunwind/libunwind-19.1.7-r1.ebuild
@@ -4,8 +4,8 @@
EAPI=8
PYTHON_COMPAT=( python3_{10..13} )
-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"
@@ -36,7 +36,7 @@ BDEPEND="
"
LLVM_COMPONENTS=( runtimes libunwind libcxx llvm/cmake cmake )
-LLVM_TEST_COMPONENTS=( libc libcxxabi llvm/utils/llvm-lit )
+LLVM_TEST_COMPONENTS=( libcxxabi llvm/utils/llvm-lit )
llvm.org_set_globals
python_check_deps() {
@@ -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
@@ -73,8 +73,13 @@ multilib_src_configure() {
# See also
https://github.com/llvm/llvm-project/issues/86#issuecomment-1649668826.
use debug || append-cppflags -DNDEBUG
+ local install_prefix="${EPREFIX}"
+ target_is_not_host && install_prefix+=/usr/${CTARGET}
+
local mycmakeargs=(
- -DCMAKE_CXX_COMPILER_TARGET="${CHOST}"
+ -DCMAKE_C_COMPILER_TARGET="${CTARGET}"
+ -DCMAKE_CXX_COMPILER_TARGET="${CTARGET}"
+ -DCMAKE_INSTALL_PREFIX="${install_prefix}/usr"
-DPython3_EXECUTABLE="${PYTHON}"
-DLLVM_ENABLE_RUNTIMES="libunwind"
-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
@@ -91,6 +96,14 @@ 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
+ )
+ fi
if use test; then
mycmakeargs+=(
-DLLVM_ENABLE_RUNTIMES="libunwind;libcxxabi;libcxx"
diff --git a/llvm-runtimes/libunwind/libunwind-20.1.0.ebuild
b/llvm-runtimes/libunwind/libunwind-20.1.0.ebuild
index 1fce26a90bfc..d746ace56914 100644
--- a/llvm-runtimes/libunwind/libunwind-20.1.0.ebuild
+++ b/llvm-runtimes/libunwind/libunwind-20.1.0.ebuild
@@ -4,8 +4,8 @@
EAPI=8
PYTHON_COMPAT=( python3_{10..13} )
-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
@@ -73,8 +73,13 @@ multilib_src_configure() {
# See also
https://github.com/llvm/llvm-project/issues/86#issuecomment-1649668826.
use debug || append-cppflags -DNDEBUG
+ local install_prefix="${EPREFIX}"
+ target_is_not_host && install_prefix+=/usr/${CTARGET}
+
local mycmakeargs=(
- -DCMAKE_CXX_COMPILER_TARGET="${CHOST}"
+ -DCMAKE_C_COMPILER_TARGET="${CTARGET}"
+ -DCMAKE_CXX_COMPILER_TARGET="${CTARGET}"
+ -DCMAKE_INSTALL_PREFIX="${install_prefix}/usr"
-DPython3_EXECUTABLE="${PYTHON}"
-DLLVM_ENABLE_RUNTIMES="libunwind"
-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
@@ -91,6 +96,14 @@ 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
+ )
+ fi
if use test; then
mycmakeargs+=(
-DLLVM_ENABLE_RUNTIMES="libunwind;libcxxabi;libcxx"
diff --git a/llvm-runtimes/libunwind/libunwind-21.0.0.9999.ebuild
b/llvm-runtimes/libunwind/libunwind-21.0.0.9999.ebuild
index 026430534993..d4a064a47232 100644
--- a/llvm-runtimes/libunwind/libunwind-21.0.0.9999.ebuild
+++ b/llvm-runtimes/libunwind/libunwind-21.0.0.9999.ebuild
@@ -4,8 +4,8 @@
EAPI=8
PYTHON_COMPAT=( python3_{10..13} )
-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
@@ -72,8 +72,13 @@ multilib_src_configure() {
# See also
https://github.com/llvm/llvm-project/issues/86#issuecomment-1649668826.
use debug || append-cppflags -DNDEBUG
+ local install_prefix="${EPREFIX}"
+ target_is_not_host && install_prefix+=/usr/${CTARGET}
+
local mycmakeargs=(
- -DCMAKE_CXX_COMPILER_TARGET="${CHOST}"
+ -DCMAKE_C_COMPILER_TARGET="${CTARGET}"
+ -DCMAKE_CXX_COMPILER_TARGET="${CTARGET}"
+ -DCMAKE_INSTALL_PREFIX="${install_prefix}/usr"
-DPython3_EXECUTABLE="${PYTHON}"
-DLLVM_ENABLE_RUNTIMES="libunwind"
-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
@@ -90,6 +95,14 @@ 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
+ )
+ fi
if use test; then
mycmakeargs+=(
-DLLVM_ENABLE_RUNTIMES="libunwind;libcxxabi;libcxx"