homebrew-core/Formula/crystal-lang.rb

70 lines
2.3 KiB
Ruby
Raw Normal View History

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.17.4.tar.gz"
sha256 "a5f3984c5d76b4fe2364869215596d1a3b148902d14f6bed54cd79cd4efe7b63"
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")
resource "boot" do
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"
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