11class Deno < Formula
22 desc "Secure runtime for JavaScript and TypeScript"
33 homepage "https://deno.com/"
4- url "https://github.com/denoland/deno/releases/download/v2.2.4 /deno_src.tar.gz"
5- sha256 "67808c70241abe878f177767585863d8442214b7a18c0ba7527c4a8f464f8cb3 "
4+ url "https://github.com/denoland/deno/releases/download/v2.2.6 /deno_src.tar.gz"
5+ sha256 "e3a0763f10d8f0ec511f2617456c7e0eee130c2b7a6787abbbab3baf29bc98e8 "
66 license "MIT"
77 head "https://github.com/denoland/deno.git" , branch : "main"
88
@@ -19,90 +19,40 @@ class Deno < Formula
1919 depends_on "lld" => :build
2020 depends_on "llvm" => :build
2121 depends_on "ninja" => :build
22- depends_on "protobuf " => :build
22+ depends_on "pkgconf " => :build
2323 depends_on "rust" => :build
2424 depends_on xcode : [ "15.0" , :build ] # v8 12.9+ uses linker flags introduced in xcode 15
25+ depends_on "little-cms2"
2526 depends_on "sqlite" # needs `sqlite3_unlock_notify`
2627
2728 uses_from_macos "python" => :build , since : :catalina
2829 uses_from_macos "libffi"
29- uses_from_macos "xz "
30+ uses_from_macos "zlib "
3031
3132 on_linux do
32- depends_on "pkgconf" => :build
33- depends_on "glib"
34- end
35-
36- # Temporary resources to work around build failure due to files missing from crate
37- # We use the crate as GitHub tarball lacks submodules and this allows us to avoid git overhead.
38- # TODO: Remove this and `v8` resource when https://github.com/denoland/rusty_v8/issues/1065 is resolved
39- # VERSION=#{version} && curl -s https://raw.githubusercontent.com/denoland/deno/v$VERSION/Cargo.lock | grep -C 1 'name = "v8"'
40- resource "rusty_v8" do
41- url "https://static.crates.io/crates/v8/v8-134.5.0.crate"
42- sha256 "21c7a224a7eaf3f98c1bad772fbaee56394dce185ef7b19a2e0ca5e3d274165d"
43- end
44-
45- # Find the v8 version from the last commit message at:
46- # https://github.com/denoland/rusty_v8/commits/v#{rusty_v8_version}/v8
47- # Then, use the corresponding tag found in https://github.com/denoland/v8/tags
48- resource "v8" do
49- url "https://github.com/denoland/v8/archive/refs/tags/13.4.114.11-denoland-060f4e2b72e373d63fc6.tar.gz"
50- sha256 "13244bee611589ea607d92a7a59bcce0add58fbf7cec7379945c3af6855da07f"
51- end
52-
53- # VERSION=#{version} && curl -s https://raw.githubusercontent.com/denoland/deno/v$VERSION/Cargo.lock | grep -C 1 'name = "deno_core"'
54- resource "deno_core" do
55- url "https://github.com/denoland/deno_core/archive/refs/tags/0.340.0.tar.gz"
56- sha256 "2137eecf512dfc74e252e693f958e282aae4fd4c564a3b754692f05c00662442"
57- end
58-
59- # The latest commit from `denoland/icu`, go to https://github.com/denoland/rusty_v8/tree/v#{rusty_v8_version}/third_party
60- # and check the commit of the `icu` directory
61- resource "icu" do
62- url "https://chromium.googlesource.com/chromium/deps/icu.git" ,
63- revision : "bbccc2f6efc1b825de5f2c903c48be685cd0cf22"
64- end
65-
66- # V8_TAG=#{v8_resource_tag} && curl -s https://raw.githubusercontent.com/denoland/v8/$V8_TAG/DEPS | grep gn_version
67- resource "gn" do
68- url "https://gn.googlesource.com/gn.git" ,
69- revision : "ed1abc107815210dc66ec439542bee2f6cbabc00"
33+ depends_on "glib" => :build
34+ depends_on "pcre2" => :build
7035 end
7136
7237 def llvm
7338 Formula [ "llvm" ]
7439 end
7540
7641 def install
77- # Work around files missing from crate
78- # TODO: Remove this at the same time as `rusty_v8` + `v8` resources
79- resource ( "rusty_v8" ) . stage buildpath /"../rusty_v8"
80- resource ( "v8" ) . stage do
81- cp_r "tools/builtins-pgo" , buildpath /"../rusty_v8/v8/tools/builtins-pgo"
82- end
83- resource ( "icu" ) . stage do
84- cp_r "common" , buildpath /"../rusty_v8/third_party/icu/common"
85- end
86-
87- resource ( "deno_core" ) . stage buildpath /"../deno_core"
88-
8942 # Avoid vendored dependencies.
90- inreplace "Cargo.toml" ,
91- /^libffi-sys = "(.+)"$/ ,
92- 'libffi-sys = { version = "\\1", features = ["system"] }'
93- inreplace "Cargo.toml" ,
94- /^rusqlite = { version = "(.+)", features = \[ "unlock_notify", "bundled", "session"\] }$/ ,
95- 'rusqlite = { version = "\\1", features = ["unlock_notify", "session"] }'
96-
97- if OS . mac? && ( MacOS . version < :mojave )
98- # Overwrite Chromium minimum SDK version of 10.15
99- ENV [ "FORCE_MAC_SDK_MIN" ] = MacOS . version
43+ inreplace "Cargo.toml" do |s |
44+ s . gsub! ( /^libffi-sys = "(.+)"$/ ,
45+ 'libffi-sys = { version = "\\1", features = ["system"] }' )
46+ s . gsub! ( /^rusqlite = { version = "(.+)", features = \[ "unlock_notify", "bundled", "session"/ ,
47+ 'rusqlite = { version = "\\1", features = ["unlock_notify", "session"' )
10048 end
49+ inreplace "resolvers/npm_cache/Cargo.toml" ,
50+ 'flate2 = { workspace = true, features = ["zlib-ng-compat"] }' ,
51+ "flate2 = { workspace = true }"
10152
102- python3 = which ( "python3" )
103- # env args for building a release build with our python3, ninja and gn
104- ENV [ "PYTHON" ] = python3
105- ENV [ "GN" ] = buildpath /"gn/out/gn"
53+ ENV [ "LCMS2_LIB_DIR" ] = Formula [ "little-cms2" ] . opt_lib
54+ # env args for building a release build with our python3 and ninja
55+ ENV [ "PYTHON" ] = which ( "python3" )
10656 ENV [ "NINJA" ] = which ( "ninja" )
10757 # build rusty_v8 from source
10858 ENV [ "V8_FROM_SOURCE" ] = "1"
@@ -111,28 +61,15 @@ def install
11161
11262 # use our clang version, and disable lld because the build assumes the lld
11363 # supports features from newer clang versions (>=20)
114- clang_version = llvm . version . major
115- ENV [ "GN_ARGS" ] = "clang_version=#{ clang_version } use_lld=false"
116-
117- # Work around an Xcode 15 linker issue which causes linkage against LLVM's
118- # libunwind due to it being present in a library search path.
119- ENV . remove "HOMEBREW_LIBRARY_PATHS" , llvm . opt_lib
120-
121- resource ( "gn" ) . stage buildpath /"gn"
122- cd "gn" do
123- system python3 , "build/gen.py"
124- system "ninja" , "-C" , "out"
125- end
126-
127- # cargo seems to build rusty_v8 twice in parallel, which causes problems,
128- # hence the need for ENV.deparallelize
129- # Issue ref: https://github.com/denoland/deno/issues/9244
130- ENV . deparallelize do
131- system "cargo" , "--config" , ".cargo/local-build.toml" ,
132- "install" , "--no-default-features" , "-vv" ,
133- *std_cargo_args ( path : "cli" )
64+ ENV [ "GN_ARGS" ] = "clang_version=#{ llvm . version . major } "
65+ if OS . mac?
66+ ENV . append "GN_ARGS" , "use_lld=false"
67+ else
68+ ENV . append "GN_ARGS" , "use_lld=true"
69+ ENV . delete "RUSTFLAGS"
13470 end
13571
72+ system "cargo" , "install" , "--no-default-features" , "-vv" , *std_cargo_args ( path : "cli" )
13673 generate_completions_from_executable ( bin /"deno" , "completions" )
13774 end
13875
0 commit comments