homebrew-core/Formula/fstar.rb
2016-11-05 10:49:46 -07:00

82 lines
2.8 KiB
Ruby

class Fstar < Formula
desc "Language with a type system for program verification"
homepage "https://www.fstar-lang.org/"
url "https://github.com/FStarLang/FStar.git",
:tag => "v0.9.2.0",
:revision => "2a8ce0b3dfbfb9703079aace0d73f2479f0d0ce2"
revision 2
head "https://github.com/FStarLang/FStar.git"
bottle do
cellar :any_skip_relocation
sha256 "0b3123d11fc2d3560dfba1b5731ebebb38716d0b7fa8d2b35d65a45f71e7a1fb" => :sierra
sha256 "38c60283a46bf7264043f3bf84aedc0b844f8546b632cbec62e6332cb3e37f33" => :el_capitan
sha256 "b58b25e62e5080d7b5bf2e3377113e5be922545fecefc2bb6de549293abc2e3d" => :yosemite
end
depends_on "opam" => :build
depends_on "gmp" => :build
depends_on "ocaml" => :recommended
depends_on "z3" => :recommended
def install
ENV.deparallelize # Not related to F* : OCaml parallelization
ENV["OPAMROOT"] = buildpath/"opamroot"
ENV["OPAMYES"] = "1"
# avoid having to depend on coreutils
inreplace "src/ocaml-output/Makefile", "$(DATE_EXEC) -Iseconds",
"$(DATE_EXEC) '+%Y-%m-%dT%H:%M:%S%z'"
system "opam", "init", "--no-setup"
if build.stable?
system "opam", "install", "batteries=2.5.2", "zarith=1.3", "yojson=1.1.6"
else
system "opam", "install", "batteries", "zarith", "yojson"
end
system "opam", "config", "exec", "--", "make", "-C", "src", "boot-ocaml"
bin.install "src/ocaml-output/fstar.exe"
(libexec/"stdlib").install Dir["lib/*"]
(libexec/"contrib").install Dir["contrib/*"]
(libexec/"examples").install Dir["examples/*"]
(libexec/"tutorial").install Dir["doc/tutorial/*"]
(libexec/"src").install Dir["src/*"]
(libexec/"licenses").install "LICENSE-fsharp.txt", Dir["3rdparty/licenses/*"]
prefix.install_symlink libexec/"stdlib"
prefix.install_symlink libexec/"contrib"
prefix.install_symlink libexec/"examples"
prefix.install_symlink libexec/"tutorial"
prefix.install_symlink libexec/"src"
prefix.install_symlink libexec/"licenses"
end
def caveats; <<-EOS.undent
F* code can be extracted to OCaml code.
To compile the generated OCaml code, you must install the
package 'batteries' from the Opam package manager:
- brew install opam
- opam install batteries
F* code can be extracted to F# code.
To compile the generated F# (.NET) code, you must install
the 'mono' package that includes the fsharp compiler:
- brew install mono
EOS
end
test do
system "#{bin}/fstar.exe",
"--include", "#{prefix}/examples/unit-tests",
"--admit_fsi", "FStar.Set",
"FStar.Set.fsi", "FStar.Heap.fst",
"FStar.ST.fst", "FStar.All.fst",
"FStar.List.fst", "FStar.String.fst",
"FStar.Int32.fst", "unit1.fst",
"unit2.fst", "testset.fst"
end
end