Skip to content

Commit a17d1d0

Browse files
committed
deps: delete deps/v8/third_party/zlib
We currently have two copies of Chromium's zlib: one in deps/zlib and another in deps/v8/third_party/zlib. This has a couple of disadvantages: 1. There is an additional cost to keeping both dependencies up-to-date, and in fact they were already out-of-sync (see the refs). 2. People who compile with --shared-zlib (i.e. distro maintainers) will probably not be thrilled to learn that there is still a copy of zlib inside. 3. It's aesthetically unpleasing. This diff (per discussion in the refs) centralizes on deps/zlib and deletes deps/v8/third_party/zlib. That requires changing the include headers in two files in deps/v8/src, which was pretty straightforward. When the user requests compiling with a shared zlib build, we still need to compile the contents of deps/zlib/google. This is not ideal but it's also not a change in behavior: prior to this diff those files were being compiled in the deps/v8/third_party/zlib version. I tested this on Linux with the default build and a --shared-zlib build. I checked that the shared-zlib build dynamically linked zlib according to ldd, and that the regular build did not. I would appreciate if the reviewers could suggest some other build configurations to try. Refs: nodejs#47145 Refs: nodejs#47157
1 parent 3ce303c commit a17d1d0

File tree

6 files changed

+27
-71
lines changed

6 files changed

+27
-71
lines changed

common.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
# Reset this number to 0 on major V8 upgrades.
3838
# Increment by one for each non-official patch applied to deps/v8.
39-
'v8_embedder_string': '-node.9',
39+
'v8_embedder_string': '-node.10',
4040

4141
##### V8 defaults for Node.js #####
4242

deps/v8/src/deoptimizer/translation-array.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "src/objects/fixed-array-inl.h"
1010

1111
#ifdef V8_USE_ZLIB
12-
#include "third_party/zlib/google/compression_utils_portable.h"
12+
#include "compression_utils_portable.h"
1313
#endif // V8_USE_ZLIB
1414

1515
namespace v8 {

deps/v8/src/snapshot/snapshot-compression.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "src/base/platform/elapsed-timer.h"
88
#include "src/utils/memcopy.h"
99
#include "src/utils/utils.h"
10-
#include "third_party/zlib/google/compression_utils_portable.h"
10+
#include "compression_utils_portable.h"
1111

1212
namespace v8 {
1313
namespace internal {

deps/v8/src/snapshot/snapshot-utils.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "src/base/sanitizer/msan.h"
88

99
#ifdef V8_USE_ZLIB
10-
#include "third_party/zlib/zlib.h"
10+
#include "zlib.h"
1111
#endif
1212

1313
namespace v8 {

deps/zlib/zlib.gyp

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,23 @@
55
{
66
'variables': {
77
'ZLIB_ROOT': '.',
8-
'use_system_zlib%': 0,
98
'arm_fpu%': '',
109
'llvm_version%': '0.0',
1110
},
11+
'targets': [
12+
{
13+
'target_name': 'zlib_google',
14+
'type': 'static_library',
15+
'sources': [
16+
'<!@pymod_do_main(GN-scraper "<(ZLIB_ROOT)/google/BUILD.gn" "\\"compression_utils_portable\\".*?sources = ")',
17+
],
18+
'conditions': [
19+
['node_shared_zlib=="false"', {
20+
'include_dirs': [ '<(ZLIB_ROOT)' ] }]],
21+
},
22+
],
1223
'conditions': [
13-
['use_system_zlib==0', {
24+
['node_shared_zlib=="false"', {
1425
'targets': [
1526
{
1627
'target_name': 'zlib_adler32_simd',
@@ -174,12 +185,16 @@
174185
{
175186
'target_name': 'zlib',
176187
'type': 'static_library',
188+
'dependencies': [ 'zlib_google' ],
177189
'sources': [
178190
'<!@pymod_do_main(GN-scraper "<(ZLIB_ROOT)/BUILD.gn" "\\"zlib\\".*?sources = ")',
179191
],
180192
'include_dirs': [ '<(ZLIB_ROOT)' ],
181193
'direct_dependent_settings': {
182-
'include_dirs': [ '<(ZLIB_ROOT)' ],
194+
'include_dirs': [
195+
'<(ZLIB_ROOT)',
196+
'<(ZLIB_ROOT)/google',
197+
],
183198
},
184199
'conditions': [
185200
['OS!="win"', {
@@ -248,10 +263,14 @@
248263
{
249264
'target_name': 'zlib',
250265
'type': 'static_library',
266+
'dependencies': [ 'zlib_google' ],
251267
'direct_dependent_settings': {
252268
'defines': [
253269
'USE_SYSTEM_ZLIB',
254270
],
271+
'include_dirs': [
272+
'<(ZLIB_ROOT)/google',
273+
],
255274
},
256275
'defines': [
257276
'USE_SYSTEM_ZLIB',

tools/v8_gypfiles/v8.gyp

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@
856856
'run_torque',
857857
'v8_internal_headers',
858858
'v8_maybe_icu',
859-
'v8_zlib',
859+
'../../deps/zlib/zlib.gyp:zlib',
860860
'v8_pch',
861861
],
862862
'includes': ['inspector.gypi'],
@@ -2002,68 +2002,5 @@
20022002
'sources': ['<(SHARED_INTERMEDIATE_DIR)/debug-support.cc', ],
20032003
},
20042004
}, # postmortem-metadata
2005-
2006-
{
2007-
'target_name': 'v8_zlib',
2008-
'type': 'static_library',
2009-
'toolsets': ['host', 'target'],
2010-
'conditions': [
2011-
['OS=="win"', {
2012-
'conditions': [
2013-
['"<(target_arch)"=="arm64" and _toolset=="target"', {
2014-
'defines': ['CPU_NO_SIMD']
2015-
}, {
2016-
'defines': ['X86_WINDOWS']
2017-
}]
2018-
]
2019-
}],
2020-
],
2021-
'direct_dependent_settings': {
2022-
'include_dirs': [
2023-
'<(V8_ROOT)/third_party/zlib',
2024-
'<(V8_ROOT)/third_party/zlib/google',
2025-
],
2026-
},
2027-
'defines': [ 'ZLIB_IMPLEMENTATION' ],
2028-
'include_dirs': [
2029-
'<(V8_ROOT)/third_party/zlib',
2030-
'<(V8_ROOT)/third_party/zlib/google',
2031-
],
2032-
'sources': [
2033-
'<(V8_ROOT)/third_party/zlib/adler32.c',
2034-
'<(V8_ROOT)/third_party/zlib/chromeconf.h',
2035-
'<(V8_ROOT)/third_party/zlib/compress.c',
2036-
'<(V8_ROOT)/third_party/zlib/contrib/optimizations/insert_string.h',
2037-
'<(V8_ROOT)/third_party/zlib/contrib/optimizations/insert_string.h',
2038-
'<(V8_ROOT)/third_party/zlib/cpu_features.c',
2039-
'<(V8_ROOT)/third_party/zlib/cpu_features.h',
2040-
'<(V8_ROOT)/third_party/zlib/crc32.c',
2041-
'<(V8_ROOT)/third_party/zlib/crc32.h',
2042-
'<(V8_ROOT)/third_party/zlib/deflate.c',
2043-
'<(V8_ROOT)/third_party/zlib/deflate.h',
2044-
'<(V8_ROOT)/third_party/zlib/gzclose.c',
2045-
'<(V8_ROOT)/third_party/zlib/gzguts.h',
2046-
'<(V8_ROOT)/third_party/zlib/gzlib.c',
2047-
'<(V8_ROOT)/third_party/zlib/gzread.c',
2048-
'<(V8_ROOT)/third_party/zlib/gzwrite.c',
2049-
'<(V8_ROOT)/third_party/zlib/infback.c',
2050-
'<(V8_ROOT)/third_party/zlib/inffast.c',
2051-
'<(V8_ROOT)/third_party/zlib/inffast.h',
2052-
'<(V8_ROOT)/third_party/zlib/inffixed.h',
2053-
'<(V8_ROOT)/third_party/zlib/inflate.c',
2054-
'<(V8_ROOT)/third_party/zlib/inflate.h',
2055-
'<(V8_ROOT)/third_party/zlib/inftrees.c',
2056-
'<(V8_ROOT)/third_party/zlib/inftrees.h',
2057-
'<(V8_ROOT)/third_party/zlib/trees.c',
2058-
'<(V8_ROOT)/third_party/zlib/trees.h',
2059-
'<(V8_ROOT)/third_party/zlib/uncompr.c',
2060-
'<(V8_ROOT)/third_party/zlib/zconf.h',
2061-
'<(V8_ROOT)/third_party/zlib/zlib.h',
2062-
'<(V8_ROOT)/third_party/zlib/zutil.c',
2063-
'<(V8_ROOT)/third_party/zlib/zutil.h',
2064-
'<(V8_ROOT)/third_party/zlib/google/compression_utils_portable.cc',
2065-
'<(V8_ROOT)/third_party/zlib/google/compression_utils_portable.h',
2066-
],
2067-
}, # v8_zlib
20682005
],
20692006
}

0 commit comments

Comments
 (0)