|
| 1 | +class Lfortran < Formula |
| 2 | + desc "Modern interactive LLVM-based Fortran compiler" |
| 3 | + homepage "https://lfortran.org" |
| 4 | + url "https://lfortran.github.io/tarballs/release/lfortran-0.14.0.tar.gz" |
| 5 | + sha256 "fc3c1d592c56ae2636065ec0228db747f154f65a0867f6311bc8091efd5c13a7" |
| 6 | + license "BSD-3-Clause" |
| 7 | + |
| 8 | + depends_on "cmake" => :build |
| 9 | + depends_on "ninja" => :build |
| 10 | + depends_on "llvm@11" |
| 11 | + depends_on "zlib" |
| 12 | + |
| 13 | + def install |
| 14 | + cmake_args = std_cmake_args |
| 15 | + cmake_args << "-DCMAKE_CXX_FLAGS_RELEASE=-O3 -funroll-loops -DNDEBUG" |
| 16 | + cmake_args << "-DWITH_LLVM=ON" |
| 17 | + system "cmake", *cmake_args, "-G", "Ninja", "-B", "build" |
| 18 | + system "cmake", "--build", "build" |
| 19 | + system "ctest", "--test-dir", "build", "--output-on-failure" |
| 20 | + system "cmake", "--install", "build" |
| 21 | + end |
| 22 | + |
| 23 | + test do |
| 24 | + system "#{bin}/lfortran", "--version" |
| 25 | + (testpath/"hello.f90").write <<~EOS |
| 26 | + program hello |
| 27 | + print *, "Hello, World!" |
| 28 | + end |
| 29 | + EOS |
| 30 | + system "#{bin}/lfortran", testpath/"hello.f90", "-o", testpath/"hello" |
| 31 | + assert_predicate testpath/"hello", :exist? |
| 32 | + system testpath/"hello" |
| 33 | + end |
| 34 | +end |
0 commit comments