71 lines
2.4 KiB
Ruby
71 lines
2.4 KiB
Ruby
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.19.3.tar.gz"
|
|
sha256 "72954087131bd648735bc397cfd585204087a4b8ab7f927f0a054741381ea01f"
|
|
head "https://github.com/crystal-lang/crystal.git"
|
|
|
|
bottle do
|
|
sha256 "2a437557a13707eeea1d603e520c74837373257df139b80a90728a59c0beee12" => :sierra
|
|
sha256 "20fd7f187a7e91c16231e11dea2826d0d55359a58c96b618e4d357c712e8c9fb" => :el_capitan
|
|
sha256 "cf70696dc50064875dc140090cf5e3d0b2b33d7eedb23ef3e4578c086d2089f2" => :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 "libevent"
|
|
depends_on "bdw-gc"
|
|
depends_on "llvm"
|
|
depends_on "pcre"
|
|
depends_on "libyaml" if build.with? "shards"
|
|
|
|
resource "boot" do
|
|
url "https://github.com/crystal-lang/crystal/releases/download/0.19.2/crystal-0.19.2-1-darwin-x86_64.tar.gz"
|
|
version "0.19.2"
|
|
sha256 "d5254e3e2d1e5fc851831a57573429876e5c9f86b2db066a2c74c392ae9080a2"
|
|
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?
|
|
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"
|
|
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
|