Skip to content

Commit 789b4b0

Browse files
fix: missing SQLite builtin support in Node.js (#47757)
nodejs/node#58122 Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
1 parent 44bd560 commit 789b4b0

4 files changed

Lines changed: 45 additions & 19 deletions

patches/node/build_add_gn_build_files.patch

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ index 4560bac7b8e3c707ecea5a425f642efb9de9ed36..e9c2a4391f4058a21a259cacaac4fde5
2424
o['variables']['v8_enable_external_code_space'] = 1 if options.enable_pointer_compression else 0
2525
o['variables']['v8_enable_31bit_smis_on_64bit_arch'] = 1 if options.enable_pointer_compression else 0
2626
diff --git a/node.gni b/node.gni
27-
index 35ccd0487f20cece033d58827ecb7ed016908ee4..b4450e3dd17994d1eaf59eb5cff5912545e89793 100644
27+
index 35ccd0487f20cece033d58827ecb7ed016908ee4..62cd49c6a87074912a1cb6792576c8d4f239b669 100644
2828
--- a/node.gni
2929
+++ b/node.gni
3030
@@ -5,10 +5,10 @@
@@ -40,7 +40,15 @@ index 35ccd0487f20cece033d58827ecb7ed016908ee4..b4450e3dd17994d1eaf59eb5cff59125
4040

4141
# The location of OpenSSL - use the one from node's deps by default.
4242
node_openssl_path = "$node_path/deps/openssl"
43-
@@ -44,7 +44,7 @@ declare_args() {
43+
@@ -39,12 +39,15 @@ declare_args() {
44+
# The variable is called "openssl" for parity with node's GYP build.
45+
node_use_openssl = true
46+
47+
+ # Build node with SQLite support.
48+
+ node_use_sqlite = true
49+
+
50+
# Use the specified path to system CA (PEM format) in addition to
51+
# the BoringSSL supplied CA store or compiled-in Mozilla CA copy.
4452
node_openssl_system_ca_path = ""
4553

4654
# Initialize v8 platform during node.js startup.
@@ -49,7 +57,7 @@ index 35ccd0487f20cece033d58827ecb7ed016908ee4..b4450e3dd17994d1eaf59eb5cff59125
4957

5058
# Custom build tag.
5159
node_tag = ""
52-
@@ -64,10 +64,16 @@ declare_args() {
60+
@@ -64,10 +67,16 @@ declare_args() {
5361
# TODO(zcbenz): There are few broken things for now:
5462
# 1. cross-os compilation is not supported.
5563
# 2. node_mksnapshot crashes when cross-compiling for x64 from arm64.
@@ -271,10 +279,22 @@ index 856878c33681a73d41016729dabe48b0a6a80589..91a11852d206b65485fe90fd037a0bd1
271279
if sys.platform == 'win32':
272280
files = [ x.replace('\\', '/') for x in files ]
273281
diff --git a/unofficial.gni b/unofficial.gni
274-
index 44641b92678ab2f28e6f5de75a92878f9f3d322d..e17e4f043af6e4047ab82723ffd83187f3c04c5c 100644
282+
index 44641b92678ab2f28e6f5de75a92878f9f3d322d..a6cfd45b109c7b38fcf1529468ff64d3c1c8bd1b 100644
275283
--- a/unofficial.gni
276284
+++ b/unofficial.gni
277-
@@ -142,32 +142,42 @@ template("node_gn_build") {
285+
@@ -22,6 +22,11 @@ template("node_gn_build") {
286+
} else {
287+
defines += [ "HAVE_OPENSSL=0" ]
288+
}
289+
+ if (node_use_sqlite) {
290+
+ defines += [ "HAVE_SQLITE=1" ]
291+
+ } else {
292+
+ defines += [ "HAVE_SQLITE=0" ]
293+
+ }
294+
if (node_use_amaro) {
295+
defines += [ "HAVE_AMARO=1" ]
296+
} else {
297+
@@ -142,32 +147,41 @@ template("node_gn_build") {
278298
public_configs = [
279299
":node_external_config",
280300
"deps/googletest:googletest_config",
@@ -297,7 +317,7 @@ index 44641b92678ab2f28e6f5de75a92878f9f3d322d..e17e4f043af6e4047ab82723ffd83187
297317
"deps/nghttp2",
298318
- "deps/ngtcp2",
299319
"deps/postject",
300-
"deps/sqlite",
320+
- "deps/sqlite",
301321
"deps/uvwasi",
302322
- "deps/zstd",
303323
"//third_party/zlib",
@@ -320,16 +340,22 @@ index 44641b92678ab2f28e6f5de75a92878f9f3d322d..e17e4f043af6e4047ab82723ffd83187
320340
"$target_gen_dir/node_javascript.cc",
321341
] + gypi_values.node_sources
322342

323-
@@ -190,7 +200,7 @@ template("node_gn_build") {
343+
@@ -190,9 +204,13 @@ template("node_gn_build") {
324344
}
325345
if (node_use_openssl) {
326346
deps += [ "deps/ncrypto" ]
327347
- public_deps += [ "$node_openssl_path" ]
328348
+ public_deps += [ "//third_party/boringssl" ]
329349
sources += gypi_values.node_crypto_sources
330350
}
351+
+ if (node_use_sqlite) {
352+
+ deps += [ "deps/sqlite" ]
353+
+ sources += gypi_values.node_sqlite_sources
354+
+ }
331355
if (node_enable_inspector) {
332-
@@ -214,6 +224,10 @@ template("node_gn_build") {
356+
deps += [
357+
"src/inspector:crdtp",
358+
@@ -214,6 +232,10 @@ template("node_gn_build") {
333359
}
334360
}
335361

@@ -340,15 +366,15 @@ index 44641b92678ab2f28e6f5de75a92878f9f3d322d..e17e4f043af6e4047ab82723ffd83187
340366
executable(target_name) {
341367
forward_variables_from(invoker, "*")
342368

343-
@@ -288,6 +302,7 @@ template("node_gn_build") {
369+
@@ -288,6 +310,7 @@ template("node_gn_build") {
344370
}
345371

346372
executable("node_js2c") {
347373
+ defines = []
348374
deps = [
349375
"deps/uv",
350376
"$node_simdutf_path",
351-
@@ -298,26 +313,75 @@ template("node_gn_build") {
377+
@@ -298,26 +321,75 @@ template("node_gn_build") {
352378
"src/embedded_data.cc",
353379
"src/embedded_data.h",
354380
]
@@ -434,7 +460,7 @@ index 44641b92678ab2f28e6f5de75a92878f9f3d322d..e17e4f043af6e4047ab82723ffd83187
434460
outputs = [ "$target_gen_dir/node_javascript.cc" ]
435461

436462
# Get the path to node_js2c executable of the host toolchain.
437-
@@ -331,11 +395,11 @@ template("node_gn_build") {
463+
@@ -331,11 +403,11 @@ template("node_gn_build") {
438464
get_label_info(":node_js2c($host_toolchain)", "name") +
439465
host_executable_suffix
440466

patches/node/build_allow_unbundling_of_node_js_dependencies.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ We don't need to do this for zlib, as the existing gn workflow uses the same
1414
Upstreamed at https://github.com/nodejs/node/pull/55903
1515

1616
diff --git a/unofficial.gni b/unofficial.gni
17-
index e17e4f043af6e4047ab82723ffd83187f3c04c5c..d591dfc99fdea4f830008502786ee44d863a31fc 100644
17+
index a6cfd45b109c7b38fcf1529468ff64d3c1c8bd1b..332c9ee7262108ae9616e9bc8bd950a4940a858c 100644
1818
--- a/unofficial.gni
1919
+++ b/unofficial.gni
20-
@@ -155,7 +155,6 @@ template("node_gn_build") {
20+
@@ -160,7 +160,6 @@ template("node_gn_build") {
2121
":run_node_js2c",
2222
"deps/cares",
2323
"deps/histogram",
2424
- "deps/llhttp",
2525
"deps/nbytes",
2626
"deps/nghttp2",
2727
"deps/postject",
28-
@@ -194,7 +193,17 @@ template("node_gn_build") {
28+
@@ -198,7 +197,17 @@ template("node_gn_build") {
2929
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
3030
configs += [ "//build/config/gcc:symbol_visibility_default" ]
3131
}
@@ -44,7 +44,7 @@ index e17e4f043af6e4047ab82723ffd83187f3c04c5c..d591dfc99fdea4f830008502786ee44d
4444
if (v8_enable_i18n_support) {
4545
deps += [ "//third_party/icu" ]
4646
}
47-
@@ -222,6 +231,19 @@ template("node_gn_build") {
47+
@@ -230,6 +239,19 @@ template("node_gn_build") {
4848
sources += node_inspector.node_inspector_sources +
4949
node_inspector.node_inspector_generated_sources
5050
}

patches/node/build_option_to_use_custom_inspector_protocol_path.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ protocol deps to contain https://chromium-review.googlesource.com/c/v8/v8/+/5996
1212
Rest of the changes can be upstreamed.
1313

1414
diff --git a/node.gni b/node.gni
15-
index 203b4abbc44df9e58083c819f61f9025104abdc6..73bf3839866a2652ca660f1117e8f249d33fa46a 100644
15+
index 165b26a79a7f2b74d2a2252dc2350b2e10c091e6..c64761b730e61edcdc0e46a48699f2fd5bb1c0a6 100644
1616
--- a/node.gni
1717
+++ b/node.gni
1818
@@ -16,6 +16,9 @@ declare_args() {
@@ -39,10 +39,10 @@ index 3d7aa148678b2646b88fa7c32abec91791b02b82..4810d93eb971b253f7dadff7011a632f
3939
gypi_values = exec_script(
4040
"../../tools/gypi_to_gn.py",
4141
diff --git a/unofficial.gni b/unofficial.gni
42-
index d591dfc99fdea4f830008502786ee44d863a31fc..9e26399482d6a1cdb843efb72c152d5cdd5e08ea 100644
42+
index 332c9ee7262108ae9616e9bc8bd950a4940a858c..8886f2a79ae77614789d6ae0defd4f18fc756456 100644
4343
--- a/unofficial.gni
4444
+++ b/unofficial.gni
45-
@@ -214,13 +214,14 @@ template("node_gn_build") {
45+
@@ -222,13 +222,14 @@ template("node_gn_build") {
4646
}
4747
if (node_enable_inspector) {
4848
deps += [

patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ index e5bf2b529bf23914677e25d7468aad58a4684557..9a3c6029ff3319cce58c79782a7bd5d1
172172
};
173173
// Check to see if the given public key is suitable for this DH instance.
174174
diff --git a/node.gni b/node.gni
175-
index b4450e3dd17994d1eaf59eb5cff5912545e89793..203b4abbc44df9e58083c819f61f9025104abdc6 100644
175+
index 62cd49c6a87074912a1cb6792576c8d4f239b669..165b26a79a7f2b74d2a2252dc2350b2e10c091e6 100644
176176
--- a/node.gni
177177
+++ b/node.gni
178178
@@ -11,7 +11,7 @@ declare_args() {

0 commit comments

Comments
 (0)