Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 48 additions & 16 deletions Formula/d/deno.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,33 +37,65 @@

conflicts_with "dxpy", because: "both install `dx` binaries"

def llvm
Formula["llvm"]
# Temporary resource to work around build failure due to files missing from
# crate needed to build with V8_FROM_SOURCE=1
resource "rusty_v8" do
url "https://github.com/denoland/rusty_v8.git",
tag: "v150.2.0",
revision: "d305e6afa7736f6e298c30ae6646f7709ee9382b"

livecheck do
url "https://raw.githubusercontent.com/denoland/deno/refs/tags/v#{LATEST_VERSION}/Cargo.lock"
regex(/^name = "v8"\nversion = "(\d+(?:\.\d+)+)"/i)
end
end

def llvm = Formula["llvm"]

def install

Check failure on line 55 in Formula/d/deno.rb

View workflow job for this annotation

GitHub Actions / Linux arm64

`brew install --verbose --formula --build-bottle deno` failed on Linux arm64!

[v8 150.2.0] errread, errwrite) [v8 150.2.0] ^^^^^^^^^^^^^^^^^^ [v8 150.2.0] File "/home/linuxbrew/.linuxbrew/opt/python@3.14/lib/python3.14/subprocess.py", line 1819, in _posix_spawn [v8 150.2.0] self.pid = os.posix_spawn(executable, args, env, **kwargs) [v8 150.2.0] ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [v8 150.2.0] OSError: [Errno 8] Exec format error: '../../../rusty_v8/third_party/rust-toolchain/bin/rustc' [v8 150.2.0] [2/2383] ACTION //build/rust/std/rules:compiler_builtins_compiler_builtins_vunknown_build_script_write_rustflags(//build/toolchain/linux/unbundle:default) [v8 150.2.0] [3/2383] ACTION //build/rust/std:find_stdlib(//build/toolchain/linux/unbundle:default_for_rust_host_build_tools) [v8 150.2.0] FAILED: [code=1] default_for_rust_host_build_tools/obj/build/rust/std/libstd.rlib default_for_rust_host_build_tools/obj/build/rust/std/liballoc.rlib default_for_rust_host_build_tools/obj/build/rust/std/libcfg_if.rlib default_for_rust_host_build_tools/obj/build/rust/std/libcompiler_builtins.rlib default_for_rust_host_build_tools/obj/build/rust/std/libcore.rlib default_for_rust_host_build_tools/obj/build/rust/std/libgetopts.rlib default_for_rust_host_build_tools/obj/build/rust/std/libhashbrown.rlib default_for_rust_host_build_tools/obj/build/rust/std/libpanic_abort.rlib default_for_rust_host_build_tools/obj/build/rust/std/librustc_demangle.rlib default_for_rust_host_build_tools/obj/build/rust/std/libstd_detect.rlib default_for_rust_host_build_tools/obj/build/rust/std/libtest.rlib default_for_rust_host_build_tools/obj/build/rust/std/libunwind.rlib default_for_rust_host_build_tools/obj/build/rust/std/libaddr2line.rlib default_for_rust_host_build_tools/obj/build/rust/std/libadler2.rlib default_for_rust_host_build_tools/obj/build/rust/std/libgimli.rlib default_for_rust_host_build_tools/obj/build/rust/std/liblibc.rlib default_for_rust_host_build_tools/obj/build/rust/std/libmemchr.rlib default_for_rust_host_build_tools/obj/build/rust/std/libminiz_oxide.rlib default_for_rust_host_build_tools/obj/build/rust/std/libobject.rlib default_for_rust_host_build_tools/obj/build/rust/std/libproc_macro.rlib default_for_rust_host_build_tools/obj/build/rust/std/libprofiler_builtins.rlib default_for_rust_host_build_tools/obj/build/rust/std/librustc_std_workspace_alloc.rlib default_for_rust_host_build_tools/obj/build/rust/std/librustc_std_workspace_core.rlib default_for_rust_host_build_tools/obj/build/rust/std/librustc_std_workspace_std.rlib [v8 150.2.0] /home/linuxbrew/.linuxbrew/opt/python@3.14/bin/python3 ../../../rusty_v8/build/rust/std/find_std_rlibs.py --rust-bin-dir ../../../rusty_v8/third_party/rust-toolchain/bin --output default_for_rust_host_build_tools/obj/build/rust/std --depfile default_for_rust_host_build_tools/obj/build/rust/std/stdlib.d --depfile-target std --rustc-revision 19604c4205163abcbd08948b3efab796c543ba1ea687-4c4205163abcbd08948b3efab796c543ba1ea687-4-23-10931-g20b6ec66 --target aarch64-unknown-linux-gnu [v8 150.2.0] Traceback (most recent call last): [v8 150.2.0] File "/var/tmp/deno-20260805-6628-8xe4hv/deno/target/release/gn_out/../../../rusty_v8/build/rust/std/find_std_rlibs.py", line 141, in <module> [v8 150.2.0] sys.exit(main()) [v8 150.2.0] ~~~~^^ [v8 150.2.0] File "/var/tmp/deno-20260805-6628-8xe4hv/deno/target/release/gn_out/../../../rusty_v8/build/rust/std/find_std_rlibs.py", line 53, in main [v8 150.2.0] rustlib_dir = subprocess.check_output(rustc_args).rstrip().decode() [v8 150.2.0] ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^ [v8 150.2.0] File "/home/linuxbrew/.linuxbrew/opt/python@3.14/lib/python3.14/subprocess.py", line 473, in check_output [v8 150.2.0] return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, [v8 150.2.0] ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [v8 150.2.0] **kwargs).stdout [v8 150.2.0] ^^^^^^^^^ [v8 150.2.0] File "/home/linuxbrew/.linuxbrew/opt/python@3.14/lib/python3.14/subproc

Check failure on line 55 in Formula/d/deno.rb

View workflow job for this annotation

GitHub Actions / Linux x86_64

`brew install --verbose --formula --build-bottle deno` failed on Linux x86_64!

Compiling bytemuck_derive v1.10.2 Running `CARGO=/home/linuxbrew/.linuxbrew/Cellar/rust/1.97.1/bin/cargo CARGO_CRATE_NAME=bytemuck_derive CARGO_MANIFEST_DIR=/home/linuxbrew/.cache/Homebrew/cargo_cache/registry/src/index.crates.io-1949cf8c6b5b557f/bytemuck_derive-1.10.2 CARGO_MANIFEST_PATH=/home/linuxbrew/.cache/Homebrew/cargo_cache/registry/src/index.crates.io-1949cf8c6b5b557f/bytemuck_derive-1.10.2/Cargo.toml CARGO_PKG_AUTHORS='Lokathor <zefria@gmail.com>' CARGO_PKG_DESCRIPTION='derive proc-macros for `bytemuck`' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='Zlib OR Apache-2.0 OR MIT' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=bytemuck_derive CARGO_PKG_README=README.md CARGO_PKG_REPOSITORY='https://github.com/Lokathor/bytemuck' CARGO_PKG_RUST_VERSION=1.61 CARGO_PKG_VERSION=1.10.2 CARGO_PKG_VERSION_MAJOR=1 CARGO_PKG_VERSION_MINOR=10 CARGO_PKG_VERSION_PATCH=2 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH=/var/tmp/deno-20260805-6680-7ogxln/deno/target/release/deps MACOSX_DEPLOYMENT_TARGET=12.0 /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/shared/rustc_wrapper rustc --crate-name bytemuck_derive --edition=2018 /home/linuxbrew/.cache/Homebrew/cargo_cache/registry/src/index.crates.io-1949cf8c6b5b557f/bytemuck_derive-1.10.2/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type proc-macro --emit=dep-info,link -C prefer-dynamic -C embed-bitcode=no -C debug-assertions=off --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=b0382d36d3ec2392 -C extra-filename=-485a14d016e39699 --out-dir /var/tmp/deno-20260805-6680-7ogxln/deno/target/release/deps -L dependency=/var/tmp/deno-20260805-6680-7ogxln/deno/target/release/deps --extern proc_macro2=/var/tmp/deno-20260805-6680-7ogxln/deno/target/release/deps/libproc_macro2-8db472a2010a9a80.rlib --extern quote=/var/tmp/deno-20260805-6680-7ogxln/deno/target/release/deps/libquote-1b575f67508cfae8.rlib --extern syn=/var/tmp/deno-20260805-6680-7ogxln/deno/target/release/deps/libsyn-5c2c586f091c0ede.rlib --extern proc_macro --cap-lints warn -D 'clippy::all' -D 'clippy::await_holding_refcell_ref' -D 'clippy::missing_safety_doc' -D 'clippy::undocumented_unsafe_blocks' --cfg tokio_unstable` [v8 150.2.0] [28/2378] CXX default_for_rust_host_build_tools/obj/build/rust/allocator/alloc_error_handler_impl/alias.o [v8 150.2.0] FAILED: [code=1] default_for_rust_host_build_tools/obj/build/rust/allocator/alloc_error_handler_impl/alias.o [v8 150.2.0] g++ -MD -MF default_for_rust_host_build_tools/obj/build/rust/allocator/alloc_error_handler_impl/alias.o.d -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_INSTRUMENTED_WITH_ASAN=0 -DCR_LIBCXX_REVISION=5abc7f839700f0f17338434e1c1c6a8c87c00c11 -DUSE_UDEV -DUSE_AURA=1 -DUSE_GLIB=1 -DUSE_OZONE=1 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -I../../../rusty_v8 -Idefault_for_rust_host_build_tools/gen -I../../../rusty_v8/buildtools/third_party/libc++ -Wall -Wextra -Wimplicit-fallthrough -Wextra-semi -Wunreachable-code-aggressive -Wgnu -Wno-gnu-anonymous-struct -Wno-gnu-conditional-omitted-operand -Wno-gnu-include-next -Wno-gnu-label-as-value -Wno-gnu-redeclared-enum -Wno-gnu-statement-expression -Wno-gnu-zero-variadic-macro-arguments -Wno-zero-length-array -Wthread-safety -Wno-missing-field-initializers -Wno-unused-parameter -Wno-psabi -Wloop-analysis -Wno-unneeded-internal-declaration -Wno-cast-function-type -Wno-thread-safety-reference-return -Wno-nontrivial-memcall -Wno-uninitialized-const-pointer -Wno-unused-but-set-global -Wshadow -fno-delete-null-pointer-checks -fno-strict-overflow -fno-ident -fno-math-errno -fno-strict-aliasing -fstack-protector -funwind-tables -fPIC -pthread -fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir=../../../rusty_v8/out/clang-crashreports -mllvm -instcombine-lower-dbg-declare=0 -mll
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 = "(.+)"$/, 'libffi = { version = "\\1", features = ["system"] }')
s.gsub!(/^rusqlite = { version = "(.+)", features = \["unlock_notify", "bundled", "session"/,
'rusqlite = { version = "\\1", features = ["unlock_notify", "session"')
# Work around files missing from crate
resource("rusty_v8").stage("rusty_v8")
if build.head? && (v8_version = File.read("Cargo.lock")[/^name = "v8"\nversion = "(\d+(?:\.\d+)+)"/i, 1])
system "git", "-C", "rusty_v8", "checkout", "--recurse-submodules", "v#{v8_version}"
end
args = %w[--config patch.crates-io.v8.path="rusty_v8"]

# Same inreplaces as `v8` formula to allow building with stable Clang
inreplace "rusty_v8/build/config/compiler/BUILD.gn" do |s|
s.gsub! 'cflags += [ "-fno-lifetime-dse" ]', ""
s.gsub! 'cflags += [ "-fdiagnostics-show-inlining-chain" ]', ""
end
inreplace "rusty_v8/build/config/sanitizers/sanitizers.gni",
'"-fsanitize-ignore-for-ubsan-feature=${invoker.sanitizer}",', ""

# FIXME: unable to build with brew rust (via `rust_sysroot_absolute`) due to nightly flags
gn_args = %W[clang_version="#{llvm.version.major}" use_lld=#{OS.linux?}]
if OS.linux?
# unbundle toolchain uses separate host toolchain and reads BUILD_* variables
ENV["BUILD_AR"] = ENV["AR"] = which("ar") # llvm.opt_bin/"llvm-ar"
ENV["BUILD_NM"] = ENV["NM"] = which("nm") # llvm.opt_bin/"llvm-nm"
ENV["BUILD_CC"] = ENV.cc
ENV["BUILD_CXX"] = ENV.cxx
gn_args += %w[
custom_toolchain="//build/toolchain/linux/unbundle:default"
host_toolchain="//build/toolchain/linux/unbundle:default"
use_system_libffi=true
]
end

ENV["CARGO_FEATURE_SYSTEM"] = "1" # libffi
ENV["LCMS2_LIB_DIR"] = formula_opt_lib("little-cms2")
ENV["LIBSQLITE3_SYS_USE_PKG_CONFIG"] = "1"
ENV["V8_FROM_SOURCE"] = "1" # per Homebrew/core policy, do not use prebuilt libv8.a
# env args for building a release build with our python3 and ninja
ENV["PYTHON"] = which("python3")
ENV["NINJA"] = which("ninja")
# 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?}"
ENV["CLANG_BASE_PATH"] = llvm.opt_prefix
ENV["GN_ARGS"] = gn_args.join(" ")

system "cargo", "install", "--no-default-features", "-vv", *std_cargo_args(path: "cli")
features = ["deno_core/v8", "v8/v8"] if build.head?
system "cargo", "install", "--no-default-features", "-vv", *args, *std_cargo_args(path: "cli", features:)
bin.install_symlink bin/"deno" => "dx"
generate_completions_from_executable(bin/"deno", "completions")
end
Expand Down
Loading