build: add --shared-lief configure flag

PR-URL: https://github.com/nodejs/node/pull/61536
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
Antoine du Hamel committed 2026-02-02 14:20:46 +01:00
1 parent 4a2e184753
commit b2fb82946b
6 files changed
+48 -2

No files matched your search

+1 -1
View File
@@ -198,7 +198,7 @@ jobs:
--arg ccache '(import <nixpkgs> {}).sccache' \
--arg devTools '[]' \
--arg benchmarkTools '[]' \
${{ endsWith(matrix.system, '-darwin') && '--arg withAmaro false --arg withSQLite false --arg extraConfigFlags ''["--without-inspector" "--without-node-options"]'' \' || '\' }}
${{ endsWith(matrix.system, '-darwin') && '--arg withAmaro false --arg withLief false --arg withSQLite false --arg extraConfigFlags ''["--without-inspector" "--without-node-options"]'' \' || '\' }}
--run '
make -C "$TAR_DIR" run-ci -j4 V=1 TEST_CI_ARGS="-p actions --measure-flakiness 9 --skip-tests=$CI_SKIP_TESTS"
'
+1
View File
@@ -1239,6 +1239,7 @@ ifeq ($(SKIP_SHARED_DEPS), 1)
$(RM) -r $(TARNAME)/deps/histogram
$(RM) -r $(TARNAME)/deps/icu-small
$(RM) -r $(TARNAME)/deps/icu-tmp
$(RM) -r $(TARNAME)/deps/LIEF
$(RM) -r $(TARNAME)/deps/llhttp
$(RM) -r $(TARNAME)/deps/nbytes
$(RM) -r $(TARNAME)/deps/nghttp2
+31
View File
@@ -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-lief',
action='store_true',
dest='shared_lief',
default=None,
help='link to a shared lief DLL instead of static linking')
shared_optgroup.add_argument('--shared-lief-includes',
action='store',
dest='shared_lief_includes',
help='directory containing lief header files')
shared_optgroup.add_argument('--shared-lief-libname',
action='store',
dest='shared_lief_libname',
default='LIEF',
help='alternative lib name to link to [default: %(default)s]')
shared_optgroup.add_argument('--shared-lief-libpath',
action='store',
dest='shared_lief_libpath',
help='a directory to search for the shared lief DLL')
shared_optgroup.add_argument('--shared-nbytes',
action='store_true',
dest='shared_nbytes',
@@ -2038,6 +2060,14 @@ def configure_openssl(o):
o['variables']['openssl_version'] = get_openssl_version(o)
def configure_lief(o):
if options.without_lief:
if options.shared_lief:
error('--without-lief is incompatible with --shared-lief')
return
configure_library('lief', o, pkgname='LIEF')
def configure_sqlite(o):
o['variables']['node_use_sqlite'] = b(not options.without_sqlite)
if options.without_sqlite:
@@ -2499,6 +2529,7 @@ configure_library('nbytes', output)
configure_library('nghttp2', output, pkgname='libnghttp2')
configure_library('nghttp3', output, pkgname='libnghttp3')
configure_library('ngtcp2', output, pkgname='libngtcp2')
configure_lief(output);
configure_sqlite(output);
configure_library('temporal_capi', output)
configure_library('uvwasi', output)
+5 -1
View File
@@ -18,6 +18,7 @@
'node_shared_hdr_histogram%': 'false',
'node_shared_http_parser%': 'false',
'node_shared_libuv%': 'false',
'node_shared_lief%': 'false',
'node_shared_nbytes%': 'false',
'node_shared_nghttp2%': 'false',
'node_shared_openssl%': 'false',
@@ -1000,10 +1001,13 @@
'deps/ncrypto/ncrypto.gyp:ncrypto',
],
}],
[ 'node_use_lief=="true"', {
[ 'node_use_lief=="true" and node_shared_lief=="false"', {
'defines': [ 'HAVE_LIEF=1' ],
'dependencies': [ 'deps/LIEF/lief.gyp:liblief' ],
}],
[ 'node_use_lief=="true" and node_shared_lief=="true"', {
'defines': [ 'HAVE_LIEF=1' ],
}],
[ 'node_use_sqlite=="true"', {
'sources': [
'<@(node_sqlite_sources)',
+3
View File
@@ -12,6 +12,7 @@
# Build options
icu ? pkgs.icu,
withAmaro ? true,
withLief ? true,
withQuic ? false,
withSQLite ? true,
withSSL ? true,
@@ -19,6 +20,7 @@
sharedLibDeps ? import ./tools/nix/sharedLibDeps.nix {
inherit
pkgs
withLief
withQuic
withSQLite
withSSL
@@ -82,6 +84,7 @@ pkgs.mkShell {
]
++ extraConfigFlags
++ pkgs.lib.optional (!withAmaro) "--without-amaro"
++ pkgs.lib.optional (!withLief) "--without-lief"
++ pkgs.lib.optional withQuic "--experimental-quic"
++ pkgs.lib.optional (!withSQLite) "--without-sqlite"
++ pkgs.lib.optional (!withSSL) "--without-ssl"
+7
View File
@@ -1,5 +1,6 @@
{
pkgs ? import ./pkgs.nix { },
withLief ? true,
withQuic ? false,
withSQLite ? true,
withSSL ? true,
@@ -32,6 +33,12 @@
}
}/pkgs/by-name/nb/nbytes/package.nix" { };
}
// (pkgs.lib.optionalAttrs withLief {
lief = pkgs.callPackage (builtins.fetchurl {
url = "https://github.com/NixOS/nixpkgs/raw/8368442cb2c52e6b7badf0467b454c461ffc981f/pkgs/by-name/li/lief/package.nix";
sha256 = "0isxv5rw7m1x10k06rgwimmcbl6a1w18v8k6dqp60jr4i66lac08";
}) { };
})
// (pkgs.lib.optionalAttrs withQuic {
inherit (pkgs)
nghttp3