Last active
May 30, 2019 16:25
-
-
Save chrmoritz/3dfc9fa7acc720cf5e1289e51662f69c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Deno < Formula | |
desc "Command-line JavaScript / TypeScript engine" | |
homepage "https://deno.land/" | |
url "https://github.com/denoland/deno.git", | |
:tag => "v0.7.0", | |
:revision => "5265bd7cb1f86af99b01d73c537d52a50df95fe2" | |
bottle do | |
cellar :any_skip_relocation | |
sha256 "5e077eed0c3a9c6d8be45e8f6399f353b3bbb575e338d727fb5ca45a9e36adea" => :mojave | |
sha256 "14e605357405b92b5a54d53a826373395607e8d80f6d1662760828ecd7000fbb" => :high_sierra | |
sha256 "e5c62a72c93162f6f4c6e04965ad2d991651e6cca28b1ed481d3b8d22ef1023b" => :sierra | |
end | |
depends_on "llvm" => :build | |
depends_on "ninja" => :build | |
depends_on "node" => :build | |
depends_on "rust" => :build | |
# https://bugs.chromium.org/p/chromium/issues/detail?id=620127 | |
depends_on :macos => :el_capitan | |
resource "gn" do | |
url "https://gn.googlesource.com/gn.git", | |
:revision => "64b846c96daeb3eaf08e26d8a84d8451c6cb712b" | |
end | |
patch do | |
url "https://github.com/denoland/deno/pull/2423.patch?full_index=1" | |
sha256 "591c186dd97b2c7e78b0a79bf8aa8521d67d63738fbb24a27e2a6a414b2ce2cb" | |
end | |
def install | |
(buildpath/"gn").install resource("gn") | |
cd "gn" do | |
system "python", "build/gen.py" | |
system "ninja", "-C", "out/", "gn" | |
end | |
ENV["DENO_BUILD_MODE"] = "release" | |
ENV["DENO_BUILD_ARGS"] = "clang_base_path=\"#{Formula["llvm"].prefix}\" clang_use_chrome_plugins=false" | |
ENV["DENO_GN_PATH"] = buildpath/"gn/out/gn" | |
ENV["DENO_NINJA_PATH"] = Formula["ninja"].bin/"ninja" | |
system "python", "tools/setup.py", "--no-binary-download" | |
system "python", "tools/build.py", "--release" | |
bin.install "target/release/deno" | |
end | |
test do | |
(testpath/"hello.ts").write <<~EOS | |
console.log("hello", "deno"); | |
EOS | |
hello = shell_output("#{bin}/deno run hello.ts") | |
assert_includes hello, "hello deno" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment