69 lines
2.3 KiB
Ruby
69 lines
2.3 KiB
Ruby
class Deno < Formula
|
|
desc "Command-line JavaScript / TypeScript engine"
|
|
homepage "https://deno.land/"
|
|
url "https://github.com/denoland/deno/releases/download/v0.22.0/deno_src.tar.gz"
|
|
version "0.22.0"
|
|
sha256 "2f123449442922da50e320bf8f7d41fd0a5524010900490383ec4d2e98581e2a"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "63ddfb5fc369ca2e177a264cfb2e6fab23230cfe3c1afcbfc3d9693b9ad4685d" => :catalina
|
|
sha256 "064ba8c8a4e2fad40fd5498186f71009af259713baa19de815bd9dcb652cf398" => :mojave
|
|
sha256 "708c1a0d8c34c6a283526583af060916dea43eb74ecc4f0e15c54037ff01722a" => :high_sierra
|
|
end
|
|
|
|
depends_on "llvm" => :build if DevelopmentTools.clang_build_version < 1100
|
|
depends_on "ninja" => :build
|
|
depends_on "rust" => :build
|
|
|
|
depends_on :xcode => ["10.0", :build] # required by v8 7.9+
|
|
|
|
resource "gn" do
|
|
url "https://gn.googlesource.com/gn.git",
|
|
:revision => "152c5144ceed9592c20f0c8fd55769646077569b"
|
|
end
|
|
|
|
def install
|
|
# Build gn from source (used as a build tool here)
|
|
(buildpath/"gn").install resource("gn")
|
|
cd "gn" do
|
|
system "python", "build/gen.py"
|
|
system "ninja", "-C", "out/", "gn"
|
|
end
|
|
|
|
# env args for building a release build with our clang, ninja and gn
|
|
ENV["DENO_NO_BINARY_DOWNLOAD"] = "1"
|
|
ENV["DENO_GN_PATH"] = buildpath/"gn/out/gn"
|
|
args = %W[
|
|
clang_use_chrome_plugins=false
|
|
mac_deployment_target="#{MacOS.version}"
|
|
treat_warnings_as_errors=false
|
|
]
|
|
if DevelopmentTools.clang_build_version < 1100
|
|
# build with llvm and link against system libc++ (no runtime dep)
|
|
args << "clang_base_path=\"#{Formula["llvm"].prefix}\""
|
|
ENV.remove "HOMEBREW_LIBRARY_PATHS", Formula["llvm"].opt_lib
|
|
else # build with system clang
|
|
args << "clang_base_path=\"/usr/\""
|
|
end
|
|
ENV["DENO_BUILD_ARGS"] = args.join(" ")
|
|
|
|
cd "cli" do
|
|
system "cargo", "install", "-vv", "--locked", "--root", prefix, "--path", "."
|
|
end
|
|
|
|
# Install bash and zsh completion
|
|
output = Utils.popen_read("#{bin}/deno completions bash")
|
|
(bash_completion/"deno").write output
|
|
output = Utils.popen_read("#{bin}/deno completions zsh")
|
|
(zsh_completion/"_deno").write output
|
|
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
|