Skip to content

Commit 7af1ff4

Browse files
authored
build: fix overriding node_path in GN build
Signed-off-by: David Babenko-Sanders <dsanders11@ucsbalum.com>
1 parent 2745698 commit 7af1ff4

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

‎node.gni‎

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,12 @@ declare_args() {
77
# The location of Node.js in source code tree.
88
node_path = "//node"
99

10-
# The location of V8 - use the one from node's deps by default.
11-
node_v8_path = "$node_path/deps/v8"
12-
13-
# The location of OpenSSL - use the one from node's deps by default.
14-
node_openssl_path = "$node_path/deps/openssl"
15-
1610
# The location of simdutf - use the one from node's deps by default.
1711
node_simdutf_path = "//third_party/simdutf"
1812

1913
# The location of inspector_protocol - use the one from node's deps by default.
2014
node_inspector_protocol_path = "//third_party/inspector_protocol"
2115

22-
# The NODE_MODULE_VERSION defined in node_version.h.
23-
node_module_version = exec_script("$node_path/tools/getmoduleversion.py", [], "value")
24-
2516
# Support for external shareable builtins.
2617
# TODO(zcbenz): This is currently copied from configure.py, we should share
2718
# the list between configure.py and GN configurations.
@@ -31,6 +22,22 @@ declare_args() {
3122
]
3223
}
3324

25+
# These must be declared in a separate block from `node_path`, per GN documentation
26+
# (https://gn.googlesource.com/gn/+/main/docs/reference.md#func_declare_args):
27+
# "you cannot read the value of a variable defined in the same block, if you need
28+
# to make the default value of one arg depend on the possibly-overridden value of
29+
# another, write two separate declare_args() blocks"
30+
declare_args() {
31+
# The location of V8 - use the one from node's deps by default.
32+
node_v8_path = "$node_path/deps/v8"
33+
34+
# The location of OpenSSL - use the one from node's deps by default.
35+
node_openssl_path = "$node_path/deps/openssl"
36+
37+
# The NODE_MODULE_VERSION defined in node_version.h.
38+
node_module_version = exec_script("$node_path/tools/getmoduleversion.py", [], "value")
39+
}
40+
3441
# Equivalent of gyp file's configurations.
3542
declare_args() {
3643
# Enable the V8 inspector protocol for use with node.

0 commit comments

Comments
 (0)