Skip to content

Commit c73ad6b

Browse files
committed
build: add --shared-lief configure flag
1 parent d14b484 commit c73ad6b

File tree

6 files changed

+45
-2
lines changed

6 files changed

+45
-2
lines changed

.github/workflows/test-shared.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ jobs:
198198
--arg ccache '(import <nixpkgs> {}).sccache' \
199199
--arg devTools '[]' \
200200
--arg benchmarkTools '[]' \
201-
${{ endsWith(matrix.system, '-darwin') && '--arg withAmaro false --arg withSQLite false --arg extraConfigFlags ''["--without-inspector" "--without-node-options"]'' \' || '\' }}
201+
${{ endsWith(matrix.system, '-darwin') && '--arg withAmaro false --arg withLief false --arg withSQLite false --arg extraConfigFlags ''["--without-inspector" "--without-node-options"]'' \' || '\' }}
202202
--run '
203203
make -C "$TAR_DIR" run-ci -j4 V=1 TEST_CI_ARGS="-p actions --measure-flakiness 9 --skip-tests=$CI_SKIP_TESTS"
204204
'

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,7 @@ ifeq ($(SKIP_SHARED_DEPS), 1)
12391239
$(RM) -r $(TARNAME)/deps/histogram
12401240
$(RM) -r $(TARNAME)/deps/icu-small
12411241
$(RM) -r $(TARNAME)/deps/icu-tmp
1242+
$(RM) -r $(TARNAME)/deps/LIEF
12421243
$(RM) -r $(TARNAME)/deps/llhttp
12431244
$(RM) -r $(TARNAME)/deps/nbytes
12441245
$(RM) -r $(TARNAME)/deps/nghttp2

configure.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,28 @@
357357
dest='shared_libuv_libpath',
358358
help='a directory to search for the shared libuv DLL')
359359

360+
shared_optgroup.add_argument('--shared-lief',
361+
action='store_true',
362+
dest='shared_lief',
363+
default=None,
364+
help='link to a shared lief DLL instead of static linking')
365+
366+
shared_optgroup.add_argument('--shared-lief-includes',
367+
action='store',
368+
dest='shared_lief_includes',
369+
help='directory containing lief header files')
370+
371+
shared_optgroup.add_argument('--shared-lief-libname',
372+
action='store',
373+
dest='shared_lief_libname',
374+
default='LIEF',
375+
help='alternative lib name to link to [default: %(default)s]')
376+
377+
shared_optgroup.add_argument('--shared-lief-libpath',
378+
action='store',
379+
dest='shared_lief_libpath',
380+
help='a directory to search for the shared lief DLL')
381+
360382
shared_optgroup.add_argument('--shared-nbytes',
361383
action='store_true',
362384
dest='shared_nbytes',
@@ -2101,6 +2123,14 @@ def without_ssl_error(option):
21012123

21022124
o['variables']['openssl_version'] = get_openssl_version(o)
21032125

2126+
def configure_lief(o):
2127+
if options.without_lief:
2128+
if options.shared_lief:
2129+
error(f'--without-lief is incompatible with --shared-lief')
2130+
return
2131+
2132+
configure_library('lief', o, pkgname='LIEF')
2133+
21042134
def configure_sqlite(o):
21052135
o['variables']['node_use_sqlite'] = b(not options.without_sqlite)
21062136
if options.without_sqlite:
@@ -2562,6 +2592,7 @@ def make_bin_override():
25622592
configure_library('nghttp2', output, pkgname='libnghttp2')
25632593
configure_library('nghttp3', output, pkgname='libnghttp3')
25642594
configure_library('ngtcp2', output, pkgname='libngtcp2')
2595+
configure_lief(output);
25652596
configure_sqlite(output);
25662597
configure_library('temporal_capi', output)
25672598
configure_library('uvwasi', output)

node.gyp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
'node_shared_hdr_histogram%': 'false',
1919
'node_shared_http_parser%': 'false',
2020
'node_shared_libuv%': 'false',
21+
'node_shared_lief%': 'false',
2122
'node_shared_nbytes%': 'false',
2223
'node_shared_nghttp2%': 'false',
2324
'node_shared_openssl%': 'false',
@@ -1000,10 +1001,13 @@
10001001
'deps/ncrypto/ncrypto.gyp:ncrypto',
10011002
],
10021003
}],
1003-
[ 'node_use_lief=="true"', {
1004+
[ 'node_use_lief=="true" and node_shared_lief=="false"', {
10041005
'defines': [ 'HAVE_LIEF=1' ],
10051006
'dependencies': [ 'deps/LIEF/lief.gyp:liblief' ],
10061007
}],
1008+
[ 'node_use_lief=="true" and node_shared_lief=="true"', {
1009+
'defines': [ 'HAVE_LIEF=1' ],
1010+
}],
10071011
[ 'node_use_sqlite=="true"', {
10081012
'sources': [
10091013
'<@(node_sqlite_sources)',

shell.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
# Build options
1313
icu ? pkgs.icu,
1414
withAmaro ? true,
15+
withLief ? true,
1516
withSQLite ? true,
1617
withSSL ? true,
1718
withTemporal ? false,
1819
sharedLibDeps ? import ./tools/nix/sharedLibDeps.nix {
1920
inherit
2021
pkgs
22+
withLief
2123
withSQLite
2224
withSSL
2325
withTemporal
@@ -80,6 +82,7 @@ pkgs.mkShell {
8082
]
8183
++ extraConfigFlags
8284
++ pkgs.lib.optional (!withAmaro) "--without-amaro"
85+
++ pkgs.lib.optional (!withLief) "--without-lief"
8386
++ pkgs.lib.optional (!withSQLite) "--without-sqlite"
8487
++ pkgs.lib.optional (!withSSL) "--without-ssl"
8588
++ pkgs.lib.optional withTemporal "--v8-enable-temporal-support"

tools/nix/sharedLibDeps.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
pkgs ? import ./pkgs.nix { },
3+
withLief ? true,
34
withSQLite ? true,
45
withSSL ? true,
56
withTemporal ? false,
@@ -33,6 +34,9 @@
3334
];
3435
};
3536
}
37+
// (pkgs.lib.optionalAttrs withLief {
38+
inherit (pkgs) lief;
39+
})
3640
// (pkgs.lib.optionalAttrs withSQLite {
3741
inherit (pkgs) sqlite;
3842
})

0 commit comments

Comments
 (0)