From 4504aef72945d1b2fdbacce97559f2bfc2c491b0 Mon Sep 17 00:00:00 2001 From: Victor Gomes Date: Mon, 28 Jun 2021 17:45:08 +0200 Subject: [PATCH] [bazel] Adds zlib as local repo This allows zlib to be overwritten in blaze. No-Try: true Bug: v8:11234 Change-Id: Id858076a4b744fdade7f6a23646d2d78d33723a7 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2993031 Auto-Submit: Victor Gomes Reviewed-by: Camillo Bruni Commit-Queue: Camillo Bruni Cr-Commit-Position: refs/heads/master@{#75422} --- BUILD.bazel | 66 +++--------------------------------------------- WORKSPACE | 6 +++++ bazel/BUILD.zlib | 52 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 63 deletions(-) create mode 100644 bazel/BUILD.zlib diff --git a/BUILD.bazel b/BUILD.bazel index a249758c2d..141c0b3ac3 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -2687,9 +2687,7 @@ v8_library( ":generated_torque_files", ":v8_shared_internal_headers", ], - deps = [ - ":third_party_zlib", - ], + deps = [ "@zlib" ], ) # TODO(victorgomes): Check if v8_enable_webassembly is true. @@ -2709,9 +2707,7 @@ v8_library( ":v8_shared_internal_headers", ":wee8_files", ], - deps = [ - ":third_party_zlib", - ], + deps = [ "@zlib" ], ) # ================================================= @@ -2760,9 +2756,7 @@ v8_binary( ":torque_runtime_support_files", ":generated_torque_files", ], - deps = [ - ":third_party_zlib" - ], + deps = [ "@zlib" ], linkopts = select({ "is_android": [ "-llog" ], "//conditions:default": [], @@ -2786,57 +2780,3 @@ v8_binary( ], deps = [":v8"], ) - -# ================================================= -# third_party rules -# ================================================= - -cc_library( - name = "third_party_zlib", - srcs = [ - "third_party/zlib/adler32.c", - "third_party/zlib/chromeconf.h", - "third_party/zlib/compress.c", - "third_party/zlib/contrib/optimizations/insert_string.h", - "third_party/zlib/cpu_features.c", - "third_party/zlib/cpu_features.h", - "third_party/zlib/crc32.c", - "third_party/zlib/crc32.h", - "third_party/zlib/deflate.c", - "third_party/zlib/deflate.h", - "third_party/zlib/gzclose.c", - "third_party/zlib/gzguts.h", - "third_party/zlib/gzlib.c", - "third_party/zlib/gzread.c", - "third_party/zlib/gzwrite.c", - "third_party/zlib/infback.c", - "third_party/zlib/inffast.c", - "third_party/zlib/inffast.h", - "third_party/zlib/inffixed.h", - "third_party/zlib/inflate.c", - "third_party/zlib/inflate.h", - "third_party/zlib/inftrees.c", - "third_party/zlib/inftrees.h", - "third_party/zlib/trees.c", - "third_party/zlib/trees.h", - "third_party/zlib/uncompr.c", - "third_party/zlib/zconf.h", - "third_party/zlib/zlib.h", - "third_party/zlib/zutil.c", - "third_party/zlib/zutil.h", - "third_party/zlib/google/compression_utils_portable.h", - "third_party/zlib/google/compression_utils_portable.cc", - ], - hdrs = [ - "third_party/zlib/google/compression_utils_portable.h", - ], - defines = [ - "CHROMIUM_ZLIB_NO_CHROMECONF", - "HAVE_HIDDEN", - "CPU_NO_SIMD", - ], - copts = [ - "-Ithird_party/zlib", - ], - alwayslink = 1, -) diff --git a/WORKSPACE b/WORKSPACE index f35173c5b6..54873b9b15 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -15,3 +15,9 @@ http_archive( ) load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") bazel_skylib_workspace() + +new_local_repository( + name = "zlib", + path = "third_party/zlib", + build_file = "bazel/BUILD.zlib", +) diff --git a/bazel/BUILD.zlib b/bazel/BUILD.zlib new file mode 100644 index 0000000000..0c97b325a3 --- /dev/null +++ b/bazel/BUILD.zlib @@ -0,0 +1,52 @@ +# Copyright 2021 the V8 project authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +cc_library( + name = "zlib", + srcs = [ + "adler32.c", + "chromeconf.h", + "compress.c", + "contrib/optimizations/insert_string.h", + "cpu_features.c", + "cpu_features.h", + "crc32.c", + "crc32.h", + "deflate.c", + "deflate.h", + "gzclose.c", + "gzguts.h", + "gzlib.c", + "gzread.c", + "gzwrite.c", + "infback.c", + "inffast.c", + "inffast.h", + "inffixed.h", + "inflate.c", + "inflate.h", + "inftrees.c", + "inftrees.h", + "trees.c", + "trees.h", + "uncompr.c", + "zconf.h", + "zlib.h", + "zutil.c", + "zutil.h", + "google/compression_utils_portable.h", + "google/compression_utils_portable.cc", + ], + hdrs = [ + "zlib.h", + "google/compression_utils_portable.h", + ], + include_prefix = "third_party/zlib", + defines = [ + "CHROMIUM_ZLIB_NO_CHROMECONF", + "HAVE_HIDDEN", + "CPU_NO_SIMD", + ], + visibility = ["//visibility:public"], +)