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.6.tar.gz"
|
||
sha256 "f8865e3ab035a285173ced40024769f6b7149dc7b556c5cf3bd0d0cdc6528197"
|
||
license "Apache-2.0"
|
||
head "https://github.com/leanprover/elan.git"
|
||
|
||
bottle do
|
||
sha256 cellar: :any_skip_relocation, big_sur: "d6bb68e6a6c0c5f5d6dfb0495e7454373d0fec561e4606ddb6865edd255eb3c5"
|
||
sha256 cellar: :any_skip_relocation, catalina: "e1f9cc59ffd3e2c3e7c37c1b78dade5179e823bc1f0470b34d52b59d7b677511"
|
||
sha256 cellar: :any_skip_relocation, mojave: "d3d8c87d4f4a10373603106d9ec5ec8a8675f19eae1ebc063c354a75f08cb8ad"
|
||
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
|