From 8255cdefcf65c52a8a2ad042c4dbca5bfd3a98bd Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Tue, 13 Jan 2026 02:31:12 +0100 Subject: [PATCH] build: add `--shared-nbytes` configure flag PR-URL: https://github.com/nodejs/node/pull/61341 Reviewed-By: Yagiz Nizipli Reviewed-By: Aviv Keller Reviewed-By: Colin Ihrig --- .github/workflows/test-shared.yml | 2 ++ Makefile | 1 + configure.py | 23 +++++++++++++++++++++++ node.gyp | 31 ++++++++++++++++++++++++++----- tools/nix/sharedLibDeps.nix | 10 ++++++++++ 5 files changed, 62 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-shared.yml b/.github/workflows/test-shared.yml index 9ac028af6e6..31064053841 100644 --- a/.github/workflows/test-shared.yml +++ b/.github/workflows/test-shared.yml @@ -23,6 +23,7 @@ on: - deps/icu-small/** - deps/icu-tmp/** - deps/llhttp/** + - deps/nbytes/** - deps/nghttp2/** - deps/ngtcp2/** - deps/openssl/*/** @@ -71,6 +72,7 @@ on: - deps/icu-small/** - deps/icu-tmp/** - deps/llhttp/** + - deps/nbytes/** - deps/nghttp2/** - deps/ngtcp2/** - deps/openssl/*/** diff --git a/Makefile b/Makefile index b3c8486f7ca..71f12062dd9 100644 --- a/Makefile +++ b/Makefile @@ -1240,6 +1240,7 @@ ifeq ($(SKIP_SHARED_DEPS), 1) $(RM) -r $(TARNAME)/deps/icu-small $(RM) -r $(TARNAME)/deps/icu-tmp $(RM) -r $(TARNAME)/deps/llhttp + $(RM) -r $(TARNAME)/deps/nbytes $(RM) -r $(TARNAME)/deps/nghttp2 $(RM) -r $(TARNAME)/deps/ngtcp2 find $(TARNAME)/deps/openssl -maxdepth 1 -type f ! -name 'nodejs-openssl.cnf' -exec $(RM) {} + diff --git a/configure.py b/configure.py index ff51f0cd1f9..b3e78f1ac3a 100755 --- a/configure.py +++ b/configure.py @@ -357,6 +357,28 @@ shared_optgroup.add_argument('--shared-libuv-libpath', dest='shared_libuv_libpath', help='a directory to search for the shared libuv DLL') +shared_optgroup.add_argument('--shared-nbytes', + action='store_true', + dest='shared_nbytes', + default=None, + help='link to a shared nbytes DLL instead of static linking') + +shared_optgroup.add_argument('--shared-nbytes-includes', + action='store', + dest='shared_nbytes_includes', + help='directory containing nbytes header files') + +shared_optgroup.add_argument('--shared-nbytes-libname', + action='store', + dest='shared_nbytes_libname', + default='nbytes', + help='alternative lib name to link to [default: %(default)s]') + +shared_optgroup.add_argument('--shared-nbytes-libpath', + action='store', + dest='shared_nbytes_libpath', + help='a directory to search for the shared nbytes DLL') + shared_optgroup.add_argument('--shared-nghttp2', action='store_true', dest='shared_nghttp2', @@ -2459,6 +2481,7 @@ configure_library('brotli', output, pkgname=['libbrotlidec', 'libbrotlienc']) configure_library('cares', output, pkgname='libcares') configure_library('gtest', output) configure_library('hdr_histogram', output) +configure_library('nbytes', output) configure_library('nghttp2', output, pkgname='libnghttp2') configure_library('nghttp3', output, pkgname='libnghttp3') configure_library('ngtcp2', output, pkgname='libngtcp2') diff --git a/node.gyp b/node.gyp index 2b3548ab5bf..55adfc7bb15 100644 --- a/node.gyp +++ b/node.gyp @@ -18,6 +18,7 @@ 'node_shared_hdr_histogram%': 'false', 'node_shared_http_parser%': 'false', 'node_shared_libuv%': 'false', + 'node_shared_nbytes%': 'false', 'node_shared_nghttp2%': 'false', 'node_shared_openssl%': 'false', 'node_shared_sqlite%': 'false', @@ -873,7 +874,6 @@ '<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h ], 'dependencies': [ - 'deps/nbytes/nbytes.gyp:nbytes', 'tools/v8_gypfiles/abseil.gyp:abseil', 'node_js2c#host', ], @@ -945,6 +945,11 @@ 'deps/histogram/histogram.gyp:histogram', ], }], + [ 'node_shared_nbytes=="false"', { + 'dependencies': [ + 'deps/nbytes/nbytes.gyp:nbytes', + ], + }], [ 'node_use_sqlite=="true"', { 'sources': [ '<@(node_sqlite_sources)', @@ -1183,7 +1188,6 @@ 'type': 'executable', 'dependencies': [ '<(node_lib_target_name)', - 'deps/nbytes/nbytes.gyp:nbytes', ], 'includes': [ 'node.gypi' @@ -1216,6 +1220,11 @@ 'deps/histogram/histogram.gyp:histogram', ], }], + [ 'node_shared_nbytes=="false"', { + 'dependencies': [ + 'deps/nbytes/nbytes.gyp:nbytes', + ], + }], [ 'node_shared_uvwasi=="false"', { 'dependencies': [ 'deps/uvwasi/uvwasi.gyp:uvwasi' ], 'include_dirs': [ 'deps/uvwasi/include' ], @@ -1239,7 +1248,6 @@ 'dependencies': [ '<(node_lib_target_name)', - 'deps/nbytes/nbytes.gyp:nbytes', 'tools/v8_gypfiles/abseil.gyp:abseil', ], @@ -1279,6 +1287,11 @@ 'deps/histogram/histogram.gyp:histogram', ], }], + [ 'node_shared_nbytes=="false"', { + 'dependencies': [ + 'deps/nbytes/nbytes.gyp:nbytes', + ], + }], [ 'node_use_openssl=="true"', { 'defines': [ 'HAVE_OPENSSL=1', @@ -1346,7 +1359,6 @@ 'dependencies': [ '<(node_lib_target_name)', - 'deps/nbytes/nbytes.gyp:nbytes', ], 'includes': [ @@ -1386,6 +1398,11 @@ 'deps/histogram/histogram.gyp:histogram', ], }], + [ 'node_shared_nbytes=="false"', { + 'dependencies': [ + 'deps/nbytes/nbytes.gyp:nbytes', + ], + }], ['OS=="win"', { 'libraries': [ 'Dbghelp.lib', @@ -1472,7 +1489,6 @@ 'dependencies': [ '<(node_lib_target_name)', - 'deps/nbytes/nbytes.gyp:nbytes', ], 'includes': [ @@ -1509,6 +1525,11 @@ 'deps/histogram/histogram.gyp:histogram', ], }], + [ 'node_shared_nbytes=="false"', { + 'dependencies': [ + 'deps/nbytes/nbytes.gyp:nbytes', + ], + }], [ 'node_use_openssl=="true"', { 'dependencies': [ 'deps/ncrypto/ncrypto.gyp:ncrypto', diff --git a/tools/nix/sharedLibDeps.nix b/tools/nix/sharedLibDeps.nix index 02f806e773c..57fb99a8b38 100644 --- a/tools/nix/sharedLibDeps.nix +++ b/tools/nix/sharedLibDeps.nix @@ -22,6 +22,16 @@ cares = pkgs.c-ares; hdr-histogram = pkgs.hdrhistogram_c; http-parser = pkgs.llhttp; + nbytes = pkgs.callPackage "${ + pkgs.fetchgit { + url = "https://github.com/NixOS/nixpkgs.git"; + rev = "3146c6aa9995e7351a398e17470e15305e6e18ff"; + sparseCheckout = [ + "/pkgs/by-name/nb/nbytes/" + ]; + hash = "sha256-8cbu4ftn5ke7vd4cniwxuyKl6FRxwdToBj77oyYmsfk="; + } + }/pkgs/by-name/nb/nbytes/package.nix" { }; } // (pkgs.lib.optionalAttrs withSQLite { inherit (pkgs) sqlite;