build: stop overriding node GN declare_args defaults in patch (#55042)

The build_add_gn_build_files node patch changed several defaults in
node.gni's declare_args() and hardcoded BoringSSL in unofficial.gni, even
though those are build args meant to be set by the embedder.

- Set node_v8_path and node_use_v8_platform from build/args/all.gn and
  restore upstream's defaults in the patch.
- Restore upstream's node_use_node_snapshot default; the later startup
  snapshot patch replaces it anyway, so the end result is unchanged.
- Drop the unofficial.gni hunk replacing $node_openssl_path with
  //third_party/boringssl, since all.gn already sets node_openssl_path to
  that value.

node_path stays patched: node_module_version's default in the same
declare_args() block runs exec_script() on $node_path, and GN evaluates it
against node_path's default even when it is overridden, so gn gen fails if
it only comes from args.


Claude-Session: https://claude.ai/code/session_01E1JKPsp6CSJJNzT5UKpfJ1

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
David Babenko-SandersandClaude authored and GitHub committed 2026-10-16 10:18:56 -07:00
1 parent 90bee4aae0
commit 03461bac82
9 files changed
+29 -43

No files matched your search

+6
View File
@@ -7,6 +7,12 @@ node_module_version = 150
# Build Node.js against Chromium's BoringSSL instead of node's bundled OpenSSL.
node_openssl_path = "//third_party/boringssl"
# Build Node.js against Chromium's V8 instead of node's bundled copy.
node_v8_path = "//v8"
# Electron owns V8 platform initialization, so Node.js must not set up its own.
node_use_v8_platform = false
v8_promise_internal_field_count = 1
# Args are evaluated before GN installs its script interpreter. Invoke the
+12 -32
View File
@@ -14,6 +14,13 @@ src/inspector/unofficial.gni - The node_protocol_generated_sources action
was missing gypi_values.node_pdl_files from its inputs, causing Ninja to skip
regeneration when PDL domain files changed. Should be upstreamed.
node.gni - The node_* declare_args() are configured from Electron's build
args (//electron/build/args/all.gn) rather than by changing their defaults
here. The exception is node_path: node_module_version's default in the same
declare_args() block runs exec_script() on $node_path, and GN evaluates it
against node_path's default even when both are overridden, so gn gen fails
unless the default points at the real checkout.
diff --git a/configure.py b/configure.py
index b826e24e3f474f4ec89bafd0a6db3081fadfbef8..1b35f195f7ee7547544cc954baf95c725afa8d0b 100755
--- a/configure.py
@@ -28,10 +35,10 @@ index b826e24e3f474f4ec89bafd0a6db3081fadfbef8..1b35f195f7ee7547544cc954baf95c72
o['variables']['v8_enable_external_code_space'] = 1 if options.enable_pointer_compression else 0
o['variables']['v8_enable_31bit_smis_on_64bit_arch'] = 1 if options.enable_pointer_compression else 0
diff --git a/node.gni b/node.gni
index 28ef444b72c139eb9253122dfaf8b14c8108eac6..0d0438ba8f478a08949ea07cad6c349d15060be9 100644
index 28ef444b72c139eb9253122dfaf8b14c8108eac6..757a0b2a75643322b3339a45e991ad5622ffc29e 100644
--- a/node.gni
+++ b/node.gni
@@ -5,10 +5,10 @@
@@ -5,7 +5,7 @@
# Embedder options.
declare_args() {
# The location of Node.js in source code tree.
@@ -39,26 +46,8 @@ index 28ef444b72c139eb9253122dfaf8b14c8108eac6..0d0438ba8f478a08949ea07cad6c349d
+ node_path = "//third_party/electron_node"
# The location of V8 - use the one from node's deps by default.
- node_v8_path = "$node_path/deps/v8"
+ node_v8_path = "//v8"
# The location of OpenSSL - use the one from node's deps by default.
node_openssl_path = "$node_path/deps/openssl"
@@ -48,7 +48,7 @@ declare_args() {
node_openssl_system_ca_path = ""
# Initialize v8 platform during node.js startup.
- node_use_v8_platform = true
+ node_use_v8_platform = false
# Custom build tag.
node_tag = ""
@@ -68,10 +68,16 @@ declare_args() {
# TODO(zcbenz): There are few broken things for now:
# 1. cross-os compilation is not supported.
# 2. node_mksnapshot crashes when cross-compiling for x64 from arm64.
- node_use_node_snapshot = (host_os == target_os) && !(host_cpu == "arm64" && target_cpu == "x64")
+ node_use_node_snapshot = false
node_v8_path = "$node_path/deps/v8"
@@ -72,6 +72,12 @@ declare_args() {
# Build with Amaro (TypeScript utils).
node_use_amaro = true
@@ -309,7 +298,7 @@ index 856878c33681a73d41016729dabe48b0a6a80589..91a11852d206b65485fe90fd037a0bd1
if sys.platform == 'win32':
files = [ x.replace('\\', '/') for x in files ]
diff --git a/unofficial.gni b/unofficial.gni
index aa35cd4664e9ed43b46e1ad62eaabcf1cfe40135..7265e09bf7601afe76463f528ffb385db796e093 100644
index aa35cd4664e9ed43b46e1ad62eaabcf1cfe40135..5fe998f97e2465162bde97cdae758bc7ab8243ba 100644
--- a/unofficial.gni
+++ b/unofficial.gni
@@ -147,32 +147,42 @@ template("node_gn_build") {
@@ -358,15 +347,6 @@ index aa35cd4664e9ed43b46e1ad62eaabcf1cfe40135..7265e09bf7601afe76463f528ffb385d
"$target_gen_dir/node_javascript.cc",
] + gypi_values.node_sources
@@ -195,7 +205,7 @@ template("node_gn_build") {
}
if (node_use_openssl) {
deps += [ "deps/ncrypto" ]
- public_deps += [ "$node_openssl_path" ]
+ public_deps += [ "//third_party/boringssl" ]
sources += gypi_values.node_crypto_sources
}
if (node_use_sqlite) {
@@ -224,6 +234,10 @@ template("node_gn_build") {
}
}
@@ -14,7 +14,7 @@ We don't need to do this for zlib, as the existing gn workflow uses the same
Upstreamed at https://github.com/nodejs/node/pull/55903
diff --git a/unofficial.gni b/unofficial.gni
index 7265e09bf7601afe76463f528ffb385db796e093..ca6fab3f2fa162c5292687e4218f7ea2c8bd4b46 100644
index 5fe998f97e2465162bde97cdae758bc7ab8243ba..87eb30961cfb44c31995f9768b3c81585bcc8736 100644
--- a/unofficial.gni
+++ b/unofficial.gni
@@ -199,7 +199,17 @@ template("node_gn_build") {
@@ -32,7 +32,7 @@ index dad4fbbf16f060a76bc7842135506f30aed7ffc0..d874d4b1e4079b392ba7652ea6bfc7de
"NCRYPTO_ENGINE_COMPAT=1",
"OPENSSL_SUPPRESS_DEPRECATED",
diff --git a/unofficial.gni b/unofficial.gni
index ca6fab3f2fa162c5292687e4218f7ea2c8bd4b46..1ccb4f3274b50f74e4ea5c309db155d7e0027560 100644
index 87eb30961cfb44c31995f9768b3c81585bcc8736..16ca92f90e5c08f35cc806e952229cd8a35fd725 100644
--- a/unofficial.gni
+++ b/unofficial.gni
@@ -143,7 +143,10 @@ template("node_gn_build") {
@@ -213,7 +213,7 @@ index 65b49b3469b83639a8b37469f24cd9208c70f47a..53bd0f168ba13deb58eb15a82450dad6
} // namespace node
diff --git a/unofficial.gni b/unofficial.gni
index 1ccb4f3274b50f74e4ea5c309db155d7e0027560..fdb258adabea6607f617e374026562366c8bac0e 100644
index 16ca92f90e5c08f35cc806e952229cd8a35fd725..8846cb83ed2949b81095883d99d9f0a7a7e04dc2 100644
--- a/unofficial.gni
+++ b/unofficial.gni
@@ -158,6 +158,11 @@ template("node_gn_build") {
@@ -62,7 +62,7 @@ eliminating the Node bootstrap recompile.
config following https://chromium-review.googlesource.com/c/v8/v8/+/7808546.
diff --git a/node.gni b/node.gni
index 0d0438ba8f478a08949ea07cad6c349d15060be9..55f35c4c376e66be291631cff8b1acf266ff41a3 100644
index 757a0b2a75643322b3339a45e991ad5622ffc29e..c7159731d790a76f20c7c678494a3969eccba5e9 100644
--- a/node.gni
+++ b/node.gni
@@ -31,6 +31,13 @@ declare_args() {
@@ -90,7 +90,7 @@ index 0d0438ba8f478a08949ea07cad6c349d15060be9..55f35c4c376e66be291631cff8b1acf2
- # TODO(zcbenz): There are few broken things for now:
- # 1. cross-os compilation is not supported.
- # 2. node_mksnapshot crashes when cross-compiling for x64 from arm64.
- node_use_node_snapshot = false
- node_use_node_snapshot = (host_os == target_os) && !(host_cpu == "arm64" && target_cpu == "x64")
+ # Embed a startup snapshot of the bootstrapped Node.js environment, and the
+ # V8 code cache for the builtins that complements it, to speed up startup.
+ # Neither contains machine code, so cross-arch builds can generate them, but
@@ -318,7 +318,7 @@ index 0842cba257d0ca36e07c97736e5b24cc77f2a053..0ee1bd02a03b6d303861cd0f8353db6c
node::InitializeOncePerProcess(
std::vector<std::string>(argv, argv + argc),
diff --git a/unofficial.gni b/unofficial.gni
index fdb258adabea6607f617e374026562366c8bac0e..d55f69133a3ba870c4b1dd23b6580c82ee590c77 100644
index 8846cb83ed2949b81095883d99d9f0a7a7e04dc2..1b95224d0555fd5d3ea2396535967d87631e0f91 100644
--- a/unofficial.gni
+++ b/unofficial.gni
@@ -32,7 +32,22 @@ template("node_gn_build") {
@@ -77,7 +77,7 @@ index f86232b125d9967f3021348cf88f132c391b2e0e..f72aafe07c039c6d63b74c80cd252f83
void IsolateData::MemoryInfo(MemoryTracker* tracker) const {
diff --git a/unofficial.gni b/unofficial.gni
index d55f69133a3ba870c4b1dd23b6580c82ee590c77..ceeed26dfaeace32e9ef761a68062ce93e9277b6 100644
index 1b95224d0555fd5d3ea2396535967d87631e0f91..a4cfd7fe8d80c96b11e33daff90e95b7581772be 100644
--- a/unofficial.gni
+++ b/unofficial.gni
@@ -73,6 +73,12 @@ template("node_gn_build") {
@@ -20,12 +20,12 @@ allowing contentTracing to remain the sole owner of category filtering,
recording sessions, output, and lifecycle.
diff --git a/node.gni b/node.gni
index 55f35c4c376e66be291631cff8b1acf266ff41a3..102e27726b7bd7f4adb290c43ceadc1559b27e54 100644
index c7159731d790a76f20c7c678494a3969eccba5e9..3903e8c27294403de12a91bd33f5380ac4640507 100644
--- a/node.gni
+++ b/node.gni
@@ -57,6 +57,10 @@ declare_args() {
# Initialize v8 platform during node.js startup.
node_use_v8_platform = false
node_use_v8_platform = true
+ # Include Node's standalone Perfetto client. Electron retains it for
+ # ELECTRON_RUN_AS_NODE while regular Electron processes use Chromium's client.
@@ -379,7 +379,7 @@ index 3765d931f8e17b33e2201ff3a0e4be84a3216356..17b990455e7d6a791998ab304418c256
+
#endif // SRC_TRACING_TRACE_EVENT_PERFETTO_H_
diff --git a/unofficial.gni b/unofficial.gni
index dd32e6d940d50f3091a45ef2977251c0d773e5d7..76f01b364feaffeaf64cf4451dcf93ef352e0909 100644
index dd88a03c352910760e5e5d8eeb0eb6f0dbbdfe42..198855083ee151a0033ce2c558d94d9f107b7e66 100644
--- a/unofficial.gni
+++ b/unofficial.gni
@@ -52,6 +52,11 @@ template("node_gn_build") {
@@ -2385,7 +2385,7 @@ index 370001847ee8b43c0e83e516f65856c85eff3f41..60d630702b95d786d9634c0ffda40ba7
}, # cppgc_base
{
diff --git a/unofficial.gni b/unofficial.gni
index ceeed26dfaeace32e9ef761a68062ce93e9277b6..dd32e6d940d50f3091a45ef2977251c0d773e5d7 100644
index a4cfd7fe8d80c96b11e33daff90e95b7581772be..dd88a03c352910760e5e5d8eeb0eb6f0dbbdfe42 100644
--- a/unofficial.gni
+++ b/unofficial.gni
@@ -166,6 +166,7 @@ template("node_gn_build") {