Commit 4e48b9b06b7 for nodejs
commit 4e48b9b06b7e905defd40773ea6a6350d0b08008
Author: David Babenko-Sanders <dsanders11@ucsbalum.com>
Date: Thu Oct 29 22:31:11 2026 -0700
build: fix overriding node_path in GN build
Signed-off-by: David Babenko-Sanders <dsanders11@ucsbalum.com>
PR-URL: https://github.com/nodejs/node/pull/66805
Reviewed-By: Shelley Vohr <shelley.vohr@gmail.com>
diff --git a/node.gni b/node.gni
index fa4668a543e..af0b066d80e 100644
--- a/node.gni
+++ b/node.gni
@@ -7,21 +7,12 @@ declare_args() {
# The location of Node.js in source code tree.
node_path = "//node"
- # The location of V8 - use the one from node's deps by default.
- node_v8_path = "$node_path/deps/v8"
-
- # The location of OpenSSL - use the one from node's deps by default.
- node_openssl_path = "$node_path/deps/openssl"
-
# The location of simdutf - use the one from node's deps by default.
node_simdutf_path = "//third_party/simdutf"
# The location of inspector_protocol - use the one from node's deps by default.
node_inspector_protocol_path = "//third_party/inspector_protocol"
- # The NODE_MODULE_VERSION defined in node_version.h.
- node_module_version = exec_script("$node_path/tools/getmoduleversion.py", [], "value")
-
# Support for external shareable builtins.
# TODO(zcbenz): This is currently copied from configure.py, we should share
# the list between configure.py and GN configurations.
@@ -31,6 +22,22 @@ declare_args() {
]
}
+# These must be declared in a separate block from `node_path`, per GN documentation
+# (https://gn.googlesource.com/gn/+/main/docs/reference.md#func_declare_args):
+# "you cannot read the value of a variable defined in the same block, if you need
+# to make the default value of one arg depend on the possibly-overridden value of
+# another, write two separate declare_args() blocks"
+declare_args() {
+ # The location of V8 - use the one from node's deps by default.
+ node_v8_path = "$node_path/deps/v8"
+
+ # The location of OpenSSL - use the one from node's deps by default.
+ node_openssl_path = "$node_path/deps/openssl"
+
+ # The NODE_MODULE_VERSION defined in node_version.h.
+ node_module_version = exec_script("$node_path/tools/getmoduleversion.py", [], "value")
+}
+
# Equivalent of gyp file's configurations.
declare_args() {
# Enable the V8 inspector protocol for use with node.