diff --git a/node.gni b/node.gni index 057686f0046e5e..c832397d162afd 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 1caadb8834618d..07bbd031655256 100644 --- a/unofficial.gni +++ b/unofficial.gni @@ -150,10 +150,6 @@ template("node_gn_build") { ] deps = [ ":run_node_js2c", - "deps/brotli", - "deps/cares", - "deps/histogram", - "deps/llhttp", "deps/nbytes", "deps/nghttp2", "deps/ngtcp2", @@ -179,7 +175,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 +212,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) {