69 lines
2.3 KiB
Ruby
69 lines
2.3 KiB
Ruby
class CrystalLang < Formula
|
|
desc "Fast and statically typed, compiled language with Ruby-like syntax"
|
|
homepage "http://crystal-lang.org/"
|
|
url "https://github.com/crystal-lang/crystal/archive/0.18.6.tar.gz"
|
|
sha256 "3954f6d1ff414ff55f694690c62fce5e2d12a78c0243cd76ed8457498fcef993"
|
|
head "https://github.com/crystal-lang/crystal.git"
|
|
|
|
bottle do
|
|
sha256 "9069bb00146b80006d2ae94a8d904da7c0a19d3b6ba8f44d0d318b29b5f68e64" => :el_capitan
|
|
sha256 "c9701a1ea39052edcd7ff845972445d73573abf9635d40d5b592e9fd216795c7" => :yosemite
|
|
sha256 "f0798f090110a5631c7961d0f161559a30bf65ae57becadb18f8af95337b4b23" => :mavericks
|
|
end
|
|
|
|
option "without-release", "Do not build the compiler in release mode"
|
|
option "without-shards", "Do not include `shards` dependency manager"
|
|
|
|
depends_on "libevent"
|
|
depends_on "bdw-gc"
|
|
depends_on "llvm" => :build
|
|
depends_on "libyaml" if build.with?("shards")
|
|
|
|
resource "boot" do
|
|
url "https://github.com/crystal-lang/crystal/releases/download/0.18.4/crystal-0.18.4-1-darwin-x86_64.tar.gz"
|
|
version "0.18.4"
|
|
sha256 "828bbd28f77bc9bd3bd8122c5953811e3bd77da53878692c06f58b4dfa9256f2"
|
|
end
|
|
|
|
resource "shards" do
|
|
url "https://github.com/ysbaddaden/shards/archive/v0.6.3.tar.gz"
|
|
sha256 "5245aebb21af0a5682123732e4f4d476e7aa6910252fb3ffe4be60ee8df03ac2"
|
|
end
|
|
|
|
def install
|
|
(buildpath/"boot").install resource("boot")
|
|
|
|
if build.head?
|
|
ENV["CRYSTAL_CONFIG_VERSION"] = `git rev-parse --short HEAD`.strip
|
|
else
|
|
ENV["CRYSTAL_CONFIG_VERSION"] = version
|
|
end
|
|
|
|
ENV["CRYSTAL_CONFIG_PATH"] = prefix/"src:libs"
|
|
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
|
|
system "#{bin}/crystal", "eval", "puts 1"
|
|
end
|
|
end
|