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.0.8.tar.gz"
|
||
sha256 "fe93983c46ee83bc09e99b1cbd147f2ba4ad6fdda45ef3a57d386d9a84c8cc67"
|
||
license "Apache-2.0"
|
||
head "https://github.com/leanprover/elan.git"
|
||
|
||
bottle do
|
||
sha256 cellar: :any_skip_relocation, big_sur: "604903f0051ca238f3662d6376fd3855b105e24f62c654162deffe4a8a5fe1c7"
|
||
sha256 cellar: :any_skip_relocation, catalina: "bd3940e048f0ad924e5c103201f61b38685ba56b180fb987599b05e76e43b8b7"
|
||
sha256 cellar: :any_skip_relocation, mojave: "66da7b0f67a5a8a134e7fa9062003ebfe3f4369f8f1750e476c75041e55769a6"
|
||
sha256 cellar: :any_skip_relocation, x86_64_linux: "04f452ebcaea14335dfcaa28701bd71cf9d95b189fb842df5e8f6897413dc732"
|
||
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 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
|