--- ./third_party/electron_node/BUILD.gn.orig +++ ./third_party/electron_node/BUILD.gn @@ -40,6 +40,8 @@ node_release_urlbase = "" # Allows downstream packagers (eg. Linux distributions) to build Electron against system shared libraries. + use_system_ada = false + use_system_base64 = false use_system_cares = false use_system_nghttp2 = false use_system_llhttp = false @@ -48,6 +50,16 @@ if (is_linux) { import("//build/config/linux/pkg_config.gni") + if (use_system_ada) { + config("ada") { + libs = [ "ada" ] + } + } + if (use_system_base64) { + pkg_config("base64") { + packages = [ "base64" ] + } + } if (use_system_cares) { pkg_config("cares") { packages = [ "libcares" ] @@ -258,8 +270,6 @@ deps = [ ":node_js2c_exec", "deps/googletest:gtest", - "deps/ada", - "deps/base64", "deps/simdutf", "deps/uvwasi", "//third_party/zlib", @@ -267,6 +277,16 @@ "//third_party/brotli:enc", "//v8:v8_libplatform", ] + if (use_system_ada) { + configs += [ ":ada" ] + } else { + deps += [ "deps/ada" ] + } + if (use_system_base64) { + configs += [ ":base64" ] + } else { + deps += [ "deps/base64" ] + } if (use_system_cares) { configs += [ ":cares" ] } else { diff --git a/./electron/script/generate-config-gypi.py.orig b/./electron/script/generate-config-gypi.py index b41cd7eb450..bc4098debb5 100755 --- a/./electron/script/generate-config-gypi.py.orig +++ b/./electron/script/generate-config-gypi.py @@ -62,6 +62,11 @@ def main(target_file, target_cpu): # Used by certain versions of node-gyp. v['build_v8_with_gn'] = 'false' + 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))