Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test-shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ jobs:
id: v8-drv
run: |
V8_DRV=$(
nix-instantiate -E "builtins.filter (p: p.pname == ''v8'') (import $TAR_DIR/tools/nix/ci-shell.nix {}).buildInputs"
nix-instantiate -E "(import $TAR_DIR/tools/nix/ci-shell.nix {}).v8Derivation"
)
V8_STORE_PATH=$(nix-store -q --outputs "$V8_DRV")
echo "V8_DRV=$V8_DRV" >> "$GITHUB_OUTPUT"
Expand Down
3 changes: 2 additions & 1 deletion benchmark/napi/make_callback/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
'targets': [
{
'target_name': 'binding',
'sources': [ 'binding.cc' ]
'sources': [ 'binding.cc' ],
'include_dirs': [ '<@(node_shared_libuv_include_dirs)' ],
}
]
}
6 changes: 6 additions & 0 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@
'node_module_version%': '',
'node_with_ltcg%': '',
'node_shared_openssl%': 'false',
'node_shared_openssl_include_dirs%': [],
'openssl_is_boringssl%': 'false',

'node_shared_libuv_include_dirs%': [],
'node_shared_sqlite%': 'false',
'node_shared_sqlite_include_dirs%': [],
'node_shared_zlib_include_dirs%': [],

'node_tag%': '',
'uv_library%': 'static_library',

Expand Down
21 changes: 14 additions & 7 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -2195,19 +2195,26 @@ def configure_napi(output):
version = getnapibuildversion.get_napi_version()
output['variables']['napi_build_version'] = version

def configure_library(lib, output, pkgname=None, libraries_key='libraries'):
def configure_library(lib, output, pkgname=None, libraries_key='libraries', with_separate_include_var=False):
shared_lib = 'shared_' + lib
output['variables']['node_' + shared_lib] = b(getattr(options, shared_lib))

libraries = output[libraries_key] if libraries_key in output else output['variables'][libraries_key]

include_dirs = []
if with_separate_include_var:
output['variables'][f'node_{shared_lib}_include_dirs'] = include_dirs

if getattr(options, shared_lib):
(pkg_libs, pkg_cflags, pkg_libpath, _) = pkg_config(pkgname or lib)

if options.__dict__[shared_lib + '_includes']:
output['include_dirs'] += [options.__dict__[shared_lib + '_includes']]
include_dirs += [options.__dict__[shared_lib + '_includes']]
elif pkg_cflags:
stripped_flags = [flag.strip() for flag in pkg_cflags.split('-I')]
output['include_dirs'] += [flag for flag in stripped_flags if flag]
include_dirs += [flag for flag in stripped_flags if flag]

output['include_dirs'] += include_dirs

# libpath needs to be provided ahead libraries
if options.__dict__[shared_lib + '_libpath']:
Expand Down Expand Up @@ -2376,7 +2383,7 @@ def without_ssl_error(option):
if options.openssl_is_fips and not options.shared_openssl:
variables['node_fipsinstall'] = b(True)

configure_library('openssl', o)
configure_library('openssl', o, with_separate_include_var=True)

o['variables']['openssl_version'] = get_openssl_version(o)
o['variables']['openssl_is_boringssl'] = get_openssl_is_boringssl(o)
Expand Down Expand Up @@ -2407,7 +2414,7 @@ def without_sqlite_error(option):
without_sqlite_error('--shared-sqlite')
return

configure_library('sqlite', o, pkgname='sqlite3')
configure_library('sqlite', o, pkgname='sqlite3', with_separate_include_var=True)

def bundled_ffi_supported(os_name, target_arch):
if target_arch == 'x86':
Expand Down Expand Up @@ -2893,9 +2900,9 @@ def make_bin_override():
configure_node_lib_files(output)
configure_node_cctest_sources(output)
configure_napi(output)
configure_library('zlib', output)
configure_library('zlib', output, with_separate_include_var=True)
configure_library('http_parser', output, pkgname='libllhttp')
configure_library('libuv', output)
configure_library('libuv', output, with_separate_include_var=True)
configure_library('abseil', output, pkgname=[
'absl_absl_check',
'absl_absl_log',
Expand Down
33 changes: 19 additions & 14 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,20 @@ let
]
++ builtins.map (depName: "--shared-${depName}") sharedV8Deps
++ pkgs.lib.optional withPerfetto "--with-perfetto";

v8Derivation =
if useSeparateDerivationForV8 == true then
let
sharedLibsToMock = pkgs.callPackage ./tools/nix/non-v8-deps-mock.nix { };
in
pkgs.callPackage ./tools/nix/v8.nix {
inherit nativeBuildInputs icu;

configureFlags = configureFlags ++ sharedLibsToMock.configureFlags ++ [ "--ninja" ];
buildInputs = buildInputs ++ [ sharedLibsToMock ];
}
else
useSeparateDerivationForV8;
in
pkgs.mkShell {
inherit nativeBuildInputs;
Expand All @@ -98,20 +112,7 @@ pkgs.mkShell {
buildInputs =
builtins.attrValues sharedLibDeps
++ buildInputs
++ pkgs.lib.optional (useSeparateDerivationForV8 != false) (
if useSeparateDerivationForV8 == true then
let
sharedLibsToMock = pkgs.callPackage ./tools/nix/non-v8-deps-mock.nix { };
in
pkgs.callPackage ./tools/nix/v8.nix {
inherit nativeBuildInputs icu;

configureFlags = configureFlags ++ sharedLibsToMock.configureFlags ++ [ "--ninja" ];
buildInputs = buildInputs ++ [ sharedLibsToMock ];
}
else
useSeparateDerivationForV8
);
++ pkgs.lib.optional (useSeparateDerivationForV8 != false) v8Derivation;

packages = devTools ++ benchmarkTools ++ pkgs.lib.optional (ccache != null) ccache;

Expand All @@ -120,6 +121,10 @@ pkgs.mkShell {
export CXX="${pkgs.lib.getExe ccache} $CXX"
'';

passthru = {
inherit v8Derivation;
};

env = {
BUILD_WITH = if (ninja != null) then "ninja" else "make";
NINJA = pkgs.lib.optionalString (ninja != null) "${pkgs.lib.getExe ninja}";
Expand Down
1 change: 1 addition & 0 deletions test/addons/async-cleanup-hook/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
'target_name': 'binding',
'sources': [ 'binding.cc' ],
'includes': ['../common.gypi'],
'include_dirs': [ '<@(node_shared_libuv_include_dirs)' ],
}
]
}
1 change: 1 addition & 0 deletions test/addons/async-hello-world/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
'target_name': 'binding',
'sources': [ 'binding.cc' ],
'includes': ['../common.gypi'],
'include_dirs': [ '<@(node_shared_libuv_include_dirs)' ],
}
]
}
1 change: 1 addition & 0 deletions test/addons/callback-scope/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
'target_name': 'binding',
'sources': [ 'binding.cc' ],
'includes': ['../common.gypi'],
'include_dirs': ['<@(node_shared_libuv_include_dirs)'],
}
]
}
1 change: 1 addition & 0 deletions test/addons/esm-export-default/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
'target_name': 'binding-export-default',
'sources': [ 'binding-export-default.cc' ],
'includes': ['../common.gypi'],
'include_dirs': [ '<@(node_shared_libuv_include_dirs)' ],
},
]
}
1 change: 1 addition & 0 deletions test/addons/esm-export-primitive/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
'target_name': 'binding-export-primitive',
'sources': [ 'binding-export-primitive.cc' ],
'includes': ['../common.gypi'],
'include_dirs': [ '<@(node_shared_libuv_include_dirs)' ],
},
]
}
1 change: 1 addition & 0 deletions test/addons/esm/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
'target_name': 'binding',
'sources': [ 'binding.cc' ],
'includes': ['../common.gypi'],
'include_dirs': [ '<@(node_shared_libuv_include_dirs)' ],
},
{
'target_name': 'node_modules',
Expand Down
1 change: 1 addition & 0 deletions test/addons/hello-world-2/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
'target_name': 'binding',
'sources': [ 'binding.cc' ],
'includes': ['../common.gypi'],
'include_dirs': [ '<@(node_shared_libuv_include_dirs)' ],
},
]
}
3 changes: 1 addition & 2 deletions test/addons/openssl-binding/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
'includes': ['../common.gypi'],
'conditions': [
['node_use_openssl=="true"', {
'include_dirs': ['<@(node_shared_openssl_include_dirs)'],
'conditions': [
['OS in "aix os400"', {
'variables': {
Expand All @@ -17,12 +18,10 @@
}],
[ '"<(aix_variant_name)"!="OS400"', { # Not `OS400`(IBM i)
'sources': ['binding.cc'],
'include_dirs': ['../../../deps/openssl/openssl/include'],
}],
],
}, {
'sources': ['binding.cc'],
'include_dirs': ['../../../deps/openssl/openssl/include'],
}],
],
}],
Expand Down
3 changes: 1 addition & 2 deletions test/addons/openssl-get-ssl-ctx/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
'includes': ['../common.gypi'],
'conditions': [
['node_use_openssl=="true"', {
'include_dirs': ['<@(node_shared_openssl_include_dirs)'],
'conditions': [
['OS in "aix os400"', {
'variables': {
Expand All @@ -17,12 +18,10 @@
}],
[ '"<(aix_variant_name)"!="OS400"', { # Not `OS400`(IBM i)
'sources': ['binding.cc'],
'include_dirs': ['../../../deps/openssl/openssl/include'],
}],
],
}, {
'sources': ['binding.cc'],
'include_dirs': ['../../../deps/openssl/openssl/include'],
}],
],
}],
Expand Down
3 changes: 1 addition & 2 deletions test/addons/openssl-providers/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
'includes': ['../common.gypi'],
'conditions': [
['node_use_openssl=="true"', {
'include_dirs': ['<@(node_shared_openssl_include_dirs)'],
'conditions': [
['OS in "aix os400"', {
'variables': {
Expand All @@ -17,12 +18,10 @@
}],
[ '"<(aix_variant_name)"!="OS400"', { # Not `OS400`(IBM i)
'sources': ['binding.cc'],
'include_dirs': ['../../../deps/openssl/openssl/include'],
}],
],
}, {
'sources': ['binding.cc'],
'include_dirs': ['../../../deps/openssl/openssl/include'],
}],
],
}],
Expand Down
1 change: 1 addition & 0 deletions test/addons/register-signal-handler/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
'target_name': 'binding',
'sources': [ 'binding.cc' ],
'includes': ['../common.gypi'],
'include_dirs': [ '<@(node_shared_libuv_include_dirs)' ],
}
]
}
1 change: 1 addition & 0 deletions test/addons/uv-handle-leak/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
'target_name': 'binding',
'sources': [ 'binding.cc' ],
'includes': ['../common.gypi'],
'include_dirs': [ '<@(node_shared_libuv_include_dirs)' ],
}
]
}
1 change: 1 addition & 0 deletions test/addons/uv-thread-name/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
'target_name': 'binding',
'sources': [ 'binding.cc' ],
'includes': ['../common.gypi'],
'include_dirs': [ '<@(node_shared_libuv_include_dirs)' ],
}
]
}
1 change: 1 addition & 0 deletions test/addons/worker-addon/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
'target_name': 'binding',
'sources': [ 'binding.cc' ],
'includes': ['../common.gypi'],
'include_dirs': [ '<@(node_shared_libuv_include_dirs)' ],
}
]
}
3 changes: 1 addition & 2 deletions test/addons/zlib-binding/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@
}],
[ '"<(aix_variant_name)"!="OS400"', { # Not `OS400`(IBM i)
'sources': ['binding.cc'],
'include_dirs': ['../../../deps/zlib'],
}],
],
}, {
'sources': ['binding.cc'],
'include_dirs': ['../../../deps/zlib'],
}],
],
'includes': ['../common.gypi'],
'include_dirs': ['<@(node_shared_zlib_include_dirs)'],
},
]
}
3 changes: 2 additions & 1 deletion test/node-api/test_async/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"targets": [
{
"target_name": "test_async",
"sources": [ "test_async.c" ]
"sources": [ "test_async.c" ],
"include_dirs": [ "<@(node_shared_libuv_include_dirs)" ],
}
]
}
3 changes: 2 additions & 1 deletion test/node-api/test_async_cleanup_hook/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
{
'target_name': 'binding',
'defines': [ 'V8_DEPRECATION_WARNINGS=1' ],
'sources': [ 'binding.c' ]
'sources': [ 'binding.c' ],
'include_dirs': [ '<@(node_shared_libuv_include_dirs)' ],
}
]
}
3 changes: 2 additions & 1 deletion test/node-api/test_callback_scope/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
{
'target_name': 'binding',
'defines': [ 'V8_DEPRECATION_WARNINGS=1' ],
'sources': [ 'binding.c' ]
'sources': [ 'binding.c' ],
'include_dirs': [ '<@(node_shared_libuv_include_dirs)' ],
}
]
}
3 changes: 2 additions & 1 deletion test/node-api/test_cleanup_hook/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
{
'target_name': 'binding',
'defines': [ 'V8_DEPRECATION_WARNINGS=1' ],
'sources': [ 'binding.c' ]
'sources': [ 'binding.c' ],
'include_dirs': [ '<@(node_shared_libuv_include_dirs)' ],
}
]
}
3 changes: 2 additions & 1 deletion test/node-api/test_fatal/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"targets": [
{
"target_name": "test_fatal",
"sources": [ "test_fatal.c" ]
"sources": [ "test_fatal.c" ],
"include_dirs": [ "<@(node_shared_libuv_include_dirs)" ],
}
]
}
3 changes: 2 additions & 1 deletion test/node-api/test_instance_data/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"target_name": "test_instance_data",
"sources": [
"test_instance_data.c"
]
],
"include_dirs": [ "<@(node_shared_libuv_include_dirs)" ],
},
{
"target_name": "test_set_then_ref",
Expand Down
3 changes: 2 additions & 1 deletion test/node-api/test_threadsafe_function/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
'targets': [
{
'target_name': 'binding',
'sources': ['binding.c']
'sources': ['binding.c'],
'include_dirs': ['<@(node_shared_libuv_include_dirs)'],
},
{
'target_name': 'test_uncaught_exception_v9',
Expand Down
3 changes: 2 additions & 1 deletion test/node-api/test_uv_loop/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"targets": [
{
"target_name": "test_uv_loop",
"sources": [ "test_uv_loop.cc" ]
"sources": [ "test_uv_loop.cc" ],
"include_dirs": [ "<@(node_shared_libuv_include_dirs)" ],
}
]
}
Loading
Loading