commit:     bfd4bcd64e80a2da8cef9fc674e3b9b0109eb58f
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 24 12:54:57 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Feb 24 14:13:55 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bfd4bcd6

llvm-runtimes/flang-rt: Add a split package for Flang runtime

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

 llvm-runtimes/flang-rt/Manifest                    |  1 +
 llvm-runtimes/flang-rt/flang-rt-21.0.0.9999.ebuild | 72 ++++++++++++++++++++++
 .../flang-rt/flang-rt-21.0.0_pre20250221.ebuild    | 72 ++++++++++++++++++++++
 llvm-runtimes/flang-rt/metadata.xml                | 10 +++
 4 files changed, 155 insertions(+)

diff --git a/llvm-runtimes/flang-rt/Manifest b/llvm-runtimes/flang-rt/Manifest
new file mode 100644
index 000000000000..077ac2c8fe68
--- /dev/null
+++ b/llvm-runtimes/flang-rt/Manifest
@@ -0,0 +1 @@
+DIST llvm-project-581599096e8a1a89ccd3e053a1209c69a9079083.tar.gz 227830555 
BLAKE2B 
28a04dd5ce96716d389fe049c4b877f55d6e5cad5c77d8867dd7e3a448213ef413e4f4d7d5f77b0702b26a8eb25f53e08d90e2a5a97eaa3f89245531d9f6626d
 SHA512 
d775aea9bf71d60673e966a689ff6b933afecab2c133a1f64a158551ba9db049221148eab5087bab0ce0ff917456b85fb4ea4d7284886326f54617d167a385a5

diff --git a/llvm-runtimes/flang-rt/flang-rt-21.0.0.9999.ebuild 
b/llvm-runtimes/flang-rt/flang-rt-21.0.0.9999.ebuild
new file mode 100644
index 000000000000..30245857a84e
--- /dev/null
+++ b/llvm-runtimes/flang-rt/flang-rt-21.0.0.9999.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake flag-o-matic llvm.org
+
+DESCRIPTION="LLVM's Fortran runtime"
+HOMEPAGE="https://flang.llvm.org/";
+
+LICENSE="Apache-2.0-with-LLVM-exceptions"
+SLOT="${LLVM_MAJOR}"
+IUSE="+debug test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+       !<llvm-core/flang-21.0.0_pre20250221-r1
+"
+BDEPEND="
+       llvm-core/llvm:${LLVM_MAJOR}
+       llvm-core/flang
+       test? (
+               dev-python/lit
+       )
+"
+
+LLVM_COMPONENTS=(
+       runtimes flang-rt cmake flang llvm/{cmake,utils/llvm-lit}
+)
+llvm.org_set_globals
+
+src_configure() {
+       # the code is not portable
+       local -x FC=flang F77=flang
+       strip-unsupported-flags
+
+       local mycmakeargs=(
+               # we may not have a runtime yet
+               -DCMAKE_Fortran_COMPILER_WORKS=TRUE
+
+               -DLLVM_ENABLE_RUNTIMES="flang-rt"
+               # this package forces NO_DEFAULT_PATHS
+               -DLLVM_BINARY_DIR="${ESYSROOT}/usr/lib/llvm/${LLVM_MAJOR}"
+
+               -DFLANG_RT_INCLUDE_TESTS=$(usex test)
+       )
+       use test && mycmakeargs+=(
+               -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
+               -DLLVM_LIT_ARGS="$(get_lit_flags)"
+       )
+
+       # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844
+       use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
+       cmake_src_configure
+}
+
+src_test() {
+       # respect TMPDIR!
+       local -x LIT_PRESERVES_TMP=1
+       cmake_build check-flang-rt
+}
+
+src_install() {
+       cmake_src_install
+
+       # in standalone build, the library is installed to (incorrect) resource 
dir
+       # but the driver only looks for it in lib (sigh)
+       # https://github.com/llvm/llvm-project/issues/127538
+       mkdir -p "${ED}/usr/lib/llvm/${LLVM_MAJOR}" || die
+       mv "${ED}/usr/$(get_libdir)/clang/${LLVM_MAJOR}/lib"/* \
+               "${ED}/usr/lib/llvm/${LLVM_MAJOR}/lib" || die
+}

diff --git a/llvm-runtimes/flang-rt/flang-rt-21.0.0_pre20250221.ebuild 
b/llvm-runtimes/flang-rt/flang-rt-21.0.0_pre20250221.ebuild
new file mode 100644
index 000000000000..30245857a84e
--- /dev/null
+++ b/llvm-runtimes/flang-rt/flang-rt-21.0.0_pre20250221.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake flag-o-matic llvm.org
+
+DESCRIPTION="LLVM's Fortran runtime"
+HOMEPAGE="https://flang.llvm.org/";
+
+LICENSE="Apache-2.0-with-LLVM-exceptions"
+SLOT="${LLVM_MAJOR}"
+IUSE="+debug test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+       !<llvm-core/flang-21.0.0_pre20250221-r1
+"
+BDEPEND="
+       llvm-core/llvm:${LLVM_MAJOR}
+       llvm-core/flang
+       test? (
+               dev-python/lit
+       )
+"
+
+LLVM_COMPONENTS=(
+       runtimes flang-rt cmake flang llvm/{cmake,utils/llvm-lit}
+)
+llvm.org_set_globals
+
+src_configure() {
+       # the code is not portable
+       local -x FC=flang F77=flang
+       strip-unsupported-flags
+
+       local mycmakeargs=(
+               # we may not have a runtime yet
+               -DCMAKE_Fortran_COMPILER_WORKS=TRUE
+
+               -DLLVM_ENABLE_RUNTIMES="flang-rt"
+               # this package forces NO_DEFAULT_PATHS
+               -DLLVM_BINARY_DIR="${ESYSROOT}/usr/lib/llvm/${LLVM_MAJOR}"
+
+               -DFLANG_RT_INCLUDE_TESTS=$(usex test)
+       )
+       use test && mycmakeargs+=(
+               -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
+               -DLLVM_LIT_ARGS="$(get_lit_flags)"
+       )
+
+       # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844
+       use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
+       cmake_src_configure
+}
+
+src_test() {
+       # respect TMPDIR!
+       local -x LIT_PRESERVES_TMP=1
+       cmake_build check-flang-rt
+}
+
+src_install() {
+       cmake_src_install
+
+       # in standalone build, the library is installed to (incorrect) resource 
dir
+       # but the driver only looks for it in lib (sigh)
+       # https://github.com/llvm/llvm-project/issues/127538
+       mkdir -p "${ED}/usr/lib/llvm/${LLVM_MAJOR}" || die
+       mv "${ED}/usr/$(get_libdir)/clang/${LLVM_MAJOR}/lib"/* \
+               "${ED}/usr/lib/llvm/${LLVM_MAJOR}/lib" || die
+}

diff --git a/llvm-runtimes/flang-rt/metadata.xml 
b/llvm-runtimes/flang-rt/metadata.xml
new file mode 100644
index 000000000000..072910296ca3
--- /dev/null
+++ b/llvm-runtimes/flang-rt/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="project">
+               <email>[email protected]</email>
+       </maintainer>
+       <upstream>
+               <remote-id type="github">llvm/llvm-project</remote-id>
+       </upstream>
+</pkgmetadata>

Reply via email to