Skip to content

Commit 205c96f

Browse files
authored
chore: fixup GN build file
* nodejs/node#55529 * nodejs/node#55798 * nodejs/node#55530
1 parent c178633 commit 205c96f

File tree

1 file changed

+20
-76
lines changed

1 file changed

+20
-76
lines changed

patches/node/build_add_gn_build_files.patch

+20-76
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,6 @@ index d6909b95886f4de3f0b953c2a2992f69066b7434..972955f9144aafcd3a3fe278b7aaad40
2121
+ cflags_c = [ "-Wdeprecated-literal-operator" ]
2222
}
2323
}
24-
diff --git a/deps/sqlite/unofficial.gni b/deps/sqlite/unofficial.gni
25-
index ebb3ffcd6d42b4c16b6865a91ccf4428cffe864b..00225afa1fb4205f1e02d9f185aeb97d642b3fd9 100644
26-
--- a/deps/sqlite/unofficial.gni
27-
+++ b/deps/sqlite/unofficial.gni
28-
@@ -18,8 +18,14 @@ template("sqlite_gn_build") {
29-
forward_variables_from(invoker, "*")
30-
public_configs = [ ":sqlite_config" ]
31-
sources = gypi_values.sqlite_sources
32-
+ cflags_c = [
33-
+ "-Wno-implicit-fallthrough",
34-
+ "-Wno-unreachable-code-break",
35-
+ "-Wno-unreachable-code-return",
36-
+ "-Wno-unreachable-code",
37-
+ ]
38-
if (is_win) {
39-
- cflags_c = [
40-
+ cflags_c += [
41-
"-Wno-sign-compare",
42-
"-Wno-unused-but-set-variable",
43-
"-Wno-unused-function",
44-
diff --git a/node.gni b/node.gni
4524
index 9dca810decebd75aab427e306b3cc37c80fb55c9..852f64fa9cfb50fe6e9ce7aa46be336d3196d5b8 100644
4625
--- a/node.gni
4726
+++ b/node.gni
@@ -52,13 +31,13 @@ index 9dca810decebd75aab427e306b3cc37c80fb55c9..852f64fa9cfb50fe6e9ce7aa46be336d
5231
- node_path = "//node"
5332
+ node_path = "//third_party/electron_node"
5433

55-
# The location of V8, use the one from node's deps by default.
34+
# The location of V8 - use the one from node's deps by default.
5635
- node_v8_path = "$node_path/deps/v8"
5736
+ node_v8_path = "//v8"
5837

59-
# The NODE_MODULE_VERSION defined in node_version.h.
60-
node_module_version = exec_script("$node_path/tools/getmoduleversion.py", [], "value")
61-
@@ -38,7 +38,7 @@ declare_args() {
38+
# The location of OpenSSL - use the one from node's deps by default.
39+
node_openssl_path = "$node_path/deps/openssl"
40+
@@ -44,7 +44,7 @@ declare_args() {
6241
node_openssl_system_ca_path = ""
6342

6443
# Initialize v8 platform during node.js startup.
@@ -67,15 +46,15 @@ index 9dca810decebd75aab427e306b3cc37c80fb55c9..852f64fa9cfb50fe6e9ce7aa46be336d
6746

6847
# Custom build tag.
6948
node_tag = ""
70-
@@ -58,7 +58,16 @@ declare_args() {
49+
@@ -64,10 +64,16 @@ declare_args() {
7150
# TODO(zcbenz): There are few broken things for now:
7251
# 1. cross-os compilation is not supported.
7352
# 2. node_mksnapshot crashes when cross-compiling for x64 from arm64.
7453
- node_use_node_snapshot = (host_os == target_os) && !(host_cpu == "arm64" && target_cpu == "x64")
7554
+ node_use_node_snapshot = false
76-
+
77-
+ # Build with Amaro (TypeScript utils).
78-
+ node_use_amaro = true
55+
56+
# Build with Amaro (TypeScript utils).
57+
node_use_amaro = true
7958
+
8059
+ # Allows downstream packagers (eg. Linux distributions) to build against system shared libraries.
8160
+ use_system_cares = false
@@ -98,39 +77,18 @@ index 1bec44f6f29b0b652e92d2bb336fdb74b85eee30..599b59873dbb17ae5e7463403859e088
9877

9978
} // namespace builtins
10079
diff --git a/src/node_builtins.h b/src/node_builtins.h
101-
index 1cb85b9058d06555382e565dc32192a9fa48ed9f..cec9be01abd107e8612f70daf19b4834e118ffcf 100644
80+
index a73de23a1debfdac66873e0baccf882e383bfc36..7ac5291be093773ee7efd39e77e01bf5d5ce5247 100644
10281
--- a/src/node_builtins.h
10382
+++ b/src/node_builtins.h
10483
@@ -74,6 +74,8 @@ using BuiltinCodeCacheMap =
105-
// Generated by tools/js2c.py as node_javascript.cc
84+
// Generated by tools/js2c.cc as node_javascript.cc
10685
void RegisterExternalReferencesForInternalizedBuiltinCode(
10786
ExternalReferenceRegistry* registry);
10887
+void EmbedderRegisterExternalReferencesForInternalizedBuiltinCode(
10988
+ ExternalReferenceRegistry* registry);
11089

11190
// Handles compilation and caching of built-in JavaScript modules and
11291
// bootstrap scripts, whose source are bundled into the binary as static data.
113-
diff --git a/tools/generate_config_gypi.py b/tools/generate_config_gypi.py
114-
index 45b3ac5006140fb55aad0e6b78084b753a947a76..35cce2ea8fd85f21582962115ac455918d4c4553 100755
115-
--- a/tools/generate_config_gypi.py
116-
+++ b/tools/generate_config_gypi.py
117-
@@ -21,7 +21,7 @@ import getnapibuildversion
118-
GN_RE = re.compile(r'(\w+)\s+=\s+(.*?)$', re.MULTILINE)
119-
120-
if sys.platform == 'win32':
121-
- GN = 'gn.exe'
122-
+ GN = 'gn.bat'
123-
else:
124-
GN = 'gn'
125-
126-
@@ -65,6 +65,7 @@ def translate_config(out_dir, config, v8_config):
127-
eval(config['node_builtin_shareable_builtins']),
128-
'node_module_version': int(config['node_module_version']),
129-
'node_use_openssl': config['node_use_openssl'],
130-
+ 'node_use_amaro': config['node_use_amaro'],
131-
'node_use_node_code_cache': config['node_use_node_code_cache'],
132-
'node_use_node_snapshot': config['node_use_node_snapshot'],
133-
'v8_enable_inspector': # this is actually a node misnomer
13492
diff --git a/tools/install.py b/tools/install.py
13593
index bf54249b66c0d4e179deaae5a9fd55568e694fe0..31b94d2e4b532d3b8202b512e2d2f41d29a2a546 100755
13694
--- a/tools/install.py
@@ -305,18 +263,6 @@ diff --git a/unofficial.gni b/unofficial.gni
305263
index c3b311e4a7f5444b07d4d7028d4621806959804e..f6793b8bf22d6ac911a1977edaa881b6dbbe7ac7 100644
306264
--- a/unofficial.gni
307265
+++ b/unofficial.gni
308-
@@ -22,6 +22,11 @@ template("node_gn_build") {
309-
} else {
310-
defines += [ "HAVE_OPENSSL=0" ]
311-
}
312-
+ if (node_use_amaro) {
313-
+ defines += [ "HAVE_AMARO=1" ]
314-
+ } else {
315-
+ defines += [ "HAVE_AMARO=0" ]
316-
+ }
317-
if (node_use_v8_platform) {
318-
defines += [ "NODE_USE_V8_PLATFORM=1" ]
319-
} else {
320266
@@ -139,6 +144,7 @@ template("node_gn_build") {
321267
public_deps = [
322268
"deps/ada",
@@ -325,14 +271,16 @@ index c3b311e4a7f5444b07d4d7028d4621806959804e..f6793b8bf22d6ac911a1977edaa881b6
325271
"deps/simdjson",
326272
"$node_v8_path",
327273
]
328-
@@ -150,7 +156,6 @@ template("node_gn_build") {
274+
--- a/unofficial.gni
275+
+++ b/unofficial.gni
276+
@@ -156,7 +156,6 @@ template("node_gn_build") {
329277
"deps/llhttp",
330278
"deps/nbytes",
331279
"deps/nghttp2",
332280
- "deps/ngtcp2",
333281
"deps/postject",
334-
"deps/simdutf",
335282
"deps/sqlite",
283+
"deps/uvwasi",
336284
@@ -159,7 +164,11 @@ template("node_gn_build") {
337285
"$node_v8_path:v8_libplatform",
338286
]
@@ -345,27 +293,23 @@ index c3b311e4a7f5444b07d4d7028d4621806959804e..f6793b8bf22d6ac911a1977edaa881b6
345293
"$target_gen_dir/node_javascript.cc",
346294
] + gypi_values.node_sources
347295

348-
@@ -178,8 +187,10 @@ template("node_gn_build") {
349-
deps += [ "//third_party/icu" ]
296+
@@ -185,7 +185,7 @@ template("node_gn_build") {
350297
}
351298
if (node_use_openssl) {
352-
- deps += [ "deps/ncrypto" ]
353-
- public_deps += [ "deps/openssl" ]
354-
+ deps += [
355-
+ "deps/ncrypto",
356-
+ "//third_party/boringssl"
357-
+ ]
299+
deps += [ "deps/ncrypto" ]
300+
- public_deps += [ "$node_openssl_path" ]
301+
+ public_deps += [ "//third_party/boringssl" ]
358302
sources += gypi_values.node_crypto_sources
359303
}
360304
if (node_enable_inspector) {
361-
@@ -276,6 +287,7 @@ template("node_gn_build") {
305+
@@ -282,6 +282,7 @@ template("node_gn_build") {
362306
}
363307

364308
executable("node_js2c") {
365309
+ defines = []
366310
deps = [
367-
"deps/simdutf",
368311
"deps/uv",
312+
"$node_simdutf_path",
369313
@@ -286,26 +298,75 @@ template("node_gn_build") {
370314
"src/embedded_data.cc",
371315
"src/embedded_data.h",

0 commit comments

Comments
 (0)