58 lines
2.0 KiB
Ruby
58 lines
2.0 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.0.3.tar.gz"
|
||
sha256 "fb3ddd8915a0694ead0f3a51fdf8b0a5540f983f44eee0e757339244c522b8ee"
|
||
license "Apache-2.0"
|
||
head "https://github.com/leanprover/elan.git"
|
||
|
||
bottle do
|
||
sha256 cellar: :any_skip_relocation, big_sur: "5186f119f7d51aaba350572cf201667337bba9acaaace66ceb93dcbea64127bc"
|
||
sha256 cellar: :any_skip_relocation, catalina: "000a57fb44eb1837edea14451ca57cb42563ae976226c36cb0cb4202c7f7aa68"
|
||
sha256 cellar: :any_skip_relocation, mojave: "2801b216d9b44a1d0df88dd576f01bc27bdc69812c255a824107f8b990b28bd3"
|
||
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"
|
||
|
||
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 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
|