Skip to content

Commit 9a4c714

Browse files
committed
deps: use shared V8 zlib
1 parent fec6dc9 commit 9a4c714

File tree

4 files changed

+86
-54
lines changed

4 files changed

+86
-54
lines changed

common.gypi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
'node_module_version%': '',
2222
'node_with_ltcg%': '',
2323
'node_shared_openssl%': 'false',
24+
'v8_use_system_zlib%': 0,
2425

2526
'node_tag%': '',
2627
'uv_library%': 'static_library',

configure.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,6 +1819,7 @@ def configure_v8(o, configs):
18191819
if flavor != 'linux' and options.v8_enable_hugepage:
18201820
raise Exception('--v8-enable-hugepage is supported only on linux.')
18211821
o['variables']['v8_enable_hugepage'] = 1 if options.v8_enable_hugepage else 0
1822+
o['variables']['v8_use_system_zlib'] = 1 if options.shared_zlib else 0
18221823
if options.v8_enable_short_builtin_calls or o['variables']['target_arch'] == 'x64':
18231824
o['variables']['v8_enable_short_builtin_calls'] = 1
18241825
if options.v8_enable_snapshot_compression:

tools/nix/sharedLibDeps.nix

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
simdutf
1414
sqlite
1515
uvwasi
16-
zlib
1716
zstd
1817
;
1918
http-parser = pkgs.llhttp;
@@ -44,4 +43,11 @@
4443
"dev"
4544
];
4645
});
46+
zlib = pkgs.zlib.overrideAttrs (old: {
47+
src = pkgs.fetchgit {
48+
url = "https://chromium.googlesource.com/chromium/src/third_party/zlib.git";
49+
rev = "5aa617372945f61b628d5b18d3ab1cd1877b750a";
50+
hash = "sha256-kBX1iC6YOn4AD9rwOP+bx3Pf+fBwTk/ifQzgw5aK3RI=";
51+
};
52+
});
4753
}

tools/v8_gypfiles/v8.gyp

Lines changed: 77 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2241,62 +2241,86 @@
22412241
'type': 'static_library',
22422242
'toolsets': ['host', 'target'],
22432243
'conditions': [
2244-
['OS=="win"', {
2244+
['v8_use_system_zlib==0', {
22452245
'conditions': [
2246-
['"<(target_arch)"=="arm64" and _toolset=="target"', {
2247-
'defines': ['CPU_NO_SIMD']
2248-
}, {
2249-
'defines': ['X86_WINDOWS']
2250-
}]
2251-
]
2246+
['OS=="win"', {
2247+
'conditions': [
2248+
['"<(target_arch)"=="arm64" and _toolset=="target"', {
2249+
'defines': ['CPU_NO_SIMD']
2250+
}, {
2251+
'defines': ['X86_WINDOWS']
2252+
}]
2253+
]
2254+
}],
2255+
],
2256+
'direct_dependent_settings': {
2257+
'include_dirs': [
2258+
'<(V8_ROOT)/third_party/zlib',
2259+
'<(V8_ROOT)/third_party/zlib/google',
2260+
],
2261+
},
2262+
'defines': [ 'ZLIB_IMPLEMENTATION' ],
2263+
'include_dirs': [
2264+
'<(V8_ROOT)/third_party/zlib',
2265+
'<(V8_ROOT)/third_party/zlib/google',
2266+
],
2267+
'sources': [
2268+
'<(V8_ROOT)/third_party/zlib/adler32.c',
2269+
'<(V8_ROOT)/third_party/zlib/chromeconf.h',
2270+
'<(V8_ROOT)/third_party/zlib/compress.c',
2271+
'<(V8_ROOT)/third_party/zlib/contrib/optimizations/insert_string.h',
2272+
'<(V8_ROOT)/third_party/zlib/contrib/optimizations/insert_string.h',
2273+
'<(V8_ROOT)/third_party/zlib/cpu_features.c',
2274+
'<(V8_ROOT)/third_party/zlib/cpu_features.h',
2275+
'<(V8_ROOT)/third_party/zlib/crc32.c',
2276+
'<(V8_ROOT)/third_party/zlib/crc32.h',
2277+
'<(V8_ROOT)/third_party/zlib/deflate.c',
2278+
'<(V8_ROOT)/third_party/zlib/deflate.h',
2279+
'<(V8_ROOT)/third_party/zlib/gzclose.c',
2280+
'<(V8_ROOT)/third_party/zlib/gzguts.h',
2281+
'<(V8_ROOT)/third_party/zlib/gzlib.c',
2282+
'<(V8_ROOT)/third_party/zlib/gzread.c',
2283+
'<(V8_ROOT)/third_party/zlib/gzwrite.c',
2284+
'<(V8_ROOT)/third_party/zlib/infback.c',
2285+
'<(V8_ROOT)/third_party/zlib/inffast.c',
2286+
'<(V8_ROOT)/third_party/zlib/inffast.h',
2287+
'<(V8_ROOT)/third_party/zlib/inffixed.h',
2288+
'<(V8_ROOT)/third_party/zlib/inflate.c',
2289+
'<(V8_ROOT)/third_party/zlib/inflate.h',
2290+
'<(V8_ROOT)/third_party/zlib/inftrees.c',
2291+
'<(V8_ROOT)/third_party/zlib/inftrees.h',
2292+
'<(V8_ROOT)/third_party/zlib/trees.c',
2293+
'<(V8_ROOT)/third_party/zlib/trees.h',
2294+
'<(V8_ROOT)/third_party/zlib/uncompr.c',
2295+
'<(V8_ROOT)/third_party/zlib/zconf.h',
2296+
'<(V8_ROOT)/third_party/zlib/zlib.h',
2297+
'<(V8_ROOT)/third_party/zlib/zutil.c',
2298+
'<(V8_ROOT)/third_party/zlib/zutil.h',
2299+
'<(V8_ROOT)/third_party/zlib/google/compression_utils_portable.cc',
2300+
'<(V8_ROOT)/third_party/zlib/google/compression_utils_portable.h',
2301+
],
2302+
}, {
2303+
# Use system zlib
2304+
'direct_dependent_settings': {
2305+
'defines': [ 'USE_SYSTEM_ZLIB' ],
2306+
'include_dirs': [
2307+
'<(V8_ROOT)/third_party/zlib/google',
2308+
],
2309+
},
2310+
'defines': [ 'USE_SYSTEM_ZLIB' ],
2311+
'include_dirs': [
2312+
'<(V8_ROOT)/third_party/zlib/google',
2313+
],
2314+
'link_settings': {
2315+
'libraries': [ '-lz' ],
2316+
},
2317+
# Still need to build the Google-specific compression utilities
2318+
'sources': [
2319+
'<(V8_ROOT)/third_party/zlib/google/compression_utils_portable.cc',
2320+
'<(V8_ROOT)/third_party/zlib/google/compression_utils_portable.h',
2321+
],
22522322
}],
22532323
],
2254-
'direct_dependent_settings': {
2255-
'include_dirs': [
2256-
'<(V8_ROOT)/third_party/zlib',
2257-
'<(V8_ROOT)/third_party/zlib/google',
2258-
],
2259-
},
2260-
'defines': [ 'ZLIB_IMPLEMENTATION' ],
2261-
'include_dirs': [
2262-
'<(V8_ROOT)/third_party/zlib',
2263-
'<(V8_ROOT)/third_party/zlib/google',
2264-
],
2265-
'sources': [
2266-
'<(V8_ROOT)/third_party/zlib/adler32.c',
2267-
'<(V8_ROOT)/third_party/zlib/chromeconf.h',
2268-
'<(V8_ROOT)/third_party/zlib/compress.c',
2269-
'<(V8_ROOT)/third_party/zlib/contrib/optimizations/insert_string.h',
2270-
'<(V8_ROOT)/third_party/zlib/contrib/optimizations/insert_string.h',
2271-
'<(V8_ROOT)/third_party/zlib/cpu_features.c',
2272-
'<(V8_ROOT)/third_party/zlib/cpu_features.h',
2273-
'<(V8_ROOT)/third_party/zlib/crc32.c',
2274-
'<(V8_ROOT)/third_party/zlib/crc32.h',
2275-
'<(V8_ROOT)/third_party/zlib/deflate.c',
2276-
'<(V8_ROOT)/third_party/zlib/deflate.h',
2277-
'<(V8_ROOT)/third_party/zlib/gzclose.c',
2278-
'<(V8_ROOT)/third_party/zlib/gzguts.h',
2279-
'<(V8_ROOT)/third_party/zlib/gzlib.c',
2280-
'<(V8_ROOT)/third_party/zlib/gzread.c',
2281-
'<(V8_ROOT)/third_party/zlib/gzwrite.c',
2282-
'<(V8_ROOT)/third_party/zlib/infback.c',
2283-
'<(V8_ROOT)/third_party/zlib/inffast.c',
2284-
'<(V8_ROOT)/third_party/zlib/inffast.h',
2285-
'<(V8_ROOT)/third_party/zlib/inffixed.h',
2286-
'<(V8_ROOT)/third_party/zlib/inflate.c',
2287-
'<(V8_ROOT)/third_party/zlib/inflate.h',
2288-
'<(V8_ROOT)/third_party/zlib/inftrees.c',
2289-
'<(V8_ROOT)/third_party/zlib/inftrees.h',
2290-
'<(V8_ROOT)/third_party/zlib/trees.c',
2291-
'<(V8_ROOT)/third_party/zlib/trees.h',
2292-
'<(V8_ROOT)/third_party/zlib/uncompr.c',
2293-
'<(V8_ROOT)/third_party/zlib/zconf.h',
2294-
'<(V8_ROOT)/third_party/zlib/zlib.h',
2295-
'<(V8_ROOT)/third_party/zlib/zutil.c',
2296-
'<(V8_ROOT)/third_party/zlib/zutil.h',
2297-
'<(V8_ROOT)/third_party/zlib/google/compression_utils_portable.cc',
2298-
'<(V8_ROOT)/third_party/zlib/google/compression_utils_portable.h',
2299-
],
23002324
}, # v8_zlib
23012325
{
23022326
'target_name': 'fp16',

0 commit comments

Comments
 (0)