2015-10-08 14:06:34 +00:00
|
|
|
class CrystalLang < Formula
|
|
|
|
desc "Fast and statically typed, compiled language with Ruby-like syntax"
|
|
|
|
homepage "http://crystal-lang.org/"
|
2016-05-26 17:33:00 +00:00
|
|
|
url "https://github.com/crystal-lang/crystal/archive/0.17.4.tar.gz"
|
|
|
|
sha256 "a5f3984c5d76b4fe2364869215596d1a3b148902d14f6bed54cd79cd4efe7b63"
|
2015-10-08 14:06:34 +00:00
|
|
|
head "https://github.com/manastech/crystal.git"
|
|
|
|
|
2015-10-17 12:35:05 +00:00
|
|
|
bottle do
|
2016-05-26 17:46:58 +00:00
|
|
|
sha256 "3d18ae474bbeaa307e9df18c99a65d16eb8604d8519ebd2acba0ef7911d6d26e" => :el_capitan
|
|
|
|
sha256 "282f97c8bebb2216e98701757cb69f05592ae316f5a453dbd1617d72cd639cbc" => :yosemite
|
|
|
|
sha256 "569f5ef74d072169c51d59afe87c9db390f487ac391a214d8b073f5d2dadd7a5" => :mavericks
|
2015-10-17 12:35:05 +00:00
|
|
|
end
|
|
|
|
|
2016-01-29 12:18:08 +00:00
|
|
|
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")
|
|
|
|
|
2015-10-08 14:06:34 +00:00
|
|
|
resource "boot" do
|
2016-05-17 16:33:09 +00:00
|
|
|
url "https://github.com/crystal-lang/crystal/releases/download/0.16.0/crystal-0.16.0-1-darwin-x86_64.tar.gz"
|
|
|
|
version "0.16.0"
|
|
|
|
sha256 "a41e55b7beecd22a681f53ce5fa4fe7c8cd193ebb87508b1cbd4e211c3e5409e"
|
2015-10-08 14:06:34 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
resource "shards" do
|
2016-05-05 18:07:04 +00:00
|
|
|
url "https://github.com/ysbaddaden/shards/archive/v0.6.3.tar.gz"
|
|
|
|
sha256 "5245aebb21af0a5682123732e4f4d476e7aa6910252fb3ffe4be60ee8df03ac2"
|
2015-10-08 14:06:34 +00:00
|
|
|
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
|
2016-02-16 15:06:50 +00:00
|
|
|
system "make", "deps"
|
2015-10-08 14:06:34 +00:00
|
|
|
(buildpath/".build").mkpath
|
2016-03-21 21:33:26 +00:00
|
|
|
system "bin/crystal", "build", "-o", "-D", "without_openssl", "-D", "without_zlib", ".build/crystal", "src/compiler/crystal.cr"
|
2015-10-08 14:06:34 +00:00
|
|
|
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"
|
2016-01-29 07:46:12 +00:00
|
|
|
bash_completion.install "etc/completion.bash" => "crystal"
|
|
|
|
zsh_completion.install "etc/completion.zsh" => "crystal"
|
2015-10-08 14:06:34 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
system "#{bin}/crystal", "eval", "puts 1"
|
|
|
|
end
|
|
|
|
end
|