class CrystalLang < Formula desc "Fast and statically typed, compiled language with Ruby-like syntax" homepage "https://crystal-lang.org/" url "https://github.com/crystal-lang/crystal/archive/0.22.0.tar.gz" sha256 "5b9f11d9710ca9bd971a5afb94d369fd8dfaee103d7edf1c9fbebb2f21898547" head "https://github.com/crystal-lang/crystal.git" bottle do sha256 "821267bb11dc45a9916d239bdf7d09c8b7cc977a9023b5ac6e846b41a25b87de" => :sierra sha256 "46503a959e232b517a995c6b3985469a9f664e447bb3d95af4dc475cbc835d0b" => :el_capitan sha256 "9d63e683dee59b63b1ee7be361fc9ee629fa73f354744dc912cfa51bf79e51bf" => :yosemite end option "without-release", "Do not build the compiler in release mode" option "without-shards", "Do not include `shards` dependency manager" depends_on "pkg-config" => :build depends_on "libatomic_ops" => :build # for building bdw-gc depends_on "libevent" depends_on "bdw-gc" depends_on "llvm" depends_on "pcre" depends_on "gmp" depends_on "libyaml" if build.with? "shards" resource "boot" do url "https://github.com/crystal-lang/crystal/releases/download/0.21.1/crystal-0.21.1-1-darwin-x86_64.tar.gz" version "0.21.1" sha256 "94c53fc5b7c55fbe2f31b23782d6440fc9cccc20c8969fb5970e3b3604691178" end resource "shards" do url "https://github.com/crystal-lang/shards/archive/v0.7.1.tar.gz" sha256 "31de819c66518479682ec781a39ef42c157a1a8e6e865544194534e2567cb110" end def install (buildpath/"boot").install resource("boot") if build.head? ENV["CRYSTAL_CONFIG_VERSION"] = Utils.popen_read("git rev-parse --short HEAD").strip else ENV["CRYSTAL_CONFIG_VERSION"] = version end ENV["CRYSTAL_CONFIG_PATH"] = prefix/"src:lib" ENV.append_path "PATH", "boot/bin" if build.with? "release" system "make", "crystal", "release=true" else system "make", "deps" (buildpath/".build").mkpath system "bin/crystal", "build", "-o", "-D", "without_openssl", "-D", "without_zlib", ".build/crystal", "src/compiler/crystal.cr" end if build.with? "shards" resource("shards").stage do system buildpath/"bin/crystal", "build", "-o", buildpath/".build/shards", "src/shards.cr" end bin.install ".build/shards" end bin.install ".build/crystal" prefix.install "src" bash_completion.install "etc/completion.bash" => "crystal" zsh_completion.install "etc/completion.zsh" => "_crystal" end test do assert_match "1", shell_output("#{bin}/crystal eval puts 1") end end