commit: b465171bf81e25c18bc6443185215e6f80838766
Author: Michal Rostecki <vadorovsky <AT> protonmail <DOT> com>
AuthorDate: Mon Dec 2 14:04:13 2024 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Mar 17 06:21:34 2025 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b465171b
llvm-utils.eclass: Add `llvm_cmake_use_musl` helper
Checking only for `elibc_musl` USE flag is not sufficient when building
a musl cross environment on a glibc host. In such case, the host profile
always enforces `-elibc_musl` and effectively breaks the build of LLVM
toolchain (llvm-libunwind and libcxx*).
To cover that case, provide the helper which echos `ON` under two
ciricumstances:
* `CTARGET` is `*-musl*`.
* `elibc_musl` USE flag is set.
Signed-off-by: Michal Rostecki <vadorovsky <AT> protonmail.com>
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
eclass/llvm-utils.eclass | 17 ++++++++++++++++-
llvm-runtimes/libcxx/libcxx-18.1.8.ebuild | 4 ++--
llvm-runtimes/libcxx/libcxx-19.1.4.ebuild | 4 ++--
llvm-runtimes/libcxx/libcxx-19.1.7.ebuild | 2 +-
llvm-runtimes/libcxx/libcxx-20.1.0.ebuild | 2 +-
llvm-runtimes/libcxx/libcxx-21.0.0.9999.ebuild | 2 +-
llvm-runtimes/libcxx/libcxx-21.0.0_pre20250311.ebuild | 2 +-
llvm-runtimes/libcxxabi/libcxxabi-18.1.8.ebuild | 4 ++--
llvm-runtimes/libcxxabi/libcxxabi-19.1.4.ebuild | 4 ++--
llvm-runtimes/libcxxabi/libcxxabi-19.1.7.ebuild | 2 +-
llvm-runtimes/libcxxabi/libcxxabi-20.1.0.ebuild | 2 +-
llvm-runtimes/libcxxabi/libcxxabi-21.0.0.9999.ebuild | 2 +-
.../libcxxabi/libcxxabi-21.0.0_pre20250311.ebuild | 2 +-
llvm-runtimes/libunwind/libunwind-18.1.8.ebuild | 4 ++--
llvm-runtimes/libunwind/libunwind-19.1.4.ebuild | 4 ++--
llvm-runtimes/libunwind/libunwind-19.1.7.ebuild | 2 +-
llvm-runtimes/libunwind/libunwind-20.1.0.ebuild | 2 +-
llvm-runtimes/libunwind/libunwind-21.0.0.9999.ebuild | 2 +-
.../libunwind/libunwind-21.0.0_pre20250311.ebuild | 2 +-
19 files changed, 40 insertions(+), 25 deletions(-)
diff --git a/eclass/llvm-utils.eclass b/eclass/llvm-utils.eclass
index b105e169fbc4..abe8bb7d7d0f 100644
--- a/eclass/llvm-utils.eclass
+++ b/eclass/llvm-utils.eclass
@@ -1,4 +1,4 @@
-# Copyright 2024 Gentoo Authors
+# Copyright 2024-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: llvm-utils.eclass
@@ -171,4 +171,19 @@ llvm_prepend_path() {
export PATH=${new_path[*]}
}
+# @FUNCTION: llvm_cmake_use_musl
+# @DESCRIPTION:
+# Determine whether the given LLVM project should be built with musl
+# support. That should be the case if the CTARGET (or CHOST) is a musl
+# environment.
+#
+# If musl should be used, echo "ON", otherwise echo "OFF".
+llvm_cmake_use_musl() {
+ if [[ "${CTARGET:-${CHOST}}" == *-*-*-musl* ]]; then
+ echo "ON"
+ else
+ echo "OFF"
+ fi
+}
+
fi
diff --git a/llvm-runtimes/libcxx/libcxx-18.1.8.ebuild
b/llvm-runtimes/libcxx/libcxx-18.1.8.ebuild
index f22598e81b33..c59e6013226e 100644
--- a/llvm-runtimes/libcxx/libcxx-18.1.8.ebuild
+++ b/llvm-runtimes/libcxx/libcxx-18.1.8.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -125,7 +125,7 @@ multilib_src_configure() {
-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=$(usex elibc_musl)
+ -DLIBCXX_HAS_MUSL_LIBC=$(llvm_cmake_use_musl)
-DLIBCXX_INCLUDE_BENCHMARKS=OFF
-DLIBCXX_INCLUDE_TESTS=$(usex test)
-DLIBCXX_USE_COMPILER_RT=${use_compiler_rt}
diff --git a/llvm-runtimes/libcxx/libcxx-19.1.4.ebuild
b/llvm-runtimes/libcxx/libcxx-19.1.4.ebuild
index f81850598bc2..12bee325ccd4 100644
--- a/llvm-runtimes/libcxx/libcxx-19.1.4.ebuild
+++ b/llvm-runtimes/libcxx/libcxx-19.1.4.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -116,7 +116,7 @@ multilib_src_configure() {
-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=$(usex elibc_musl)
+ -DLIBCXX_HAS_MUSL_LIBC=$(llvm_cmake_use_musl)
-DLIBCXX_INCLUDE_BENCHMARKS=OFF
-DLIBCXX_INCLUDE_TESTS=$(usex test)
-DLIBCXX_INSTALL_MODULES=ON
diff --git a/llvm-runtimes/libcxx/libcxx-19.1.7.ebuild
b/llvm-runtimes/libcxx/libcxx-19.1.7.ebuild
index c65d86092c06..f0f49530548b 100644
--- a/llvm-runtimes/libcxx/libcxx-19.1.7.ebuild
+++ b/llvm-runtimes/libcxx/libcxx-19.1.7.ebuild
@@ -116,7 +116,7 @@ multilib_src_configure() {
-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=$(usex elibc_musl)
+ -DLIBCXX_HAS_MUSL_LIBC=$(llvm_cmake_use_musl)
-DLIBCXX_INCLUDE_BENCHMARKS=OFF
-DLIBCXX_INCLUDE_TESTS=$(usex test)
-DLIBCXX_INSTALL_MODULES=ON
diff --git a/llvm-runtimes/libcxx/libcxx-20.1.0.ebuild
b/llvm-runtimes/libcxx/libcxx-20.1.0.ebuild
index b2f22f4c17c4..75a626f221f8 100644
--- a/llvm-runtimes/libcxx/libcxx-20.1.0.ebuild
+++ b/llvm-runtimes/libcxx/libcxx-20.1.0.ebuild
@@ -118,7 +118,7 @@ multilib_src_configure() {
-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=$(usex elibc_musl)
+ -DLIBCXX_HAS_MUSL_LIBC=$(llvm_cmake_use_musl)
-DLIBCXX_INCLUDE_BENCHMARKS=OFF
-DLIBCXX_INCLUDE_TESTS=$(usex test)
-DLIBCXX_INSTALL_MODULES=ON
diff --git a/llvm-runtimes/libcxx/libcxx-21.0.0.9999.ebuild
b/llvm-runtimes/libcxx/libcxx-21.0.0.9999.ebuild
index 3bd46e20f1ca..f6f57e2287bd 100644
--- a/llvm-runtimes/libcxx/libcxx-21.0.0.9999.ebuild
+++ b/llvm-runtimes/libcxx/libcxx-21.0.0.9999.ebuild
@@ -117,7 +117,7 @@ multilib_src_configure() {
-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=$(usex elibc_musl)
+ -DLIBCXX_HAS_MUSL_LIBC=$(llvm_cmake_use_musl)
-DLIBCXX_INCLUDE_BENCHMARKS=OFF
-DLIBCXX_INCLUDE_TESTS=$(usex test)
-DLIBCXX_INSTALL_MODULES=ON
diff --git a/llvm-runtimes/libcxx/libcxx-21.0.0_pre20250311.ebuild
b/llvm-runtimes/libcxx/libcxx-21.0.0_pre20250311.ebuild
index 3bd46e20f1ca..f6f57e2287bd 100644
--- a/llvm-runtimes/libcxx/libcxx-21.0.0_pre20250311.ebuild
+++ b/llvm-runtimes/libcxx/libcxx-21.0.0_pre20250311.ebuild
@@ -117,7 +117,7 @@ multilib_src_configure() {
-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=$(usex elibc_musl)
+ -DLIBCXX_HAS_MUSL_LIBC=$(llvm_cmake_use_musl)
-DLIBCXX_INCLUDE_BENCHMARKS=OFF
-DLIBCXX_INCLUDE_TESTS=$(usex test)
-DLIBCXX_INSTALL_MODULES=ON
diff --git a/llvm-runtimes/libcxxabi/libcxxabi-18.1.8.ebuild
b/llvm-runtimes/libcxxabi/libcxxabi-18.1.8.ebuild
index d4345975b51b..9da765a204d1 100644
--- a/llvm-runtimes/libcxxabi/libcxxabi-18.1.8.ebuild
+++ b/llvm-runtimes/libcxxabi/libcxxabi-18.1.8.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -82,7 +82,7 @@ multilib_src_configure() {
-DLIBCXX_ENABLE_STATIC=OFF
-DLIBCXX_CXX_ABI=libcxxabi
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
- -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
+ -DLIBCXX_HAS_MUSL_LIBC=$(llvm_cmake_use_musl)
-DLIBCXX_HAS_GCC_S_LIB=OFF
-DLIBCXX_INCLUDE_BENCHMARKS=OFF
-DLIBCXX_INCLUDE_TESTS=OFF
diff --git a/llvm-runtimes/libcxxabi/libcxxabi-19.1.4.ebuild
b/llvm-runtimes/libcxxabi/libcxxabi-19.1.4.ebuild
index b35585073db4..c50a8eed96b0 100644
--- a/llvm-runtimes/libcxxabi/libcxxabi-19.1.4.ebuild
+++ b/llvm-runtimes/libcxxabi/libcxxabi-19.1.4.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -82,7 +82,7 @@ multilib_src_configure() {
-DLIBCXX_ENABLE_STATIC=OFF
-DLIBCXX_CXX_ABI=libcxxabi
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
- -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
+ -DLIBCXX_HAS_MUSL_LIBC=$(llvm_cmake_use_musl)
-DLIBCXX_HAS_GCC_S_LIB=OFF
-DLIBCXX_INCLUDE_BENCHMARKS=OFF
-DLIBCXX_INCLUDE_TESTS=OFF
diff --git a/llvm-runtimes/libcxxabi/libcxxabi-19.1.7.ebuild
b/llvm-runtimes/libcxxabi/libcxxabi-19.1.7.ebuild
index 8dec5497b6b2..ae0fc4272855 100644
--- a/llvm-runtimes/libcxxabi/libcxxabi-19.1.7.ebuild
+++ b/llvm-runtimes/libcxxabi/libcxxabi-19.1.7.ebuild
@@ -82,7 +82,7 @@ multilib_src_configure() {
-DLIBCXX_ENABLE_STATIC=OFF
-DLIBCXX_CXX_ABI=libcxxabi
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
- -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
+ -DLIBCXX_HAS_MUSL_LIBC=$(llvm_cmake_use_musl)
-DLIBCXX_HAS_GCC_S_LIB=OFF
-DLIBCXX_INCLUDE_BENCHMARKS=OFF
-DLIBCXX_INCLUDE_TESTS=OFF
diff --git a/llvm-runtimes/libcxxabi/libcxxabi-20.1.0.ebuild
b/llvm-runtimes/libcxxabi/libcxxabi-20.1.0.ebuild
index 839fcbe90fb7..5ebe26d49210 100644
--- a/llvm-runtimes/libcxxabi/libcxxabi-20.1.0.ebuild
+++ b/llvm-runtimes/libcxxabi/libcxxabi-20.1.0.ebuild
@@ -81,7 +81,7 @@ multilib_src_configure() {
-DLIBCXX_ENABLE_STATIC=OFF
-DLIBCXX_CXX_ABI=libcxxabi
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
- -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
+ -DLIBCXX_HAS_MUSL_LIBC=$(llvm_cmake_use_musl)
-DLIBCXX_HAS_GCC_S_LIB=OFF
-DLIBCXX_INCLUDE_BENCHMARKS=OFF
-DLIBCXX_INCLUDE_TESTS=OFF
diff --git a/llvm-runtimes/libcxxabi/libcxxabi-21.0.0.9999.ebuild
b/llvm-runtimes/libcxxabi/libcxxabi-21.0.0.9999.ebuild
index 412d927e8b49..7aab2f168c62 100644
--- a/llvm-runtimes/libcxxabi/libcxxabi-21.0.0.9999.ebuild
+++ b/llvm-runtimes/libcxxabi/libcxxabi-21.0.0.9999.ebuild
@@ -80,7 +80,7 @@ multilib_src_configure() {
-DLIBCXX_ENABLE_STATIC=OFF
-DLIBCXX_CXX_ABI=libcxxabi
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
- -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
+ -DLIBCXX_HAS_MUSL_LIBC=$(llvm_cmake_use_musl)
-DLIBCXX_HAS_GCC_S_LIB=OFF
-DLIBCXX_INCLUDE_BENCHMARKS=OFF
-DLIBCXX_INCLUDE_TESTS=OFF
diff --git a/llvm-runtimes/libcxxabi/libcxxabi-21.0.0_pre20250311.ebuild
b/llvm-runtimes/libcxxabi/libcxxabi-21.0.0_pre20250311.ebuild
index 412d927e8b49..7aab2f168c62 100644
--- a/llvm-runtimes/libcxxabi/libcxxabi-21.0.0_pre20250311.ebuild
+++ b/llvm-runtimes/libcxxabi/libcxxabi-21.0.0_pre20250311.ebuild
@@ -80,7 +80,7 @@ multilib_src_configure() {
-DLIBCXX_ENABLE_STATIC=OFF
-DLIBCXX_CXX_ABI=libcxxabi
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
- -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
+ -DLIBCXX_HAS_MUSL_LIBC=$(llvm_cmake_use_musl)
-DLIBCXX_HAS_GCC_S_LIB=OFF
-DLIBCXX_INCLUDE_BENCHMARKS=OFF
-DLIBCXX_INCLUDE_TESTS=OFF
diff --git a/llvm-runtimes/libunwind/libunwind-18.1.8.ebuild
b/llvm-runtimes/libunwind/libunwind-18.1.8.ebuild
index 41cb5a76af5f..a87b4c9d0d1d 100644
--- a/llvm-runtimes/libunwind/libunwind-18.1.8.ebuild
+++ b/llvm-runtimes/libunwind/libunwind-18.1.8.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -109,7 +109,7 @@ multilib_src_configure() {
-DLIBCXX_ENABLE_STATIC=ON
-DLIBCXX_CXX_ABI=libcxxabi
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
- -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
+ -DLIBCXX_HAS_MUSL_LIBC=$(llvm_cmake_use_musl)
-DLIBCXX_HAS_GCC_S_LIB=OFF
-DLIBCXX_INCLUDE_TESTS=OFF
-DLIBCXX_INCLUDE_BENCHMARKS=OFF
diff --git a/llvm-runtimes/libunwind/libunwind-19.1.4.ebuild
b/llvm-runtimes/libunwind/libunwind-19.1.4.ebuild
index ddfa6972727f..80038def5bc0 100644
--- a/llvm-runtimes/libunwind/libunwind-19.1.4.ebuild
+++ b/llvm-runtimes/libunwind/libunwind-19.1.4.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -109,7 +109,7 @@ multilib_src_configure() {
-DLIBCXX_ENABLE_STATIC=ON
-DLIBCXX_CXX_ABI=libcxxabi
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
- -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
+ -DLIBCXX_HAS_MUSL_LIBC=$(llvm_cmake_use_musl)
-DLIBCXX_HAS_GCC_S_LIB=OFF
-DLIBCXX_INCLUDE_TESTS=OFF
-DLIBCXX_INCLUDE_BENCHMARKS=OFF
diff --git a/llvm-runtimes/libunwind/libunwind-19.1.7.ebuild
b/llvm-runtimes/libunwind/libunwind-19.1.7.ebuild
index 9367f3cff66e..afc72a0f386e 100644
--- a/llvm-runtimes/libunwind/libunwind-19.1.7.ebuild
+++ b/llvm-runtimes/libunwind/libunwind-19.1.7.ebuild
@@ -109,7 +109,7 @@ multilib_src_configure() {
-DLIBCXX_ENABLE_STATIC=ON
-DLIBCXX_CXX_ABI=libcxxabi
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
- -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
+ -DLIBCXX_HAS_MUSL_LIBC=$(llvm_cmake_use_musl)
-DLIBCXX_HAS_GCC_S_LIB=OFF
-DLIBCXX_INCLUDE_TESTS=OFF
-DLIBCXX_INCLUDE_BENCHMARKS=OFF
diff --git a/llvm-runtimes/libunwind/libunwind-20.1.0.ebuild
b/llvm-runtimes/libunwind/libunwind-20.1.0.ebuild
index 96b0ba6c554d..1fce26a90bfc 100644
--- a/llvm-runtimes/libunwind/libunwind-20.1.0.ebuild
+++ b/llvm-runtimes/libunwind/libunwind-20.1.0.ebuild
@@ -109,7 +109,7 @@ multilib_src_configure() {
-DLIBCXX_ENABLE_STATIC=ON
-DLIBCXX_CXX_ABI=libcxxabi
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
- -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
+ -DLIBCXX_HAS_MUSL_LIBC=$(llvm_cmake_use_musl)
-DLIBCXX_HAS_GCC_S_LIB=OFF
-DLIBCXX_INCLUDE_TESTS=OFF
-DLIBCXX_INCLUDE_BENCHMARKS=OFF
diff --git a/llvm-runtimes/libunwind/libunwind-21.0.0.9999.ebuild
b/llvm-runtimes/libunwind/libunwind-21.0.0.9999.ebuild
index 4a6714b162db..026430534993 100644
--- a/llvm-runtimes/libunwind/libunwind-21.0.0.9999.ebuild
+++ b/llvm-runtimes/libunwind/libunwind-21.0.0.9999.ebuild
@@ -108,7 +108,7 @@ multilib_src_configure() {
-DLIBCXX_ENABLE_STATIC=ON
-DLIBCXX_CXX_ABI=libcxxabi
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
- -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
+ -DLIBCXX_HAS_MUSL_LIBC=$(llvm_cmake_use_musl)
-DLIBCXX_HAS_GCC_S_LIB=OFF
-DLIBCXX_INCLUDE_TESTS=OFF
-DLIBCXX_INCLUDE_BENCHMARKS=OFF
diff --git a/llvm-runtimes/libunwind/libunwind-21.0.0_pre20250311.ebuild
b/llvm-runtimes/libunwind/libunwind-21.0.0_pre20250311.ebuild
index 4a6714b162db..026430534993 100644
--- a/llvm-runtimes/libunwind/libunwind-21.0.0_pre20250311.ebuild
+++ b/llvm-runtimes/libunwind/libunwind-21.0.0_pre20250311.ebuild
@@ -108,7 +108,7 @@ multilib_src_configure() {
-DLIBCXX_ENABLE_STATIC=ON
-DLIBCXX_CXX_ABI=libcxxabi
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF
- -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl)
+ -DLIBCXX_HAS_MUSL_LIBC=$(llvm_cmake_use_musl)
-DLIBCXX_HAS_GCC_S_LIB=OFF
-DLIBCXX_INCLUDE_TESTS=OFF
-DLIBCXX_INCLUDE_BENCHMARKS=OFF