homebrew-core/Formula/crystal-lang.rb

73 lines
2.4 KiB
Ruby
Raw Normal View History

class CrystalLang < Formula
desc "Fast and statically typed, compiled language with Ruby-like syntax"
2016-07-03 12:38:52 +00:00
homepage "https://crystal-lang.org/"
url "https://github.com/crystal-lang/crystal/archive/0.19.4.tar.gz"
sha256 "e239afa449744e0381823531f6af66407ba1f4b78767bd67a9bb09d9fcc6b9e4"
2016-06-03 13:53:01 +00:00
head "https://github.com/crystal-lang/crystal.git"
2015-10-17 12:35:05 +00:00
bottle do
2016-10-07 13:46:24 +00:00
sha256 "b891e7a9c01906be5b6d51adc374c1882e036ae443b95abb1a8f27b072762fde" => :sierra
sha256 "928c541573faaeb82030d2fcbee7f4b5865b54cd0cb4f080adab00035394d9f5" => :el_capitan
sha256 "0faca697844e5ef7bbcf9d750ed27c448e224363c7150ebebc77c73f01099e07" => :yosemite
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 "pkg-config" => :build
2016-01-29 12:18:08 +00:00
depends_on "libevent"
depends_on "bdw-gc"
depends_on "llvm"
depends_on "pcre"
2016-10-08 15:47:57 +00:00
depends_on "gmp"
2016-07-27 01:35:34 +00:00
depends_on "libyaml" if build.with? "shards"
2016-01-29 12:18:08 +00:00
resource "boot" do
url "https://github.com/crystal-lang/crystal/releases/download/0.19.3/crystal-0.19.3-1-darwin-x86_64.tar.gz"
version "0.19.3"
sha256 "2c9aebfefe2aca46eeda1e5a3fd6a91e3177af8f324ea23ebf8b5cad3c87ad2d"
end
resource "shards" do
url "https://github.com/ysbaddaden/shards/archive/v0.6.4.tar.gz"
sha256 "5972f1b40bb3253319f564dee513229f82b0dcb8eea1502ae7dc483a9c6da5a0"
end
def install
(buildpath/"boot").install resource("boot")
if build.head?
2016-07-27 01:35:34 +00:00
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:libs: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
2016-07-27 01:35:34 +00:00
assert_match "1", shell_output("#{bin}/crystal eval puts 1")
end
end