--- ./third_party/electron_node/BUILD.gn.orig +++ ./third_party/electron_node/BUILD.gn @@ -39,6 +39,7 @@ node_release_urlbase = "" # Allows downstream packagers (eg. Linux distributions) to build Electron against system shared libraries. + use_system_base64 = false use_system_cares = false use_system_nghttp2 = false use_system_llhttp = false @@ -47,6 +48,11 @@ if (is_linux) { import("//build/config/linux/pkg_config.gni") + if (use_system_base64) { + pkg_config("base64") { + packages = [ "base64" ] + } + } if (use_system_cares) { pkg_config("cares") { packages = [ "libcares" ] @@ -208,7 +214,6 @@ ":node_js2c", "deps/googletest:gtest", "deps/ada", - "deps/base64", "deps/simdutf", "deps/uvwasi", "//third_party/zlib", @@ -216,6 +221,11 @@ "//third_party/brotli:enc", "//v8:v8_libplatform", ] + if (use_system_base64) { + configs += [ ":base64" ] + } else { + deps += [ "deps/base64" ] + } if (use_system_cares) { configs += [ ":cares" ] } else { --- ./electron/script/generate-config-gypi.py.orig +++ ./electron/script/generate-config-gypi.py @@ -62,6 +62,11 @@ # 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+') as f: f.write(pprint.pformat(config, indent=2))