build: add `--shared-highway` configure flag · nodejs/node@120929a · GitHub
Skip to content

Commit 120929a

Browse files
committed
build: add --shared-highway configure flag
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #65686 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com>
1 parent c99af09 commit 120929a

9 files changed

Lines changed: 100 additions & 59 deletions

File tree

‎.github/workflows/test-shared.yml‎

Lines changed: 2 additions & 0 deletions

‎Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,6 +1324,7 @@ ifeq ($(SKIP_SHARED_DEPS), 1)
13241324
$(RM) -r $(TARNAME)/deps/uv
13251325
$(RM) -r $(TARNAME)/deps/uvwasi
13261326
$(RM) -r $(TARNAME)/deps/v8/third_party/abseil-cpp
1327+
$(RM) -r $(TARNAME)/deps/v8/third_party/highway
13271328
$(RM) -r $(TARNAME)/deps/zlib
13281329
$(RM) -r $(TARNAME)/deps/zstd
13291330
else

‎configure.py‎

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

351+
shared_optgroup.add_argument('--shared-highway',
352+
action='store_true',
353+
dest='shared_highway',
354+
default=None,
355+
help='link to a shared Highway (hwy) DLL instead of static linking')
356+
357+
shared_optgroup.add_argument('--shared-highway-includes',
358+
action='store',
359+
dest='shared_highway_includes',
360+
help='directory containing Highway header files')
361+
362+
shared_optgroup.add_argument('--shared-highway-libname',
363+
action='store',
364+
dest='shared_highway_libname',
365+
default='hwy',
366+
help='alternative lib name to link to [default: %(default)s]')
367+
368+
shared_optgroup.add_argument('--shared-highway-libpath',
369+
action='store',
370+
dest='shared_highway_libpath',
371+
help='a directory to search for the shared Highway DLL')
372+
351373
shared_optgroup.add_argument('--shared-http-parser',
352374
action='store_true',
353375
dest='shared_http_parser',
@@ -2908,6 +2930,7 @@ def make_bin_override():
29082930
configure_library('cares', output, pkgname='libcares')
29092931
configure_library('gtest', output)
29102932
configure_library('hdr_histogram', output)
2933+
configure_library('highway', output, pkgname='libhwy')
29112934
configure_library('merve', output)
29122935
configure_library('nbytes', output)
29132936
configure_library('nghttp2', output, pkgname='libnghttp2')

‎node.gyp‎

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

‎shell.nix‎

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

6970
# Put here only the configure flags that affect the V8 build
@@ -77,6 +78,7 @@ let
7778
"--v8-${if withTemporal then "enable" else "disable"}-temporal-support"
7879
]
7980
++ pkgs.lib.optional (builtins.hasAttr "abseil" sharedLibDeps) "--shared-abseil"
81+
++ pkgs.lib.optional (builtins.hasAttr "highway" sharedLibDeps) "--shared-highway"
8082
++ pkgs.lib.optional (withTemporal && useSharedTemporal) "--shared-temporal_capi"
8183
++ pkgs.lib.optional withPerfetto "--with-perfetto";
8284
in
@@ -135,6 +137,7 @@ pkgs.mkShell {
135137
if (useSeparateDerivationForV8 != false) then
136138
builtins.removeAttrs sharedLibDeps [
137139
"abseil"
140+
"highway"
138141
"simdutf"
139142
"temporal_capi"
140143
]

‎tools/nix/sharedLibDeps.nix‎

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

‎tools/nix/v8.nix‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
let
2626
useSharedAbseil = builtins.elem "--shared-abseil" configureFlags;
27+
useSharedHighway = builtins.elem "--shared-highway" configureFlags;
2728
src =
2829
let
2930
inherit (lib) fileset;
@@ -45,6 +46,7 @@ let
4546
../../tools/v8_gypfiles/v8.gyp
4647
]
4748
++ lib.optional (!useSharedAbseil) ../../tools/v8_gypfiles/abseil.gyp
49+
++ lib.optional (!useSharedHighway) ../../tools/v8_gypfiles/highway.gyp
4850
++ lib.optionals (builtins.elem "--with-perfetto" configureFlags) [
4951
../../deps/perfetto
5052
]
@@ -72,6 +74,7 @@ let
7274
../../deps/v8/third_party/ittapi
7375
]
7476
++ lib.optional useSharedAbseil ../../deps/v8/third_party/abseil-cpp
77+
++ lib.optional useSharedHighway ../../deps/v8/third_party/highway
7578
));
7679
trackedFiles =
7780
({

‎tools/v8_gypfiles/highway.gyp‎

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

‎tools/v8_gypfiles/v8.gyp‎

Lines changed: 8 additions & 59 deletions

0 commit comments

Comments
 (0)