Skip to content

Commit a23bcdb

Browse files
codebytereclaude
andcommitted
fix(patch): GN build files for new merve dep
Ref: nodejs/node#61984 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 parent f4011ff commit a23bcdb

1 file changed

Lines changed: 26 additions & 81 deletions

File tree

patches/node/build_add_gn_build_files.patch

Lines changed: 26 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ really in 20/21. We have to wait until 22 is released to be able to
1111
build with upstream GN files.
1212

1313
diff --git a/configure.py b/configure.py
14-
index 98a8b147e4cbfd5957c35688f2b37ae0ca52a818..fd13970ae73bbe5db186f81faed792a5597bbcd0 100755
14+
index fa25de8c316b71d3ad5b55b5ce398b69a5d4a965..fc48438060e0dd84edc60d1aebf3d0946be98ea9 100755
1515
--- a/configure.py
1616
+++ b/configure.py
17-
@@ -1821,7 +1821,7 @@ def configure_v8(o, configs):
17+
@@ -1838,7 +1838,7 @@ def configure_v8(o, configs):
1818
# Until we manage to get rid of all those, v8_enable_sandbox cannot be used.
1919
# Note that enabling pointer compression without enabling sandbox is unsupported by V8,
2020
# so this can be broken at any time.
@@ -23,54 +23,8 @@ index 98a8b147e4cbfd5957c35688f2b37ae0ca52a818..fd13970ae73bbe5db186f81faed792a5
2323
# We set v8_enable_pointer_compression_shared_cage to 0 always, even when
2424
# pointer compression is enabled so that we don't accidentally enable shared
2525
# cage mode when pointer compression is on.
26-
diff --git a/deps/merve/BUILD.gn b/deps/merve/BUILD.gn
27-
new file mode 100644
28-
index 0000000000000000000000000000000000000000..7bb318f8835dba6f4a6f211d8534bb6923958747
29-
--- /dev/null
30-
+++ b/deps/merve/BUILD.gn
31-
@@ -0,0 +1,14 @@
32-
+##############################################################################
33-
+# #
34-
+# DO NOT EDIT THIS FILE! #
35-
+# #
36-
+##############################################################################
37-
+
38-
+# This file is used by GN for building, which is NOT the build system used for
39-
+# building official binaries.
40-
+# Please modify the gyp files if you are making changes to build system.
41-
+
42-
+import("unofficial.gni")
43-
+
44-
+merve_gn_build("merve") {
45-
+}
46-
diff --git a/deps/merve/unofficial.gni b/deps/merve/unofficial.gni
47-
new file mode 100644
48-
index 0000000000000000000000000000000000000000..dfb508d1d22f84accb146620ed07d89715b367e6
49-
--- /dev/null
50-
+++ b/deps/merve/unofficial.gni
51-
@@ -0,0 +1,20 @@
52-
+# This file is used by GN for building, which is NOT the build system used for
53-
+# building official binaries.
54-
+# Please edit the gyp files if you are making changes to build system.
55-
+
56-
+# The actual configurations are put inside a template in unofficial.gni to
57-
+# prevent accidental edits from contributors.
58-
+template("merve_gn_build") {
59-
+ config("merve_config") {
60-
+ include_dirs = [ "." ]
61-
+ }
62-
+ gypi_values = exec_script("../../tools/gypi_to_gn.py",
63-
+ [ rebase_path("merve.gyp") ],
64-
+ "scope",
65-
+ [ "merve.gyp" ])
66-
+ source_set(target_name) {
67-
+ forward_variables_from(invoker, "*")
68-
+ public_configs = [ ":merve_config" ]
69-
+ sources = gypi_values.merve_sources
70-
+ }
71-
+}
7226
diff --git a/node.gni b/node.gni
73-
index d4438f7fd61598afac2c1e3184721a759d22b10c..156fee33b3813fe4d94a1c9585f217a99dbfbd5f 100644
27+
index 41f200189a34e150e4c8f25da2a72c2108259720..156fee33b3813fe4d94a1c9585f217a99dbfbd5f 100644
7428
--- a/node.gni
7529
+++ b/node.gni
7630
@@ -5,10 +5,10 @@
@@ -86,16 +40,7 @@ index d4438f7fd61598afac2c1e3184721a759d22b10c..156fee33b3813fe4d94a1c9585f217a9
8640

8741
# The location of OpenSSL - use the one from node's deps by default.
8842
node_openssl_path = "$node_path/deps/openssl"
89-
@@ -26,8 +26,6 @@ declare_args() {
90-
# TODO(zcbenz): This is currently copied from configure.py, we should share
91-
# the list between configure.py and GN configurations.
92-
node_builtin_shareable_builtins = [
93-
- "deps/cjs-module-lexer/lexer.js",
94-
- "deps/cjs-module-lexer/dist/lexer.js",
95-
"deps/undici/undici.js",
96-
"deps/amaro/dist/index.js",
97-
]
98-
@@ -50,7 +48,7 @@ declare_args() {
43+
@@ -48,7 +48,7 @@ declare_args() {
9944
node_openssl_system_ca_path = ""
10045

10146
# Initialize v8 platform during node.js startup.
@@ -104,7 +49,7 @@ index d4438f7fd61598afac2c1e3184721a759d22b10c..156fee33b3813fe4d94a1c9585f217a9
10449

10550
# Custom build tag.
10651
node_tag = ""
107-
@@ -70,10 +68,16 @@ declare_args() {
52+
@@ -68,10 +68,16 @@ declare_args() {
10853
# TODO(zcbenz): There are few broken things for now:
10954
# 1. cross-os compilation is not supported.
11055
# 2. node_mksnapshot crashes when cross-compiling for x64 from arm64.
@@ -178,7 +123,7 @@ diff --git a/src/node_builtins.h b/src/node_builtins.h
178123
index e4af1f42f4442b4c1ec94cf25d8d811f0e82d89e..490f429986e43653e0dd2048d9e3bd2e99ae44b2 100644
179124
--- a/src/node_builtins.h
180125
+++ b/src/node_builtins.h
181-
@@ -75,6 +75,8 @@ using BuiltinCodeCacheMap =
126+
@@ -82,6 +82,8 @@ using BuiltinCodeCacheMap =
182127
// Generated by tools/js2c.cc as node_javascript.cc
183128
void RegisterExternalReferencesForInternalizedBuiltinCode(
184129
ExternalReferenceRegistry* registry);
@@ -204,26 +149,26 @@ index e4af1f42f4442b4c1ec94cf25d8d811f0e82d89e..490f429986e43653e0dd2048d9e3bd2e
204149
diff --git a/tools/js2c.cc b/tools/js2c.cc
205150
old mode 100644
206151
new mode 100755
207-
index 9c2f70de4e00834ff448e573743898072dc14c5d..71a12c606f4da7165cc41a295a278b2e504af1b6
152+
index 2cb09f8e1d7ba6ba389f70cdfc6300458f469caa..1a7b6ec6e6c51cf947694fac5dfd860b345d478f
208153
--- a/tools/js2c.cc
209154
+++ b/tools/js2c.cc
210-
@@ -28,6 +28,7 @@ namespace js2c {
155+
@@ -29,6 +29,7 @@ namespace js2c {
211156
int Main(int argc, char* argv[]);
212157

213158
static bool is_verbose = false;
214159
+static bool only_js = false;
215160

216161
void Debug(const char* format, ...) {
217162
va_list arguments;
218-
@@ -175,6 +176,7 @@ const char* kTemplate = R"(
163+
@@ -176,6 +177,7 @@ const char* kTemplate = R"(
219164
#include "node_builtins.h"
220165
#include "node_external_reference.h"
221166
#include "node_internals.h"
222167
+#include "node_threadsafe_cow-inl.h"
223168

224169
namespace node {
225170

226-
@@ -190,7 +192,11 @@ const ThreadsafeCopyOnWrite<BuiltinSourceMap> global_source_map {
171+
@@ -191,7 +193,11 @@ const ThreadsafeCopyOnWrite<BuiltinSourceMap> global_source_map {
227172
} // anonymous namespace
228173

229174
void BuiltinLoader::LoadJavaScriptSource() {
@@ -236,7 +181,7 @@ index 9c2f70de4e00834ff448e573743898072dc14c5d..71a12c606f4da7165cc41a295a278b2e
236181
}
237182

238183
void RegisterExternalReferencesForInternalizedBuiltinCode(
239-
@@ -207,6 +213,45 @@ UnionBytes BuiltinLoader::GetConfig() {
184+
@@ -208,6 +214,45 @@ UnionBytes BuiltinLoader::GetConfig() {
240185
} // namespace node
241186
)";
242187

@@ -282,7 +227,7 @@ index 9c2f70de4e00834ff448e573743898072dc14c5d..71a12c606f4da7165cc41a295a278b2e
282227
Fragment Format(const Fragments& definitions,
283228
const Fragments& initializers,
284229
const Fragments& registrations) {
285-
@@ -216,13 +261,12 @@ Fragment Format(const Fragments& definitions,
230+
@@ -217,13 +262,12 @@ Fragment Format(const Fragments& definitions,
286231
size_t init_size = init_buf.size();
287232
std::vector<char> reg_buf = Join(registrations, "\n");
288233
size_t reg_size = reg_buf.size();
@@ -299,7 +244,7 @@ index 9c2f70de4e00834ff448e573743898072dc14c5d..71a12c606f4da7165cc41a295a278b2e
299244
static_cast<int>(def_buf.size()),
300245
def_buf.data(),
301246
static_cast<int>(init_buf.size()),
302-
@@ -836,12 +880,15 @@ int JS2C(const FileList& js_files,
247+
@@ -848,12 +892,15 @@ int JS2C(const FileList& js_files,
303248
}
304249
}
305250

@@ -315,7 +260,7 @@ index 9c2f70de4e00834ff448e573743898072dc14c5d..71a12c606f4da7165cc41a295a278b2e
315260
Fragment out = Format(definitions, initializers, registrations);
316261
return WriteIfChanged(out, dest);
317262
}
318-
@@ -867,6 +914,8 @@ int Main(int argc, char* argv[]) {
263+
@@ -879,6 +926,8 @@ int Main(int argc, char* argv[]) {
319264
std::string arg(argv[i]);
320265
if (arg == "--verbose") {
321266
is_verbose = true;
@@ -324,7 +269,7 @@ index 9c2f70de4e00834ff448e573743898072dc14c5d..71a12c606f4da7165cc41a295a278b2e
324269
} else if (arg == "--root") {
325270
if (i == argc - 1) {
326271
fprintf(stderr, "--root must be followed by a path\n");
327-
@@ -915,6 +964,14 @@ int Main(int argc, char* argv[]) {
272+
@@ -927,6 +976,14 @@ int Main(int argc, char* argv[]) {
328273
}
329274
}
330275

@@ -339,7 +284,7 @@ index 9c2f70de4e00834ff448e573743898072dc14c5d..71a12c606f4da7165cc41a295a278b2e
339284
// Should have exactly 3 types: `.js`, `.mjs` and `.gypi`.
340285
assert(file_map.size() == 3);
341286
auto gypi_it = file_map.find(".gypi");
342-
@@ -941,6 +998,7 @@ int Main(int argc, char* argv[]) {
287+
@@ -953,6 +1010,7 @@ int Main(int argc, char* argv[]) {
343288
std::sort(mjs_it->second.begin(), mjs_it->second.end());
344289

345290
return JS2C(js_it->second, mjs_it->second, gypi_it->second[0], output);
@@ -360,10 +305,10 @@ index 856878c33681a73d41016729dabe48b0a6a80589..91a11852d206b65485fe90fd037a0bd1
360305
if sys.platform == 'win32':
361306
files = [ x.replace('\\', '/') for x in files ]
362307
diff --git a/unofficial.gni b/unofficial.gni
363-
index c742b62c484e9dd205eff63dcffad78c76828375..bff7b0650cfe8578a044e45d0f9e352859909695 100644
308+
index aa78f9ce60c0439536eaf6e23880e30ebef0e1a9..df0ae804a5338d8f2ec4d331a1e2ed053c3c3955 100644
364309
--- a/unofficial.gni
365310
+++ b/unofficial.gni
366-
@@ -147,31 +147,42 @@ template("node_gn_build") {
311+
@@ -147,32 +147,42 @@ template("node_gn_build") {
367312
public_configs = [
368313
":node_external_config",
369314
"deps/googletest:googletest_config",
@@ -382,7 +327,7 @@ index c742b62c484e9dd205eff63dcffad78c76828375..bff7b0650cfe8578a044e45d0f9e3528
382327
"deps/cares",
383328
"deps/histogram",
384329
"deps/llhttp",
385-
+ "deps/merve",
330+
"deps/merve",
386331
"deps/nbytes",
387332
"deps/nghttp2",
388333
- "deps/ngtcp2",
@@ -409,7 +354,7 @@ index c742b62c484e9dd205eff63dcffad78c76828375..bff7b0650cfe8578a044e45d0f9e3528
409354
"$target_gen_dir/node_javascript.cc",
410355
] + gypi_values.node_sources
411356

412-
@@ -194,7 +205,7 @@ template("node_gn_build") {
357+
@@ -195,7 +205,7 @@ template("node_gn_build") {
413358
}
414359
if (node_use_openssl) {
415360
deps += [ "deps/ncrypto" ]
@@ -418,7 +363,7 @@ index c742b62c484e9dd205eff63dcffad78c76828375..bff7b0650cfe8578a044e45d0f9e3528
418363
sources += gypi_values.node_crypto_sources
419364
}
420365
if (node_use_sqlite) {
421-
@@ -223,6 +234,10 @@ template("node_gn_build") {
366+
@@ -224,6 +234,10 @@ template("node_gn_build") {
422367
}
423368
}
424369

@@ -429,17 +374,17 @@ index c742b62c484e9dd205eff63dcffad78c76828375..bff7b0650cfe8578a044e45d0f9e3528
429374
executable(target_name) {
430375
forward_variables_from(invoker, "*")
431376

432-
@@ -314,6 +329,7 @@ template("node_gn_build") {
377+
@@ -315,6 +329,7 @@ template("node_gn_build") {
433378
}
434379

435380
executable("node_js2c") {
436381
+ defines = []
437382
deps = [
438383
"deps/uv",
439384
"$node_simdutf_path",
440-
@@ -324,26 +340,75 @@ template("node_gn_build") {
441-
"src/embedded_data.cc",
442-
"src/embedded_data.h",
385+
@@ -327,26 +342,75 @@ template("node_gn_build") {
386+
"src/builtin_info.cc",
387+
"src/builtin_info.h",
443388
]
444389
- include_dirs = [ "src" ]
445390
+ include_dirs = [ "src", "tools" ]
@@ -523,7 +468,7 @@ index c742b62c484e9dd205eff63dcffad78c76828375..bff7b0650cfe8578a044e45d0f9e3528
523468
outputs = [ "$target_gen_dir/node_javascript.cc" ]
524469

525470
# Get the path to node_js2c executable of the host toolchain.
526-
@@ -357,11 +422,11 @@ template("node_gn_build") {
471+
@@ -360,11 +424,11 @@ template("node_gn_build") {
527472
get_label_info(":node_js2c($host_toolchain)", "name") +
528473
host_executable_suffix
529474

0 commit comments

Comments
 (0)