Skip to content

Commit e2dd065

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

7 files changed

Lines changed: 74 additions & 31 deletions

File tree

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,6 +1318,7 @@ ifeq ($(SKIP_SHARED_DEPS), 1)
13181318
$(RM) -r $(TARNAME)/deps/uv
13191319
$(RM) -r $(TARNAME)/deps/uvwasi
13201320
$(RM) -r $(TARNAME)/deps/v8/third_party/abseil-cpp
1321+
$(RM) -r $(TARNAME)/deps/v8/third_party/highway
13211322
$(RM) -r $(TARNAME)/deps/v8/third_party/simdutf
13221323
$(RM) -r $(TARNAME)/deps/zlib
13231324
$(RM) -r $(TARNAME)/deps/zstd

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',
@@ -2949,6 +2971,7 @@ def make_bin_override():
29492971
configure_library('cares', output, pkgname='libcares')
29502972
configure_library('gtest', output)
29512973
configure_library('hdr_histogram', output)
2974+
configure_library('highway', output, pkgname='libhwy')
29522975
configure_library('merve', output)
29532976
configure_library('nbytes', output)
29542977
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
@@ -66,6 +66,7 @@ let
6666
buildInputs =
6767
pkgs.lib.optional useSharedICU icu
6868
++ pkgs.lib.optional (builtins.hasAttr "abseil" sharedLibDeps) sharedLibDeps.abseil
69+
++ pkgs.lib.optional (builtins.hasAttr "highway" sharedLibDeps) sharedLibDeps.highway
6970
++ pkgs.lib.optional (builtins.hasAttr "simdutf" sharedLibDeps) sharedLibDeps.simdutf
7071
++ pkgs.lib.optional (withPerfetto && useSharedPerfetto) sharedLibDeps.perfetto
7172
++ pkgs.lib.optional (withTemporal && useSharedTemporal) sharedLibDeps.temporal_capi;
@@ -81,6 +82,7 @@ let
8182
"--v8-${if withTemporal then "enable" else "disable"}-temporal-support"
8283
]
8384
++ pkgs.lib.optional (builtins.hasAttr "abseil" sharedLibDeps) "--shared-abseil"
85+
++ pkgs.lib.optional (builtins.hasAttr "highway" sharedLibDeps) "--shared-highway"
8486
++ pkgs.lib.optional (builtins.hasAttr "simdutf" sharedLibDeps) "--shared-simdutf"
8587
++ pkgs.lib.optional (withPerfetto && useSharedPerfetto) "--shared-perfetto"
8688
++ pkgs.lib.optional (withTemporal && useSharedTemporal) "--shared-temporal_capi"
@@ -141,6 +143,7 @@ pkgs.mkShell {
141143
if (useSeparateDerivationForV8 != false) then
142144
builtins.removeAttrs sharedLibDeps [
143145
"abseil"
146+
"highway"
144147
"simdutf"
145148
"temporal_capi"
146149
]

tools/nix/sharedLibDeps.nix

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@
2424
abseil = pkgs.abseil-cpp;
2525
cares = pkgs.c-ares;
2626
hdr-histogram = pkgs.hdrhistogram_c;
27+
highway = (pkgs.callPackage (builtins.fetchurl {
28+
url = "https://github.com/aduh95/nixpkgs/raw/bdc960ea0c71c436493ab0b8756ad4ecccf0b6b3/pkgs/by-name/li/libhwy/package.nix";
29+
sha256 = "1aq0kjf31fr6lna9i73hv7l6vq90za9fv7z4m0r3d77rpf9r2sww";
30+
}) { }).overrideAttrs {
31+
patches = [
32+
(builtins.fetchurl {
33+
url = "https://github.com/aduh95/nixpkgs/raw/bdc960ea0c71c436493ab0b8756ad4ecccf0b6b3/pkgs/by-name/li/libhwy/move-contrib-to-its-own-output.patch";
34+
sha256 = "0rfjh0n7zjqjpi56kl8jd3g3i4cmdx0d5y9j5j2jwa22bamkp8kn";
35+
})
36+
];
37+
};
2738
http-parser = pkgs.llhttp;
2839
nghttp2 = pkgs.nghttp2.overrideAttrs {
2940
version = "1.69.0";

tools/nix/v8.nix

Lines changed: 2 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
useSharedSimdutf = builtins.elem "--shared-simdutf" configureFlags;
2829
src =
2930
let
@@ -74,6 +75,7 @@ let
7475
../../deps/v8/third_party/ittapi
7576
]
7677
++ lib.optional useSharedAbseil ../../deps/v8/third_party/abseil-cpp
78+
++ lib.optional useSharedHighway ../../deps/v8/third_party/highway
7779
++ lib.optional useSharedSimdutf ../../deps/v8/third_party/simdutf
7880
));
7981
trackedFiles =

tools/v8_gypfiles/v8.gyp

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2481,10 +2481,35 @@
24812481
'target_name': 'highway',
24822482
'type': 'static_library',
24832483
'toolsets': ['host', 'target'],
2484-
'variables': {
2485-
'HIGHWAY_ROOT': '../../deps/v8/third_party/highway',
2486-
},
2487-
'all_dependent_settings': {
2484+
'conditions': [['node_shared_highway=="false"', {
2485+
'variables': {
2486+
'HIGHWAY_ROOT': '../../deps/v8/third_party/highway',
2487+
},
2488+
'all_dependent_settings': {
2489+
'include_dirs': [
2490+
'<(HIGHWAY_ROOT)/src',
2491+
],
2492+
'conditions': [
2493+
['v8_target_arch=="ia32"', {
2494+
'defines': ['HWY_BROKEN_TARGETS=(HWY_AVX2|HWY_AVX3)',],
2495+
}],
2496+
['v8_target_arch=="arm64"', {
2497+
'defines': ['HWY_BROKEN_TARGETS=HWY_ALL_SVE',],
2498+
}],
2499+
['v8_target_arch=="ppc64" or v8_target_arch=="s390x"', {
2500+
'defines': ['TOOLCHAIN_MISS_ASM_HWCAP_H',],
2501+
}],
2502+
['v8_target_arch=="s390x"', {
2503+
'defines': ['HWY_BROKEN_EMU128=0',],
2504+
}],
2505+
['OS in "aix os400"', {
2506+
'defines': ['HWY_BROKEN_EMU128=0',],
2507+
}],
2508+
['v8_target_arch=="arm" and arm_version==7', {
2509+
'defines': ['HWY_BROKEN_EMU128=0',],
2510+
}],
2511+
],
2512+
},
24882513
'include_dirs': [
24892514
'<(HIGHWAY_ROOT)/src',
24902515
],
@@ -2498,34 +2523,11 @@
24982523
['v8_target_arch=="ppc64" or v8_target_arch=="s390x"', {
24992524
'defines': ['TOOLCHAIN_MISS_ASM_HWCAP_H',],
25002525
}],
2501-
['v8_target_arch=="s390x"', {
2502-
'defines': ['HWY_BROKEN_EMU128=0',],
2503-
}],
2504-
['OS in "aix os400"', {
2505-
'defines': ['HWY_BROKEN_EMU128=0',],
2506-
}],
2507-
['v8_target_arch=="arm" and arm_version==7', {
2508-
'defines': ['HWY_BROKEN_EMU128=0',],
2509-
}],
25102526
],
2511-
},
2512-
'include_dirs': [
2513-
'<(HIGHWAY_ROOT)/src',
2514-
],
2515-
'conditions': [
2516-
['v8_target_arch=="ia32"', {
2517-
'defines': ['HWY_BROKEN_TARGETS=(HWY_AVX2|HWY_AVX3)',],
2518-
}],
2519-
['v8_target_arch=="arm64"', {
2520-
'defines': ['HWY_BROKEN_TARGETS=HWY_ALL_SVE',],
2521-
}],
2522-
['v8_target_arch=="ppc64" or v8_target_arch=="s390x"', {
2523-
'defines': ['TOOLCHAIN_MISS_ASM_HWCAP_H',],
2524-
}],
2525-
],
2526-
'sources': [
2527-
'<!@pymod_do_main(GN-scraper "<(HIGHWAY_ROOT)/BUILD.gn" "source_set.\\"libhwy.*?sources = ")',
2528-
],
2527+
'sources': [
2528+
'<!@pymod_do_main(GN-scraper "<(HIGHWAY_ROOT)/BUILD.gn" "source_set.\\"libhwy.*?sources = ")',
2529+
],
2530+
}]],
25292531
}, # highway
25302532
{
25312533
'target_name': 'simdutf',

0 commit comments

Comments
 (0)