summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndřej Čertík <ondrej@certik.us>2023-06-22 09:51:29 -0600
committerGitHub <noreply@github.com>2023-06-22 09:51:29 -0600
commita889669cbcf964ba257949fe9d165de0994e0590 (patch)
treea1969f18f19a14b933d1877a039f810b7db6f0a8
parentfde33e66be9c0b0c3f7b20c823447538455998f4 (diff)
downloadspack-a889669cbcf964ba257949fe9d165de0994e0590.tar.gz
spack-a889669cbcf964ba257949fe9d165de0994e0590.tar.bz2
spack-a889669cbcf964ba257949fe9d165de0994e0590.tar.xz
spack-a889669cbcf964ba257949fe9d165de0994e0590.zip
Add LFortran (#30901)
It installs the LFortran runtime library and LFortran can compile codes to binaries. The interactive mode does not work yet with LLVM > 11, that has to be fixed upstream. Co-authored-by: Wileam Y. Phan <50928756+wyphan@users.noreply.github.com>
-rw-r--r--var/spack/repos/builtin/packages/lfortran/package.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/lfortran/package.py b/var/spack/repos/builtin/packages/lfortran/package.py
new file mode 100644
index 0000000000..6b9b42216d
--- /dev/null
+++ b/var/spack/repos/builtin/packages/lfortran/package.py
@@ -0,0 +1,41 @@
+# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
+from spack.package import *
+
+
+class Lfortran(CMakePackage):
+ """Modern interactive LLVM-based Fortran compiler"""
+
+ homepage = "https://lfortran.org"
+ url = "https://lfortran.github.io/tarballs/release/lfortran-0.19.0.tar.gz"
+ git = "https://github.com/lfortran/lfortran.git"
+ maintainers = ["certik"]
+
+ # The build process uses 'git describe --tags' to get the package version
+ version("main", branch="main", get_full_repo=True)
+ version("0.19.0", sha256="d496f61d7133b624deb3562677c0cbf98e747262babd4ac010dbd3ab4303d805")
+
+ variant("llvm", default=True, description="Build with LLVM support")
+ variant("stacktrace", default=True, description="Build with stacktrace support")
+
+ depends_on("python@3:", type="build", when="@main")
+ depends_on("cmake", type="build")
+ depends_on("llvm@11:15", type=("build", "run"), when="+llvm")
+ depends_on("zlib", type="build")
+ depends_on("re2c", type="build", when="@main")
+ depends_on("bison@:3.4", type="build", when="@main")
+ depends_on("binutils@2.38:", type="build", when="platform=linux")
+
+ def cmake_args(self):
+ args = [
+ self.define_from_variant("WITH_LLVM", "llvm"),
+ self.define_from_variant("WITH_STACKTRACE", "stacktrace"),
+ ]
+
+ if self.spec.satisfies("@main"):
+ args.append("-DLFORTRAN_BUILD_ALL=yes")
+
+ return args