From c9c4709c844b90b9bb2935d784a428d667c9df7d Mon Sep 17 00:00:00 2001 From: Dhi Aurrahman Date: Fri, 7 Aug 2020 07:22:54 +0700 Subject: [PATCH] build: Update ICU and googleurl (#12376) This patch updates ICU to 67.1 and googleurl to https://quiche.googlesource.com/googleurl/+/ef0d23689e240e6c8de4c3a5296b209128c87373. This reduces `bazel/external/googleurl.patch` to only handling MSVC quirks. Please note that googleurl direction for Windows is to use clang-cl, while we still use msvc-cl (hence the patch). Risk Level: Low Testing: Existing Docs Changes: N/A Release Notes: N/A Fixes #12015 Signed-off-by: Dhi Aurrahman --- .bazelrc | 3 + bazel/external/googleurl.patch | 101 ++++++--------------------------- bazel/external/icuuc.BUILD | 22 +++---- bazel/repositories.bzl | 5 -- bazel/repository_locations.bzl | 13 +++-- 5 files changed, 36 insertions(+), 108 deletions(-) diff --git a/.bazelrc b/.bazelrc index 393c54d63b70..1cb3caaa6a9f 100644 --- a/.bazelrc +++ b/.bazelrc @@ -33,6 +33,9 @@ build --action_env=CXX build --action_env=LLVM_CONFIG build --action_env=PATH +# Skip system ICU linking. +build --@com_googlesource_googleurl//build_config:system_icu=0 + # Common flags for sanitizers build:sanitizer --define tcmalloc=disabled build:sanitizer --linkopt -ldl diff --git a/bazel/external/googleurl.patch b/bazel/external/googleurl.patch index fe867e5bedc6..fb33ca4475fb 100644 --- a/bazel/external/googleurl.patch +++ b/bazel/external/googleurl.patch @@ -2,7 +2,7 @@ # clang-cl. Tracked in https://github.com/envoyproxy/envoy/issues/11974. diff --git a/base/compiler_specific.h b/base/compiler_specific.h -index 2962537..6193b56 100644 +index 0cd36dc..8c4cbd4 100644 --- a/base/compiler_specific.h +++ b/base/compiler_specific.h @@ -7,10 +7,6 @@ @@ -16,7 +16,21 @@ index 2962537..6193b56 100644 // Annotate a variable indicating it's ok if the variable is not used. // (Typically used to silence a compiler warning when the assignment // is important for some other reason.) -@@ -212,7 +208,9 @@ +@@ -55,8 +51,12 @@ + // prevent code folding, see gurl_base::debug::Alias. + // Use like: + // void NOT_TAIL_CALLED FooBar(); +-#if defined(__clang__) && __has_attribute(not_tail_called) ++#if defined(__clang__) ++#if defined(__has_attribute) ++#if __has_attribute(not_tail_called) + #define NOT_TAIL_CALLED __attribute__((not_tail_called)) ++#endif ++#endif + #else + #define NOT_TAIL_CALLED + #endif +@@ -226,7 +226,9 @@ #endif #endif @@ -27,7 +41,7 @@ index 2962537..6193b56 100644 // Attribute "uninitialized" disables -ftrivial-auto-var-init=pattern for // the specified variable. // Library-wide alternative is -@@ -243,6 +241,8 @@ +@@ -257,6 +259,8 @@ // E.g. platform, bot, benchmark or test name in patch description or next to // the attribute. #define STACK_UNINITIALIZED __attribute__((uninitialized)) @@ -36,84 +50,3 @@ index 2962537..6193b56 100644 #else #define STACK_UNINITIALIZED #endif -diff --git a/base/strings/BUILD b/base/strings/BUILD -index 7a06170..7c86a5f 100644 ---- a/base/strings/BUILD -+++ b/base/strings/BUILD -@@ -6,23 +6,21 @@ load("//:build_config.bzl", "build_config") - cc_library( - name = "strings", - srcs = [ -- "string16.cc", - "string_piece.cc", - "string_util.cc", - "string_util_constants.cc", - "utf_string_conversion_utils.cc", - "utf_string_conversions.cc", -- ], -+ ] + build_config.strings_srcs, - hdrs = [ - "char_traits.h", - "string16.h", - "string_piece.h", - "string_piece_forward.h", - "string_util.h", -- "string_util_posix.h", - "utf_string_conversion_utils.h", - "utf_string_conversions.h", -- ], -+ ] + build_config.strings_hdrs, - copts = build_config.default_copts, - visibility = ["//visibility:public"], - deps = [ -diff --git a/build_config.bzl b/build_config.bzl -index d5fca65..fc0d7e5 100644 ---- a/build_config/build_config.bzl -+++ b/build_config/build_config.bzl -@@ -1,8 +1,25 @@ --_default_copts = [ -- "-std=c++14", -- "-fno-strict-aliasing", --] -+_default_copts = select({ -+ "@envoy//bazel:windows_x86_64": [ -+ "/std:c++17", -+ ], -+ "//conditions:default": [ -+ "-std=c++17", -+ "-fno-strict-aliasing", -+ ], -+}) -+ -+_strings_srcs = select({ -+ "@envoy//bazel:windows_x86_64": [], -+ "//conditions:default": ["string16.cc"], -+}) -+ -+_strings_hdrs = select({ -+ "@envoy//bazel:windows_x86_64": ["string_util_win.h"], -+ "//conditions:default": ["string_util_posix.h"], -+}) - - build_config = struct( - default_copts = _default_copts, -+ strings_srcs = _strings_srcs, -+ strings_hdrs = _strings_hdrs, - ) -diff --git a/url/BUILD b/url/BUILD -index 0126bdc..5d1a171 100644 ---- a/url/BUILD -+++ b/url/BUILD -@@ -43,11 +43,11 @@ cc_library( - "url_util.h", - ], - copts = build_config.default_copts, -- linkopts = ["-licuuc"], - visibility = ["//visibility:public"], - deps = [ - "//base", - "//base/strings", - "//polyfills", -+ "@org_unicode_icuuc//:common", - ], - ) diff --git a/bazel/external/icuuc.BUILD b/bazel/external/icuuc.BUILD index e910a64af1aa..305d0db952b1 100644 --- a/bazel/external/icuuc.BUILD +++ b/bazel/external/icuuc.BUILD @@ -2,10 +2,7 @@ load("@rules_cc//cc:defs.bzl", "cc_library") licenses(["notice"]) # Apache 2 -exports_files([ - "icu4c/LICENSE", - "icu4j/main/shared/licenses/LICENSE", -]) +exports_files(["LICENSE"]) icuuc_copts = [ "-DU_STATIC_IMPLEMENTATION", @@ -31,15 +28,15 @@ icuuc_copts = [ cc_library( name = "headers", - hdrs = glob(["icu4c/source/common/unicode/*.h"]), - includes = ["icu4c/source/common"], + hdrs = glob(["source/common/unicode/*.h"]), + includes = ["source/common"], visibility = ["//visibility:public"], ) cc_library( name = "common", - hdrs = glob(["icu4c/source/common/unicode/*.h"]), - includes = ["icu4c/source/common"], + hdrs = glob(["source/common/unicode/*.h"]), + includes = ["source/common"], visibility = ["//visibility:public"], deps = [":icuuc"], ) @@ -47,13 +44,12 @@ cc_library( cc_library( name = "icuuc", srcs = glob([ - "icu4c/source/common/*.c", - "icu4c/source/common/*.cpp", - "icu4c/source/stubdata/*.cpp", + "source/common/*.c", + "source/common/*.cpp", + "source/stubdata/*.cpp", ]), - hdrs = glob(["icu4c/source/common/*.h"]), + hdrs = glob(["source/common/*.h"]), copts = icuuc_copts, - tags = ["requires-rtti"], visibility = ["//visibility:private"], deps = [":headers"], ) diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index bf1827cf8c66..4e0293ef288b 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -903,11 +903,6 @@ def _org_unicode_icuuc(): _repository_impl( name = "org_unicode_icuuc", build_file = "@envoy//bazel/external:icuuc.BUILD", - # TODO(dio): Consider patching udata when we need to embed some data. - ) - native.bind( - name = "icuuc", - actual = "@org_unicode_icuuc//:common", ) def _foreign_cc_dependencies(): diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index 096d1b8ae77b..145da07e7f25 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -417,9 +417,10 @@ DEPENDENCY_REPOSITORIES = dict( cpe = "N/A", ), com_googlesource_googleurl = dict( - # Static snapshot of https://quiche.googlesource.com/quiche/+archive/googleurl_6dafefa72cba2ab2ba4922d17a30618e9617c7cf.tar.gz - sha256 = "f1ab73ddd1a7db4e08a9e4db6c2e98e5a0a7bbaca08f5fee0d73adb02c24e44a", - urls = ["https://storage.googleapis.com/quiche-envoy-integration/googleurl_6dafefa72cba2ab2ba4922d17a30618e9617c7cf.tar.gz"], + # Static snapshot of https://quiche.googlesource.com/quiche/+archive/ef0d23689e240e6c8de4c3a5296b209128c87373.tar.gz. + sha256 = "d769283fed1319bca68bae8bdd47fbc3a7933999329eee850eff1f1ea61ce176", + # 2020-08-05 + urls = ["https://storage.googleapis.com/quiche-envoy-integration/googleurl_ef0d23689e240e6c8de4c3a5296b209128c87373.tar.gz"], use_category = ["dataplane"], cpe = "N/A", ), @@ -484,9 +485,9 @@ DEPENDENCY_REPOSITORIES = dict( use_category = ["test"], ), org_unicode_icuuc = dict( - strip_prefix = "icu-release-64-2", - sha256 = "524960ac99d086cdb6988d2a92fc163436fd3c6ec0a84c475c6382fbf989be05", - urls = ["https://github.com/unicode-org/icu/archive/release-64-2.tar.gz"], + strip_prefix = "icu", + sha256 = "94a80cd6f251a53bd2a997f6f1b5ac6653fe791dfab66e1eb0227740fb86d5dc", + urls = ["https://github.com/unicode-org/icu/releases/download/release-67-1/icu4c-67_1-src.tgz"], use_category = ["dataplane"], cpe = "cpe:2.3:a:icu-project:international_components_for_unicode", ),