Skip to content

Commit 23438cb

Browse files
committed
build: add --shared-highway configure flag
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent c4336d9 commit 23438cb

8 files changed

Lines changed: 74 additions & 37 deletions

File tree

.github/workflows/test-shared.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ on:
3333
- deps/sqlite/**
3434
- deps/uv/**
3535
- deps/uvwasi/**
36+
- deps/v8/third_party/highway/**
3637
- deps/zlib/**
3738
- deps/zstd/**
3839
- doc/**
@@ -86,6 +87,7 @@ on:
8687
- deps/sqlite/**
8788
- deps/uv/**
8889
- deps/uvwasi/**
90+
- deps/v8/third_party/highway/**
8991
- deps/zlib/**
9092
- deps/zstd/**
9193
- doc/**

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,6 +1316,7 @@ ifeq ($(SKIP_SHARED_DEPS), 1)
13161316
$(RM) -r $(TARNAME)/deps/sqlite
13171317
$(RM) -r $(TARNAME)/deps/uv
13181318
$(RM) -r $(TARNAME)/deps/uvwasi
1319+
$(RM) -r $(TARNAME)/deps/v8/third_party/highway
13191320
$(RM) -r $(TARNAME)/deps/zlib
13201321
$(RM) -r $(TARNAME)/deps/zstd
13211322
else

configure.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,28 @@
326326
dest='shared_hdr_histogram_libpath',
327327
help='a directory to search for the shared HdrHistogram DLL')
328328

329+
shared_optgroup.add_argument('--shared-highway',
330+
action='store_true',
331+
dest='shared_highway',
332+
default=None,
333+
help='link to a shared Highway (hwy) DLL instead of static linking')
334+
335+
shared_optgroup.add_argument('--shared-highway-includes',
336+
action='store',
337+
dest='shared_highway_includes',
338+
help='directory containing Highway header files')
339+
340+
shared_optgroup.add_argument('--shared-highway-libname',
341+
action='store',
342+
dest='shared_highway_libname',
343+
default='hwy',
344+
help='alternative lib name to link to [default: %(default)s]')
345+
346+
shared_optgroup.add_argument('--shared-highway-libpath',
347+
action='store',
348+
dest='shared_highway_libpath',
349+
help='a directory to search for the shared Highway DLL')
350+
329351
shared_optgroup.add_argument('--shared-http-parser',
330352
action='store_true',
331353
dest='shared_http_parser',
@@ -2821,6 +2843,7 @@ def make_bin_override():
28212843
configure_library('cares', output, pkgname='libcares')
28222844
configure_library('gtest', output)
28232845
configure_library('hdr_histogram', output)
2846+
configure_library('highway', output, pkgname='libhwy')
28242847
configure_library('merve', output)
28252848
configure_library('nbytes', output)
28262849
configure_library('nghttp2', output, pkgname='libnghttp2')

node.gyp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
'node_shared_cares%': 'false',
2020
'node_shared_gtest%': 'false',
2121
'node_shared_hdr_histogram%': 'false',
22+
'node_shared_highway%': 'false',
2223
'node_shared_http_parser%': 'false',
2324
'node_shared_libuv%': 'false',
2425
'node_shared_lief%': 'false',

shell.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ let
6363
];
6464
buildInputs =
6565
pkgs.lib.optional useSharedICU icu
66+
++ pkgs.lib.optional (builtins.hasAttr "highway" sharedLibDeps) sharedLibDeps.highway
6667
++ pkgs.lib.optional (withTemporal && useSharedTemporal) sharedLibDeps.temporal_capi;
6768

6869
# Put here only the configure flags that affect the V8 build
@@ -75,6 +76,7 @@ let
7576
)
7677
"--v8-${if withTemporal then "enable" else "disable"}-temporal-support"
7778
]
79+
++ pkgs.lib.optional (builtins.hasAttr "highway" sharedLibDeps) "--shared-highway"
7880
++ pkgs.lib.optional (withTemporal && useSharedTemporal) "--shared-temporal_capi"
7981
++ pkgs.lib.optional withPerfetto "--with-perfetto";
8082
in
@@ -132,6 +134,7 @@ pkgs.mkShell {
132134
builtins.attrNames (
133135
if (useSeparateDerivationForV8 != false) then
134136
builtins.removeAttrs sharedLibDeps [
137+
"highway"
135138
"simdutf"
136139
"temporal_capi"
137140
]

tools/nix/sharedLibDeps.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
;
2424
cares = pkgs.c-ares;
2525
hdr-histogram = pkgs.hdrhistogram_c;
26+
highway = pkgs.libhwy;
2627
http-parser = pkgs.llhttp;
2728
nghttp2 = pkgs.nghttp2.overrideAttrs {
2829
version = "1.69.0";

tools/nix/v8.nix

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
}:
2424

2525
let
26+
useSharedHighway = builtins.elem "--shared-highway" configureFlags;
2627
src =
2728
let
2829
inherit (lib) fileset;
@@ -63,12 +64,15 @@ let
6364
potentiallyAlreadyRemovedFiles =
6465
# Files that are removed in the release tarball (see Makefile $(TARBALL) target)
6566
[ (fileset.difference ../../deps/v8/test ../../deps/v8/test/torque) ]
66-
++ (builtins.filter builtins.pathExists [
67-
../../deps/v8/samples
68-
../../deps/v8/tools/profviz
69-
../../deps/v8/tools/run-tests.py
70-
../../deps/v8/third_party/ittapi
71-
]);
67+
++ (builtins.filter builtins.pathExists (
68+
[
69+
../../deps/v8/samples
70+
../../deps/v8/tools/profviz
71+
../../deps/v8/tools/run-tests.py
72+
../../deps/v8/third_party/ittapi
73+
]
74+
++ lib.optional useSharedHighway ../../deps/v8/third_party/highway
75+
));
7276
trackedFiles =
7377
({
7478
# This line is being modified by Makefile $(TARBALL) target, any change to it should be sync

tools/v8_gypfiles/v8.gyp

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2444,10 +2444,35 @@
24442444
'target_name': 'highway',
24452445
'type': 'static_library',
24462446
'toolsets': ['host', 'target'],
2447-
'variables': {
2448-
'HIGHWAY_ROOT': '../../deps/v8/third_party/highway',
2449-
},
2450-
'all_dependent_settings': {
2447+
'conditions': [['node_shared_highway=="false"', {
2448+
'variables': {
2449+
'HIGHWAY_ROOT': '../../deps/v8/third_party/highway',
2450+
},
2451+
'all_dependent_settings': {
2452+
'include_dirs': [
2453+
'<(HIGHWAY_ROOT)/src',
2454+
],
2455+
'conditions': [
2456+
['v8_target_arch=="ia32"', {
2457+
'defines': ['HWY_BROKEN_TARGETS=(HWY_AVX2|HWY_AVX3)',],
2458+
}],
2459+
['v8_target_arch=="arm64"', {
2460+
'defines': ['HWY_BROKEN_TARGETS=HWY_ALL_SVE',],
2461+
}],
2462+
['v8_target_arch=="ppc64" or v8_target_arch=="s390x"', {
2463+
'defines': ['TOOLCHAIN_MISS_ASM_HWCAP_H',],
2464+
}],
2465+
['v8_target_arch=="s390x"', {
2466+
'defines': ['HWY_BROKEN_EMU128=0',],
2467+
}],
2468+
['OS in "aix os400"', {
2469+
'defines': ['HWY_BROKEN_EMU128=0',],
2470+
}],
2471+
['v8_target_arch=="arm" and arm_version==7', {
2472+
'defines': ['HWY_BROKEN_EMU128=0',],
2473+
}],
2474+
],
2475+
},
24512476
'include_dirs': [
24522477
'<(HIGHWAY_ROOT)/src',
24532478
],
@@ -2461,34 +2486,11 @@
24612486
['v8_target_arch=="ppc64" or v8_target_arch=="s390x"', {
24622487
'defines': ['TOOLCHAIN_MISS_ASM_HWCAP_H',],
24632488
}],
2464-
['v8_target_arch=="s390x"', {
2465-
'defines': ['HWY_BROKEN_EMU128=0',],
2466-
}],
2467-
['OS in "aix os400"', {
2468-
'defines': ['HWY_BROKEN_EMU128=0',],
2469-
}],
2470-
['v8_target_arch=="arm" and arm_version==7', {
2471-
'defines': ['HWY_BROKEN_EMU128=0',],
2472-
}],
24732489
],
2474-
},
2475-
'include_dirs': [
2476-
'<(HIGHWAY_ROOT)/src',
2477-
],
2478-
'conditions': [
2479-
['v8_target_arch=="ia32"', {
2480-
'defines': ['HWY_BROKEN_TARGETS=(HWY_AVX2|HWY_AVX3)',],
2481-
}],
2482-
['v8_target_arch=="arm64"', {
2483-
'defines': ['HWY_BROKEN_TARGETS=HWY_ALL_SVE',],
2484-
}],
2485-
['v8_target_arch=="ppc64" or v8_target_arch=="s390x"', {
2486-
'defines': ['TOOLCHAIN_MISS_ASM_HWCAP_H',],
2487-
}],
2488-
],
2489-
'sources': [
2490-
'<!@pymod_do_main(GN-scraper "<(HIGHWAY_ROOT)/BUILD.gn" "source_set.\\"libhwy.*?sources = ")',
2491-
],
2490+
'sources': [
2491+
'<!@pymod_do_main(GN-scraper "<(HIGHWAY_ROOT)/BUILD.gn" "source_set.\\"libhwy.*?sources = ")',
2492+
],
2493+
}]],
24922494
}, # highway
24932495
{
24942496
'target_name': 'simdutf',

0 commit comments

Comments
 (0)