Skip to content
Merged
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
4 changes: 4 additions & 0 deletions .github/workflows/test-shared.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,6 +33,8 @@ on:
- deps/sqlite/**
- deps/uv/**
- deps/uvwasi/**
- deps/v8/third_party/abseil-cpp/**
- deps/v8/third_party/highway/**
- deps/zlib/**
- deps/zstd/**
- doc/**
Expand DownExpand Up@@ -86,6 +88,8 @@ on:
- deps/sqlite/**
- deps/uv/**
- deps/uvwasi/**
- deps/v8/third_party/abseil-cpp/**
- deps/v8/third_party/highway/**
- deps/zlib/**
- deps/zstd/**
- doc/**
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line numberDiff line numberDiff line change
Expand Up@@ -1322,6 +1322,8 @@ ifeq ($(SKIP_SHARED_DEPS), 1)
$(RM) -r $(TARNAME)/deps/sqlite
$(RM) -r $(TARNAME)/deps/uv
$(RM) -r $(TARNAME)/deps/uvwasi
$(RM) -r $(TARNAME)/deps/v8/third_party/abseil-cpp
$(RM) -r $(TARNAME)/deps/v8/third_party/highway
$(RM) -r $(TARNAME)/deps/zlib
$(RM) -r $(TARNAME)/deps/zstd
else
Expand Down
110 changes: 110 additions & 0 deletions configure.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -282,6 +282,28 @@
help='Use the specified path to system CA (PEM format) in addition to '
'the OpenSSL supplied CA store or compiled-in Mozilla CA copy.')

shared_optgroup.add_argument('--shared-abseil',
action='store_true',
dest='shared_abseil',
default=None,
help='link to a shared Abseil DLL instead of static linking')

shared_optgroup.add_argument('--shared-abseil-includes',
action='store',
dest='shared_abseil_includes',
help='directory containing Abseil header files')

shared_optgroup.add_argument('--shared-abseil-libname',
action='store',
dest='shared_abseil_libname',
default=None,
help='alternative lib name to link to [default: %(default)s]')

shared_optgroup.add_argument('--shared-abseil-libpath',
action='store',
dest='shared_abseil_libpath',
help='a directory to search for the shared Abseil DLL')

shared_optgroup.add_argument('--shared-gtest',
action='store_true',
dest='shared_gtest',
Expand DownExpand Up@@ -326,6 +348,28 @@
dest='shared_hdr_histogram_libpath',
help='a directory to search for the shared HdrHistogram DLL')

shared_optgroup.add_argument('--shared-highway',
action='store_true',
dest='shared_highway',
default=None,
help='link to a shared Highway (hwy) DLL instead of static linking')

shared_optgroup.add_argument('--shared-highway-includes',
action='store',
dest='shared_highway_includes',
help='directory containing Highway header files')

shared_optgroup.add_argument('--shared-highway-libname',
action='store',
dest='shared_highway_libname',
default='hwy',
help='alternative lib name to link to [default: %(default)s]')

shared_optgroup.add_argument('--shared-highway-libpath',
action='store',
dest='shared_highway_libpath',
help='a directory to search for the shared Highway DLL')

shared_optgroup.add_argument('--shared-http-parser',
action='store_true',
dest='shared_http_parser',
Expand DownExpand Up@@ -2814,13 +2858,79 @@ def make_bin_override():
configure_library('zlib', output)
configure_library('http_parser', output, pkgname='libllhttp')
configure_library('libuv', output)
configure_library('abseil', output, pkgname=[
'absl_absl_check',
'absl_absl_log',
'absl_absl_vlog_is_on',
'absl_algorithm_container',
'absl_algorithm',
'absl_any_invocable',
'absl_base',
'absl_bind_front',
'absl_bits',
'absl_btree',
'absl_charset',
'absl_cleanup',
'absl_config',
'absl_cord',
'absl_core_headers',
'absl_die_if_null',
'absl_dynamic_annotations',
'absl_failure_signal_handler',
'absl_fast_type_id',
'absl_fixed_array',
'absl_flat_hash_map',
'absl_flat_hash_set',
'absl_function_ref',
'absl_has_ostream_operator',
'absl_hash_container_defaults',
'absl_hash',
'absl_inlined_vector',
'absl_int128',
'absl_layout',
'absl_leak_check',
'absl_linked_hash_map',
'absl_linked_hash_set',
'absl_log_entry',
'absl_log_globals',
'absl_log_initialize',
'absl_log_severity',
'absl_log_sink_registry',
'absl_log_sink',
'absl_memory',
'absl_no_destructor',
'absl_node_hash_map',
'absl_node_hash_set',
'absl_nullability',
'absl_optional',
'absl_overload',
'absl_prefetch',
'absl_random_bit_gen_ref',
'absl_random_distributions',
'absl_random_random',
'absl_raw_logging_internal',
'absl_span',
'absl_stacktrace',
'absl_status',
'absl_statusor',
'absl_str_format',
'absl_string_view',
'absl_strings',
'absl_symbolize',
'absl_synchronization',
'absl_time',
'absl_type_traits',
'absl_utility',
'absl_variant',
])
configure_library('ada', output)
configure_library('simdjson', output)
configure_library('simdutf', output)
configure_library('brotli', output, pkgname=['libbrotlidec', 'libbrotlienc'])
configure_library('cares', output, pkgname='libcares')
configure_library('gtest', output)
configure_library('hdr_histogram', output)
configure_library('highway', output, pkgname='libhwy')
configure_library('merve', output)
configure_library('nbytes', output)
configure_library('nghttp2', output, pkgname='libnghttp2')
Expand Down
6 changes: 4 additions & 2 deletions node.gyp
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,10 +15,12 @@
'node_lib_target_name%': 'libnode',
'node_module_version%': '',
'node_no_browser_globals%': 'false',
'node_shared_abseil%': 'false',
'node_shared_brotli%': 'false',
'node_shared_cares%': 'false',
'node_shared_gtest%': 'false',
'node_shared_hdr_histogram%': 'false',
'node_shared_highway%': 'false',
'node_shared_http_parser%': 'false',
'node_shared_libuv%': 'false',
'node_shared_lief%': 'false',
Expand DownExpand Up@@ -901,7 +903,7 @@
[ 'node_builtin_modules_path!=""', {
'defines': [ 'NODE_BUILTIN_MODULES_PATH="<(node_builtin_modules_path)"' ],
}],
[ 'node_use_bundled_v8!="false"', {
[ 'node_use_bundled_v8!="false" and node_shared_abseil=="false"', {
'dependencies': [ 'tools/v8_gypfiles/abseil.gyp:abseil' ],
}],
[ 'node_shared_gtest=="false"', {
Expand DownExpand Up@@ -1369,7 +1371,7 @@
[ 'node_shared_gtest=="true"', {
'libraries': [ '-lgtest_main' ],
}],
[ 'node_use_bundled_v8!="false"', {
[ 'node_use_bundled_v8!="false" and node_shared_abseil=="false"', {
'dependencies': [ 'tools/v8_gypfiles/abseil.gyp:abseil' ],
}],
[ 'node_shared_hdr_histogram=="false"', {
Expand Down
6 changes: 6 additions & 0 deletions shell.nix
Original file line numberDiff line numberDiff line change
Expand Up@@ -63,6 +63,8 @@ let
];
buildInputs =
pkgs.lib.optional useSharedICU icu
++ pkgs.lib.optional (builtins.hasAttr "abseil" sharedLibDeps) sharedLibDeps.abseil
++ pkgs.lib.optional (builtins.hasAttr "highway" sharedLibDeps) sharedLibDeps.highway
++ pkgs.lib.optional (withTemporal && useSharedTemporal) sharedLibDeps.temporal_capi;

# Put here only the configure flags that affect the V8 build
Expand All@@ -75,6 +77,8 @@ let
)
"--v8-${if withTemporal then "enable" else "disable"}-temporal-support"
]
++ pkgs.lib.optional (builtins.hasAttr "abseil" sharedLibDeps) "--shared-abseil"
++ pkgs.lib.optional (builtins.hasAttr "highway" sharedLibDeps) "--shared-highway"
++ pkgs.lib.optional (withTemporal && useSharedTemporal) "--shared-temporal_capi"
++ pkgs.lib.optional withPerfetto "--with-perfetto";
in
Expand DownExpand Up@@ -132,6 +136,8 @@ pkgs.mkShell {
builtins.attrNames (
if (useSeparateDerivationForV8 != false) then
builtins.removeAttrs sharedLibDeps [
"abseil"
"highway"
"simdutf"
"temporal_capi"
]
Expand Down
2 changes: 2 additions & 0 deletions tools/nix/sharedLibDeps.nix
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,8 +22,10 @@
zlib
zstd
;
abseil = pkgs.abseil-cpp;
cares = pkgs.c-ares;
hdr-histogram = pkgs.hdrhistogram_c;
highway = pkgs.libhwy;
http-parser = pkgs.llhttp;
}
// (pkgs.lib.optionalAttrs withLief {
Expand Down
29 changes: 19 additions & 10 deletions tools/nix/v8.nix
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,6 +23,8 @@
}:

let
useSharedAbseil = builtins.elem "--shared-abseil" configureFlags;
useSharedHighway = builtins.elem "--shared-highway" configureFlags;
src =
let
inherit (lib) fileset;
Expand All@@ -35,7 +37,6 @@ let
../../node.gypi
../../tools/gyp/pylib
../../tools/gyp_node.py
../../tools/v8_gypfiles/abseil.gyp
../../tools/v8_gypfiles/features.gypi
../../tools/v8_gypfiles/ForEachFormat.py
../../tools/v8_gypfiles/ForEachReplace.py
Expand All@@ -44,6 +45,8 @@ let
../../tools/v8_gypfiles/toolchain.gypi
../../tools/v8_gypfiles/v8.gyp
]
++ lib.optional (!useSharedAbseil) ../../tools/v8_gypfiles/abseil.gyp
++ lib.optional (!useSharedHighway) ../../tools/v8_gypfiles/highway.gyp
++ lib.optionals (builtins.elem "--with-perfetto" configureFlags) [
../../deps/perfetto
]
Expand All@@ -63,12 +66,16 @@ let
potentiallyAlreadyRemovedFiles =
# Files that are removed in the release tarball (see Makefile $(TARBALL) target)
[ (fileset.difference ../../deps/v8/test ../../deps/v8/test/torque) ]
++ (builtins.filter builtins.pathExists [
../../deps/v8/samples
../../deps/v8/tools/profviz
../../deps/v8/tools/run-tests.py
../../deps/v8/third_party/ittapi
]);
++ (builtins.filter builtins.pathExists (
[
../../deps/v8/samples
../../deps/v8/tools/profviz
../../deps/v8/tools/run-tests.py
../../deps/v8/third_party/ittapi
]
++ lib.optional useSharedAbseil ../../deps/v8/third_party/abseil-cpp
++ lib.optional useSharedHighway ../../deps/v8/third_party/highway
));
trackedFiles =
({
# This line is being modified by Makefile $(TARBALL) target, any change to it should be sync
Expand DownExpand Up@@ -197,9 +204,11 @@ stdenv.mkDerivation (finalAttrs: {
find deps/v8/include -name '*.h' -print0 | while read -r -d "" file; do
install -Dm644 "$file" -T "$out/include/''${file#deps/v8/include/}"
done
find deps/v8/third_party/abseil-cpp/absl -name '*.h' -print0 | while read -r -d "" file; do
install -Dm644 "$file" -T "$out/include/''${file#deps/v8/third_party/abseil-cpp/}"
done
${lib.optionalString (!useSharedAbseil) ''
find deps/v8/third_party/abseil-cpp/absl -name '*.h' -print0 | while read -r -d "" file; do
install -Dm644 "$file" -T "$out/include/''${file#deps/v8/third_party/abseil-cpp/}"
done
''}

mkdir -p $out/lib/pkgconfig
cat -> $out/lib/pkgconfig/v8.pc << EOF
Expand Down
4 changes: 3 additions & 1 deletion tools/v8_gypfiles/d8.gyp
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,7 +16,6 @@
'target_name': 'd8',
'type': 'executable',
'dependencies': [
'abseil.gyp:abseil',
'v8.gyp:v8',
'v8.gyp:v8_libbase',
'v8.gyp:v8_libplatform',
Expand DownExpand Up@@ -77,6 +76,9 @@
},
},
}],
['node_shared_abseil=="false"', {
'dependencies': ['abseil.gyp:abseil'],
}],
],
},
],
Expand Down
58 changes: 58 additions & 0 deletions tools/v8_gypfiles/highway.gyp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
{
'includes': ['toolchain.gypi'],
'targets': [
{
'target_name': 'highway',
'type': 'static_library',
'toolsets': ['host', 'target'],
'variables': {
'HIGHWAY_ROOT': '../../deps/v8/third_party/highway',
},
'all_dependent_settings': {
'include_dirs': [
'<(HIGHWAY_ROOT)/src',
],
'conditions': [
['v8_target_arch=="ia32"', {
'defines': ['HWY_BROKEN_TARGETS=(HWY_AVX2|HWY_AVX3)',],
}],
['v8_target_arch=="arm64"', {
'defines': ['HWY_BROKEN_TARGETS=HWY_ALL_SVE',],
}],
['v8_target_arch=="ppc64" or v8_target_arch=="s390x"', {
'defines': ['TOOLCHAIN_MISS_ASM_HWCAP_H',],
}],
['v8_target_arch=="s390x"', {
'defines': ['HWY_BROKEN_EMU128=0',],
}],
['OS in "aix os400"', {
'defines': ['HWY_BROKEN_EMU128=0',],
}],
['v8_target_arch=="arm" and arm_version==7', {
'defines': ['HWY_BROKEN_EMU128=0',],
}],
],
},
'include_dirs': [
'<(HIGHWAY_ROOT)/src',
],
'conditions': [
['v8_target_arch=="ia32"', {
'defines': ['HWY_BROKEN_TARGETS=(HWY_AVX2|HWY_AVX3)',],
}],
['v8_target_arch=="arm64"', {
'defines': ['HWY_BROKEN_TARGETS=HWY_ALL_SVE',],
}],
['v8_target_arch=="ppc64" or v8_target_arch=="s390x"', {
'defines': ['TOOLCHAIN_MISS_ASM_HWCAP_H',],
}],
['v8_target_arch=="riscv64"', {
'defines': ['HWY_BROKEN_TARGETS=HWY_RVV',],
}],
],
'sources': [
'<!@pymod_do_main(GN-scraper "<(HIGHWAY_ROOT)/BUILD.gn" "source_set.\\"libhwy.*?sources = ")',
],
}, # highway
],
}
Loading
Loading