1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-12 18:59:50 +03:00
aports/testing/electron/electron_unbundle-node.patch
2025-05-29 14:42:38 +00:00

143 lines
4.5 KiB
Diff

diff --git a/electron/script/generate-config-gypi.py.orig b/electron/script/generate-config-gypi.py
index 58c973b..c215d90 100755
--- a/electron/script/generate-config-gypi.py.orig
+++ b/electron/script/generate-config-gypi.py
@@ -64,6 +64,11 @@ def main(target_file, target_cpu):
# in common.gypi
if 'clang' in v:
del v['clang']
+
+ with open(os.path.join(NODE_DIR, 'use_system.txt')) as f:
+ for dep in f.read().strip().split(' '):
+ if v.get(f'node_shared_{dep}') is not None:
+ v[f'node_shared_{dep}'] = 'true'
with open(target_file, 'w+', encoding='utf-8') as file_out:
file_out.write(pprint.pformat(config, indent=2))
diff --git a/third_party/electron_node/node.gni.orig b/third_party/electron_node/node.gni
index 73bf383..1c80d5a 100644
--- a/third_party/electron_node/node.gni.orig
+++ b/third_party/electron_node/node.gni
@@ -73,6 +73,7 @@ declare_args() {
node_use_amaro = true
# Allows downstream packagers (eg. Linux distributions) to build against system shared libraries.
+ use_system_ada = false
use_system_cares = false
use_system_nghttp2 = false
use_system_llhttp = false
diff --git a/third_party/electron_node/unofficial.gni.orig b/third_party/electron_node/unofficial.gni
index d61a9bd..8bf990e 100644
--- a/third_party/electron_node/unofficial.gni.orig
+++ b/third_party/electron_node/unofficial.gni
@@ -143,7 +143,6 @@ template("node_gn_build") {
"deps/googletest:googletest_config",
]
public_deps = [
- "deps/ada",
"deps/uv",
"//electron:electron_js2c",
"deps/simdjson",
@@ -151,10 +150,7 @@ template("node_gn_build") {
]
deps = [
":run_node_js2c",
- "deps/cares",
- "deps/histogram",
"deps/nbytes",
- "deps/nghttp2",
"deps/postject",
"deps/sqlite",
"deps/uvwasi",
@@ -182,12 +178,30 @@ template("node_gn_build") {
if (is_posix) {
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
configs += [ "//build/config/gcc:symbol_visibility_default" ]
+ libs = []
+ include_dirs = []
}
if (use_system_llhttp) {
libs += [ "llhttp" ]
} else {
deps += [ "deps/llhttp" ]
}
+ if (use_system_cares) {
+ libs += [ "cares" ]
+ } else {
+ deps += [ "deps/cares" ]
+ }
+ if (use_system_nghttp2) {
+ libs += [ "nghttp2" ]
+ } else {
+ deps += [ "deps/nghttp2" ]
+ }
+ if (use_system_ada) {
+ libs += [ "ada" ]
+ include_dirs += [ "/usr/include/ada" ]
+ } else {
+ public_deps += [ "deps/ada" ]
+ }
if (use_system_histogram) {
libs += [ "hdr_histogram" ]
include_dirs += [ "/usr/include/hdr" ]
@@ -208,7 +222,7 @@ template("node_gn_build") {
"src/inspector:node_protocol_generated_sources",
"src/inspector:v8_inspector_compress_protocol_json",
]
- include_dirs = [
+ include_dirs += [
"$target_gen_dir/src",
"$target_gen_dir/src/inspector",
"$node_inspector_protocol_path",
@@ -222,17 +236,18 @@ template("node_gn_build") {
sources += node_inspector.node_inspector_sources +
node_inspector.node_inspector_generated_sources
}
- if (is_linux) {
- import("//build/config/linux/pkg_config.gni")
- if (use_system_cares) {
- pkg_config("cares") {
- packages = [ "libcares" ]
- }
- }
- if (use_system_nghttp2) {
- pkg_config("nghttp2") {
- packages = [ "libnghttp2" ]
- }
+ }
+
+ if (is_linux) {
+ import("//build/config/linux/pkg_config.gni")
+ if (use_system_cares) {
+ pkg_config("cares") {
+ packages = [ "libcares" ]
+ }
+ }
+ if (use_system_nghttp2) {
+ pkg_config("nghttp2") {
+ packages = [ "libnghttp2" ]
}
}
}
diff --git a/third_party/electron_node/unofficial.gni.orig b/third_party/electron_node/unofficial.gni
index 6bcc40b..7e383b2 100644
--- a/third_party/electron_node/unofficial.gni.orig
+++ b/third_party/electron_node/unofficial.gni
@@ -142,7 +142,6 @@ template("node_gn_build") {
public_configs = [
":node_external_config",
"deps/googletest:googletest_config",
- ":zstd_include_config"
]
public_deps = [
"deps/ada",
@@ -163,8 +162,6 @@ template("node_gn_build") {
"//third_party/zlib",
"//third_party/brotli:dec",
"//third_party/brotli:enc",
- "//third_party/zstd:decompress",
- "//third_party/zstd:headers",
"$node_simdutf_path",
"$node_v8_path:v8_libplatform",
]