-
-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Expand file tree
/
Copy pathdeno.rb
More file actions
103 lines (88 loc) · 4.12 KB
/
deno.rb
File metadata and controls
103 lines (88 loc) · 4.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
class Deno < Formula
desc "Secure runtime for JavaScript and TypeScript"
homepage "https://deno.com/"
url "https://github.com/denoland/deno/releases/download/v2.5.1/deno_src.tar.gz"
sha256 "d039d79548930742dcd770ceaf7a5aca26c571902dd9629d91ed049865bf9ccb"
license "MIT"
head "https://github.com/denoland/deno.git", branch: "main"
bottle do
sha256 cellar: :any, arm64_tahoe: "43d58dfa4208a9f36747e08b8ce74812c2adf18cb672c0906f0b5b4a0ee75543"
sha256 cellar: :any, arm64_sequoia: "bdbb69d5185be8e54af25d0df6809b8828d7e79f8fad1986ae615562204ec0ff"
sha256 cellar: :any, arm64_sonoma: "7dcd012a4e056070d3f71bab0b7b74d350432b2710cb044fa34302842aa684e5"
sha256 cellar: :any, arm64_ventura: "26c04aecd95e6f0131532fa50957a868e4944c2ba265d630d1fc65d3af34660f"
sha256 cellar: :any, sonoma: "ea3b174e1e185f03e58b7a6c999114312b8c5b8b6785a058dcaf5fe421dd1cbc"
sha256 cellar: :any, ventura: "7ea78589c2aa3f8fc0f77f7881925beabc584236c807a5528a9c5646cb5ca701"
sha256 cellar: :any_skip_relocation, arm64_linux: "438591d5d864d3d8f68328807e57eb4f0f4212f275d1e5f5e621aef479bd68d9"
sha256 cellar: :any_skip_relocation, x86_64_linux: "9cbdad602a5a58a09a1dfade9cc0d56723ad51f9337002743c9e45b2e7de7780"
end
depends_on "cmake" => :build
depends_on "lld" => :build
depends_on "llvm" => :build
depends_on "ninja" => :build
depends_on "pkgconf" => :build
depends_on "rust" => :build
depends_on xcode: ["15.0", :build] # v8 12.9+ uses linker flags introduced in xcode 15
depends_on "little-cms2"
depends_on "sqlite" # needs `sqlite3_unlock_notify`
uses_from_macos "python" => :build, since: :catalina
uses_from_macos "libffi"
on_linux do
depends_on "glib" => :build
depends_on "pcre2" => :build
end
def llvm
Formula["llvm"]
end
def install
inreplace "Cargo.toml" do |s|
# https://github.com/Homebrew/homebrew-core/pull/227966#issuecomment-3001448018
s.gsub!(/^lto = true$/, 'lto = "thin"')
# Avoid vendored dependencies.
s.gsub!(/^libffi-sys = "(.+)"$/,
'libffi-sys = { version = "\\1", features = ["system"] }')
s.gsub!(/^rusqlite = { version = "(.+)", features = \["unlock_notify", "bundled", "session"/,
'rusqlite = { version = "\\1", features = ["unlock_notify", "session"')
end
ENV["LCMS2_LIB_DIR"] = Formula["little-cms2"].opt_lib
# env args for building a release build with our python3 and ninja
ENV["PYTHON"] = which("python3")
ENV["NINJA"] = which("ninja")
# build rusty_v8 from source
ENV["V8_FROM_SOURCE"] = "1"
# Build with llvm and link against system libc++ (no runtime dep)
ENV["CLANG_BASE_PATH"] = llvm.prefix
# use our clang version, and disable lld because the build assumes the lld
# supports features from newer clang versions (>=20)
ENV["GN_ARGS"] = "clang_version=#{llvm.version.major} use_lld=#{OS.linux?}"
system "cargo", "install", "--no-default-features", "-vv", *std_cargo_args(path: "cli")
generate_completions_from_executable(bin/"deno", "completions")
end
test do
require "utils/linkage"
IO.popen("deno run -A -r https://fresh.deno.dev fresh-project", "r+") do |pipe|
pipe.puts "n"
pipe.puts "n"
pipe.close_write
pipe.read
end
assert_match "# Fresh project", (testpath/"fresh-project/README.md").read
(testpath/"hello.ts").write <<~TYPESCRIPT
console.log("hello", "deno");
TYPESCRIPT
assert_match "hello deno", shell_output("#{bin}/deno run hello.ts")
assert_match "Welcome to Deno!",
shell_output("#{bin}/deno run https://deno.land/std@0.100.0/examples/welcome.ts")
linked_libraries = [
Formula["sqlite"].opt_lib/shared_library("libsqlite3"),
]
unless OS.mac?
linked_libraries += [
Formula["libffi"].opt_lib/shared_library("libffi"),
]
end
linked_libraries.each do |library|
assert Utils.binary_linked_to_library?(bin/"deno", library),
"No linkage with #{library.basename}! Cargo is likely using a vendored version."
end
end
end