Skip to content

Commit 92a8cd0

Browse files
committed
build: add --shared-highway configure flag
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 761e49e commit 92a8cd0

9 files changed

Lines changed: 99 additions & 59 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
@@ -1322,6 +1322,7 @@ ifeq ($(SKIP_SHARED_DEPS), 1)
13221322
$(RM) -r $(TARNAME)/deps/sqlite
13231323
$(RM) -r $(TARNAME)/deps/uv
13241324
$(RM) -r $(TARNAME)/deps/uvwasi
1325+
$(RM) -r $(TARNAME)/deps/v8/third_party/highway
13251326
$(RM) -r $(TARNAME)/deps/zlib
13261327
$(RM) -r $(TARNAME)/deps/zstd
13271328
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
@@ -24,6 +24,7 @@
2424
;
2525
cares = pkgs.c-ares;
2626
hdr-histogram = pkgs.hdrhistogram_c;
27+
highway = pkgs.libhwy;
2728
http-parser = pkgs.llhttp;
2829
}
2930
// (pkgs.lib.optionalAttrs withLief {

‎tools/nix/v8.nix‎

Lines changed: 11 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;
@@ -44,6 +45,7 @@ let
4445
../../tools/v8_gypfiles/toolchain.gypi
4546
../../tools/v8_gypfiles/v8.gyp
4647
]
48+
++ lib.optional (!useSharedHighway) ../../tools/v8_gypfiles/highway.gyp
4749
++ lib.optionals (builtins.elem "--with-perfetto" configureFlags) [
4850
../../deps/perfetto
4951
]
@@ -63,12 +65,15 @@ let
6365
potentiallyAlreadyRemovedFiles =
6466
# Files that are removed in the release tarball (see Makefile $(TARBALL) target)
6567
[ (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-
]);
68+
++ (builtins.filter builtins.pathExists (
69+
[
70+
../../deps/v8/samples
71+
../../deps/v8/tools/profviz
72+
../../deps/v8/tools/run-tests.py
73+
../../deps/v8/third_party/ittapi
74+
]
75+
++ lib.optional useSharedHighway ../../deps/v8/third_party/highway
76+
));
7277
trackedFiles =
7378
({
7479
# This line is being modified by Makefile $(TARBALL) target, any change to it should be sync

‎tools/v8_gypfiles/highway.gyp‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
'targets': [
3+
{
4+
'target_name': 'highway',
5+
'type': 'static_library',
6+
'toolsets': ['host', 'target'],
7+
'variables': {
8+
'HIGHWAY_ROOT': '../../deps/v8/third_party/highway',
9+
},
10+
'all_dependent_settings': {
11+
'include_dirs': [
12+
'<(HIGHWAY_ROOT)/src',
13+
],
14+
'conditions': [
15+
['v8_target_arch=="ia32"', {
16+
'defines': ['HWY_BROKEN_TARGETS=(HWY_AVX2|HWY_AVX3)',],
17+
}],
18+
['v8_target_arch=="arm64"', {
19+
'defines': ['HWY_BROKEN_TARGETS=HWY_ALL_SVE',],
20+
}],
21+
['v8_target_arch=="ppc64" or v8_target_arch=="s390x"', {
22+
'defines': ['TOOLCHAIN_MISS_ASM_HWCAP_H',],
23+
}],
24+
['v8_target_arch=="s390x"', {
25+
'defines': ['HWY_BROKEN_EMU128=0',],
26+
}],
27+
['OS in "aix os400"', {
28+
'defines': ['HWY_BROKEN_EMU128=0',],
29+
}],
30+
['v8_target_arch=="arm" and arm_version==7', {
31+
'defines': ['HWY_BROKEN_EMU128=0',],
32+
}],
33+
],
34+
},
35+
'include_dirs': [
36+
'<(HIGHWAY_ROOT)/src',
37+
],
38+
'conditions': [
39+
['v8_target_arch=="ia32"', {
40+
'defines': ['HWY_BROKEN_TARGETS=(HWY_AVX2|HWY_AVX3)',],
41+
}],
42+
['v8_target_arch=="arm64"', {
43+
'defines': ['HWY_BROKEN_TARGETS=HWY_ALL_SVE',],
44+
}],
45+
['v8_target_arch=="ppc64" or v8_target_arch=="s390x"', {
46+
'defines': ['TOOLCHAIN_MISS_ASM_HWCAP_H',],
47+
}],
48+
['v8_target_arch=="riscv64"', {
49+
'defines': ['HWY_BROKEN_TARGETS=HWY_RVV',],
50+
}],
51+
],
52+
'sources': [
53+
'<!@pymod_do_main(GN-scraper "<(HIGHWAY_ROOT)/BUILD.gn" "source_set.\\"libhwy.*?sources = ")',
54+
],
55+
}, # highway
56+
],
57+
}

‎tools/v8_gypfiles/v8.gyp‎

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2440,59 +2440,6 @@
24402440
],
24412441
},
24422442
}, # fp16
2443-
{
2444-
'target_name': 'highway',
2445-
'type': 'static_library',
2446-
'toolsets': ['host', 'target'],
2447-
'variables': {
2448-
'HIGHWAY_ROOT': '../../deps/v8/third_party/highway',
2449-
},
2450-
'all_dependent_settings': {
2451-
'include_dirs': [
2452-
'<(HIGHWAY_ROOT)/src',
2453-
],
2454-
'conditions': [
2455-
['v8_target_arch=="ia32"', {
2456-
'defines': ['HWY_BROKEN_TARGETS=(HWY_AVX2|HWY_AVX3)',],
2457-
}],
2458-
['v8_target_arch=="arm64"', {
2459-
'defines': ['HWY_BROKEN_TARGETS=HWY_ALL_SVE',],
2460-
}],
2461-
['v8_target_arch=="ppc64" or v8_target_arch=="s390x"', {
2462-
'defines': ['TOOLCHAIN_MISS_ASM_HWCAP_H',],
2463-
}],
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-
}],
2473-
],
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-
['v8_target_arch=="riscv64"', {
2489-
'defines': ['HWY_BROKEN_TARGETS=HWY_RVV',],
2490-
}],
2491-
],
2492-
'sources': [
2493-
'<!@pymod_do_main(GN-scraper "<(HIGHWAY_ROOT)/BUILD.gn" "source_set.\\"libhwy.*?sources = ")',
2494-
],
2495-
}, # highway
24962443
{
24972444
'target_name': 'simdutf',
24982445
'type': 'static_library',

0 commit comments

Comments
 (0)