From 3d1216a02b5722d2a78ae454d8f223566abff48b Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Sun, 17 Nov 2024 22:33:19 +0100 Subject: [PATCH 1/2] build: allow unbundling of Node.js dependencies --- node.gni | 6 ++++++ unofficial.gni | 26 ++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/node.gni b/node.gni index 057686f0046e..c832397d162a 100644 --- a/node.gni +++ b/node.gni @@ -62,6 +62,12 @@ declare_args() { # Build with Amaro (TypeScript utils). node_use_amaro = true + + # Allows downstream packagers (eg. Linux distributions) to build against system shared libraries. + use_system_cares = false + use_system_nghttp2 = false + use_system_llhttp = false + use_system_histogram = false } assert(!node_enable_inspector || node_use_openssl, diff --git a/unofficial.gni b/unofficial.gni index 1caadb883461..75477af4ecc2 100644 --- a/unofficial.gni +++ b/unofficial.gni @@ -153,7 +153,6 @@ template("node_gn_build") { "deps/brotli", "deps/cares", "deps/histogram", - "deps/llhttp", "deps/nbytes", "deps/nghttp2", "deps/ngtcp2", @@ -179,7 +178,17 @@ template("node_gn_build") { configs -= [ "//build/config/gcc:symbol_visibility_hidden" ] configs += [ "//build/config/gcc:symbol_visibility_default" ] } - + if (use_system_llhttp) { + libs += [ "llhttp" ] + } else { + deps += [ "deps/llhttp" ] + } + if (use_system_histogram) { + libs += [ "hdr_histogram" ] + include_dirs += [ "/usr/include/hdr" ] + } else { + deps += [ "deps/histogram" ] + } if (v8_enable_i18n_support) { deps += [ "//third_party/icu" ] } @@ -206,6 +215,19 @@ 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" ] + } + } + } } executable(target_name) { From 35c34e7c9ead3daa2ad717c93ecf79da72236a73 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Tue, 10 Dec 2024 11:43:53 +0100 Subject: [PATCH 2/2] Update unofficial.gni Co-authored-by: LN Liberda --- unofficial.gni | 3 --- 1 file changed, 3 deletions(-) diff --git a/unofficial.gni b/unofficial.gni index 75477af4ecc2..07bbd0316552 100644 --- a/unofficial.gni +++ b/unofficial.gni @@ -150,9 +150,6 @@ template("node_gn_build") { ] deps = [ ":run_node_js2c", - "deps/brotli", - "deps/cares", - "deps/histogram", "deps/nbytes", "deps/nghttp2", "deps/ngtcp2",