homebrew-core/Formula/coq.rb
2017-07-06 05:43:17 -07:00

65 lines
2 KiB
Ruby

class Camlp5TransitionalModeRequirement < Requirement
fatal true
satisfy(:build_env => false) { !Tab.for_name("camlp5").with?("strict") }
def message; <<-EOS.undent
camlp5 must be compiled in transitional mode (instead of --strict mode):
brew install camlp5
EOS
end
end
class Coq < Formula
desc "Proof assistant for higher-order logic"
homepage "https://coq.inria.fr/"
url "https://coq.inria.fr/distrib/8.6.1/files/coq-8.6.1.tar.gz"
sha256 "32f8aa92853483dec18030def9f0857a708fee56cf4287e39c9a260f08138f9d"
head "git://scm.gforge.inria.fr/coq/coq.git", :branch => "trunk"
bottle do
sha256 "279ccf9f81ba2771c72a056a5478f561c3dd2cdd58db2b45734cbdb0650d1ef0" => :sierra
sha256 "02032903dfa6afd60560a04d7ee83e55441e164c70dbff4b92930a66ed287279" => :el_capitan
sha256 "eb6840b20829497aed7b3e484ccc1280b795442388ecb0b92ac93ec56a297898" => :yosemite
end
depends_on "opam" => :build
depends_on Camlp5TransitionalModeRequirement
depends_on "camlp5"
depends_on "ocaml"
def install
ENV["OPAMYES"] = "1"
ENV["OPAMROOT"] = Pathname.pwd/"opamroot"
(Pathname.pwd/"opamroot").mkpath
system "opam", "init", "--no-setup"
system "opam", "install", "ocamlfind"
system "opam", "config", "exec", "--",
"./configure", "-prefix", prefix,
"-mandir", man,
"-emacslib", elisp,
"-coqdocdir", "#{pkgshare}/latex",
"-coqide", "no",
"-with-doc", "no"
system "make", "world"
ENV.deparallelize { system "make", "install" }
end
test do
(testpath/"testing.v").write <<-EOS.undent
Inductive nat : Set :=
| O : nat
| S : nat -> nat.
Fixpoint add (n m: nat) : nat :=
match n with
| O => m
| S n' => S (add n' m)
end.
Lemma add_O_r : forall (n: nat), add n O = n.
intros n; induction n; simpl; auto; rewrite IHn; auto.
Qed.
EOS
system("#{bin}/coqc", "#{testpath}/testing.v")
end
end