61 lines
2.2 KiB
Ruby
61 lines
2.2 KiB
Ruby
class ElanInit < Formula
|
||
desc "Lean Theorem Prover installer and version manager"
|
||
homepage "https://github.com/leanprover/elan"
|
||
url "https://github.com/leanprover/elan/archive/v1.4.1.tar.gz"
|
||
sha256 "eac4925100624e1d77d70a35408805fb88672e87b60a44fd93c31e8cfa4bfa91"
|
||
license any_of: ["Apache-2.0", "MIT"]
|
||
head "https://github.com/leanprover/elan.git", branch: "master"
|
||
|
||
bottle do
|
||
sha256 cellar: :any_skip_relocation, monterey: "f07f593c8c3668c57cc595792c9ad1178a0949269342902c7d61d3ad85fe3046"
|
||
sha256 cellar: :any_skip_relocation, big_sur: "7fd0d6b273632b3aeea56e8eab6514ce2d1517d02a5ed5d1b3063b5c26f5282e"
|
||
sha256 cellar: :any_skip_relocation, catalina: "ec0943072965c84e5d190c6f725d562e28c998241e0226339dd0042115bc3240"
|
||
sha256 cellar: :any_skip_relocation, x86_64_linux: "97bd3b31c81ad7501e3c791399ba678b9014eada9f939ac42ccfcda7135f71d4"
|
||
end
|
||
|
||
depends_on "rust" => :build
|
||
# elan-init will run on arm64 Macs, but will fetch Leans that are x86_64.
|
||
depends_on arch: :x86_64
|
||
depends_on "coreutils"
|
||
depends_on "gmp"
|
||
|
||
uses_from_macos "zlib"
|
||
|
||
conflicts_with "lean", because: "`lean` and `elan-init` install the same binaries"
|
||
|
||
def install
|
||
ENV["RELEASE_TARGET_NAME"] = "homebrew-build"
|
||
|
||
system "cargo", "install", "--features", "no-self-update", *std_cargo_args
|
||
|
||
%w[lean leanpkg leanchecker leanc leanmake lake elan].each do |link|
|
||
bin.install_symlink "elan-init" => link
|
||
end
|
||
|
||
bash_output = Utils.safe_popen_read(bin/"elan", "completions", "bash")
|
||
(bash_completion/"elan").write bash_output
|
||
zsh_output = Utils.safe_popen_read(bin/"elan", "completions", "zsh")
|
||
(zsh_completion/"_elan").write zsh_output
|
||
fish_output = Utils.safe_popen_read(bin/"elan", "completions", "fish")
|
||
(fish_completion/"elan.fish").write fish_output
|
||
end
|
||
|
||
test do
|
||
system bin/"elan-init", "-y"
|
||
(testpath/"hello.lean").write <<~EOS
|
||
def id' {α : Type} (x : α) : α := x
|
||
|
||
inductive tree (α : Type) : Type
|
||
| node : α → list tree → tree
|
||
|
||
example (a b : Prop) : a ∧ b -> b ∧ a :=
|
||
begin
|
||
intro h, cases h,
|
||
split, repeat { assumption }
|
||
end
|
||
EOS
|
||
system bin/"lean", testpath/"hello.lean"
|
||
system bin/"leanpkg", "help"
|
||
end
|
||
end
|