From c8583da0111e8a8b1057ae9ed67b720f7d7285e4 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Fri, 3 Jan 2020 14:03:08 +0100 Subject: [PATCH] build: simplify v8's vendored zlib build It only uses adler32() and only in one place that's arguably not very performance critical so simplify the build by building just adler32.c and nothing else. --- tools/v8_gypfiles/v8.gyp | 13 ++++- tools/v8_gypfiles/zlib.gyp | 101 ------------------------------------- 2 files changed, 12 insertions(+), 102 deletions(-) delete mode 100644 tools/v8_gypfiles/zlib.gyp diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp index 7efdac9b829..f255bda0692 100644 --- a/tools/v8_gypfiles/v8.gyp +++ b/tools/v8_gypfiles/v8.gyp @@ -705,7 +705,7 @@ 'generate_bytecode_builtins_list', 'run_torque', 'v8_maybe_icu', - 'zlib.gyp:zlib' + 'v8_zlib', ], 'includes': ['inspector.gypi'], 'direct_dependent_settings': { @@ -1599,5 +1599,16 @@ 'sources': ['<(SHARED_INTERMEDIATE_DIR)/debug-support.cc', ], }, }, # postmortem-metadata + + { + 'target_name': 'v8_zlib', + 'type': 'static_library', + 'direct_dependent_settings': { + 'include_dirs': [ '<(V8_ROOT)/third_party/zlib' ], + }, + 'defines': [ 'ZLIB_IMPLEMENTATION' ], + 'include_dirs': [ '<(V8_ROOT)/third_party/zlib' ], + 'sources': [ '<(V8_ROOT)/third_party/zlib/adler32.c' ], + }, # v8_zlib ], } diff --git a/tools/v8_gypfiles/zlib.gyp b/tools/v8_gypfiles/zlib.gyp deleted file mode 100644 index fef27ca2277..00000000000 --- a/tools/v8_gypfiles/zlib.gyp +++ /dev/null @@ -1,101 +0,0 @@ -# Minimal port of deps/v8/third_party/zlib/BUILD.gn -{ - 'variables': { - 'ZLIB_ROOT': '../../deps/v8/third_party/zlib', - }, - 'targets': [ - { - 'target_name': 'zlib', - 'type': 'static_library', - 'toolsets': ['target'], - 'dependencies': [ - 'zlib_x86_simd', - ], - 'defines': ['ZLIB_IMPLEMENTATION'], - 'sources': [ - '<(ZLIB_ROOT)/adler32.c', - '<(ZLIB_ROOT)/chromeconf.h', - '<(ZLIB_ROOT)/compress.c', - '<(ZLIB_ROOT)/crc32.c', - '<(ZLIB_ROOT)/crc32.h', - '<(ZLIB_ROOT)/deflate.c', - '<(ZLIB_ROOT)/deflate.h', - '<(ZLIB_ROOT)/gzclose.c', - '<(ZLIB_ROOT)/gzguts.h', - '<(ZLIB_ROOT)/gzlib.c', - '<(ZLIB_ROOT)/gzread.c', - '<(ZLIB_ROOT)/gzwrite.c', - '<(ZLIB_ROOT)/infback.c', - '<(ZLIB_ROOT)/inffast.c', - '<(ZLIB_ROOT)/inffast.h', - '<(ZLIB_ROOT)/inffixed.h', - '<(ZLIB_ROOT)/inflate.h', - '<(ZLIB_ROOT)/inftrees.c', - '<(ZLIB_ROOT)/inftrees.h', - '<(ZLIB_ROOT)/trees.c', - '<(ZLIB_ROOT)/trees.h', - '<(ZLIB_ROOT)/uncompr.c', - '<(ZLIB_ROOT)/x86.h', - '<(ZLIB_ROOT)/zconf.h', - '<(ZLIB_ROOT)/zlib.h', - '<(ZLIB_ROOT)/zutil.c', - '<(ZLIB_ROOT)/zutil.h', - ], - 'conditions': [ - ['want_separate_host_toolset', { - 'toolsets': ['host', 'target'], - }], - # TODO: correctly implement the conditions - ['1 == 0', { - 'dependencies': [ - 'zlib_adler32_simd', - 'zlib_inflate_chunk_simd', - ], - 'conditions': [ - ['1 == 0', { - 'sources': [ - '<(ZLIB_ROOT)/x86.c', - ], - 'dependencies': ['zlib_crc32_simd'], - }], - ['1 == 0', { - 'sources': [ - '<(ZLIB_ROOT)/contrib/optimizations/slide_hash_neon.h', - ], - 'dependencies': ['zlib_arm_crc32'], - }], - ], - }, { - 'sources': [ - '<(ZLIB_ROOT)/inflate.c', - ], - }], - ], - 'include_dirs': [ - '<(ZLIB_ROOT)', - ], - 'direct_dependent_settings': { - 'include_dirs': [ - '<(ZLIB_ROOT)', - ], - }, - }, # zlib - { - 'target_name': 'zlib_x86_simd', - 'type': 'none', - 'hard_dependency': 1, - 'defines': ['ZLIB_IMPLEMENTATION'], - 'direct_dependent_settings': { - # TODO: implement the conditions - 'sources': [ - '<(ZLIB_ROOT)/simd_stub.c', - ], - }, - 'conditions': [ - ['want_separate_host_toolset', { - 'toolsets': ['host', 'target'], - }], - ], - }, # zlib_x86_simd - ], -}