commit: be21871e69498d8fed7011858b0f9cd8cdfa6a64
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 7 15:35:12 2025 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Jun 7 16:32:26 2025 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=be21871e
llvm-core/flang: Build with clang by default
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
llvm-core/flang/flang-21.0.0.9999.ebuild | 24 ++++++++++++++++++++++--
llvm-core/flang/metadata.xml | 7 +++++++
2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/llvm-core/flang/flang-21.0.0.9999.ebuild
b/llvm-core/flang/flang-21.0.0.9999.ebuild
index 2561b1b7570e..706f01805d96 100644
--- a/llvm-core/flang/flang-21.0.0.9999.ebuild
+++ b/llvm-core/flang/flang-21.0.0.9999.ebuild
@@ -4,14 +4,14 @@
EAPI=8
PYTHON_COMPAT=( python3_{11..14} )
-inherit cmake llvm.org python-any-r1
+inherit cmake flag-o-matic llvm.org python-any-r1 toolchain-funcs
DESCRIPTION="LLVM's Fortran frontend"
HOMEPAGE="https://flang.llvm.org/"
LICENSE="Apache-2.0-with-LLVM-exceptions"
SLOT="${LLVM_MAJOR}/${LLVM_SOABI}"
-IUSE="+debug test"
+IUSE="+clang +debug test"
RESTRICT="!test? ( test )"
DEPEND="
@@ -26,6 +26,7 @@ PDEPEND="
>=llvm-runtimes/flang-rt-${PV}:${LLVM_MAJOR}
"
BDEPEND="
+ clang? ( llvm-core/clang )
test? (
$(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]')
)
@@ -39,11 +40,30 @@ python_check_deps() {
python_has_version "dev-python/lit[${PYTHON_USEDEP}]"
}
+pkg_pretend() {
+ if ! use clang && tc-is-gcc; then
+ ewarn "Building using GCC requires lots of memory (up to 10 GiB
per process)."
+ ewarn "Consider enabling USE=clang."
+ ewarn "See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119705"
+ fi
+}
+
pkg_setup() {
use test && python-any-r1_pkg_setup
}
src_configure() {
+ if use clang; then
+ # Only do this conditionally to allow overriding with
+ # e.g. CC=clang-13 in case of breakage
+ if ! tc-is-clang ; then
+ local -x CC=${CHOST}-clang
+ local -x CXX=${CHOST}-clang++
+ fi
+
+ strip-unsupported-flags
+ fi
+
local mycmakeargs=(
-DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}"
diff --git a/llvm-core/flang/metadata.xml b/llvm-core/flang/metadata.xml
index 072910296ca3..67d13bc9f0ec 100644
--- a/llvm-core/flang/metadata.xml
+++ b/llvm-core/flang/metadata.xml
@@ -7,4 +7,11 @@
<upstream>
<remote-id type="github">llvm/llvm-project</remote-id>
</upstream>
+ <use>
+ <flag name="clang">
+ Force building using installed clang (rather than
+ the default CC/CXX). This is the default since building
+ with GCC requires lots of memory.
+ </flag>
+ </use>
</pkgmetadata>