forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
protobuf.patch
151 lines (145 loc) · 4.56 KB
/
protobuf.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
diff --git a/BUILD.bazel b/BUILD.bazel
index 0f6e41e3a..c0d2bbccf 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -454,14 +454,79 @@ cc_library(
visibility = ["//visibility:public"],
)
+# Envoy: Patch
+
cc_binary(
- name = "protoc",
+ name = "compiled_protoc",
copts = COPTS,
linkopts = LINK_OPTS,
visibility = ["//visibility:public"],
deps = ["//src/google/protobuf/compiler:protoc_lib"],
)
+# Lifted from `rules_proto`
+config_setting(
+ name = "linux-aarch_64",
+ constraint_values = [
+ "@platforms//os:linux",
+ "@platforms//cpu:aarch64",
+ ],
+)
+
+config_setting(
+ name = "linux-x86_64",
+ constraint_values = [
+ "@platforms//os:linux",
+ "@platforms//cpu:x86_64",
+ ],
+)
+
+config_setting(
+ name = "osx-aarch_64",
+ constraint_values = [
+ "@platforms//os:osx",
+ "@platforms//cpu:aarch64",
+ ],
+)
+
+config_setting(
+ name = "osx-x86_64",
+ constraint_values = [
+ "@platforms//os:osx",
+ "@platforms//cpu:x86_64",
+ ],
+)
+
+config_setting(
+ name = "win64",
+ constraint_values = [
+ "@platforms//os:windows",
+ "@platforms//cpu:x86_64",
+ ],
+)
+
+# Use precompiled binaries where possible.
+alias(
+ name = "protoc",
+ actual = select({
+ ":linux-aarch_64": "@com_google_protobuf_protoc_linux_aarch_64//:protoc",
+ ":linux-x86_64": "@com_google_protobuf_protoc_linux_x86_64//:protoc",
+ ":osx-aarch_64": "@com_google_protobuf_protoc_osx_aarch_64//:protoc",
+ ":osx-x86_64": "@com_google_protobuf_protoc_osx_x86_64//:protoc",
+ ":win64": "@com_google_protobuf_protoc_win64//:protoc",
+ "//conditions:default": ":compiled_protoc",
+ }),
+ visibility = ["//visibility:public"],
+)
+
+alias(
+ name = "protobuf_python_genproto",
+ actual = "//python:well_known_types_py_pb2_genproto",
+ visibility = ["//visibility:public"],
+)
+
+# /Envoy: Patch
+
cc_binary(
name = "protoc_static",
copts = COPTS,
diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py
index e7555ee10..a93beb1c5 100644
--- a/python/google/protobuf/__init__.py
+++ b/python/google/protobuf/__init__.py
@@ -8,3 +8,10 @@
# Copyright 2007 Google Inc. All Rights Reserved.
__version__ = '5.26.1'
+
+
+if __name__ != '__main__':
+ try:
+ __import__('pkg_resources').declare_namespace(__name__)
+ except ImportError:
+ __path__ = __import__('pkgutil').extend_path(__path__, __name__)
diff --git a/src/google/protobuf/io/BUILD.bazel b/src/google/protobuf/io/BUILD.bazel
--- a/src/google/protobuf/io/BUILD.bazel
+++ b/src/google/protobuf/io/BUILD.bazel
@@ -138,7 +138,7 @@ cc_library(
"@com_google_absl//absl/log:absl_log",
] + select({
"//build_defs:config_msvc": [],
- "//conditions:default": ["@zlib"],
+ "//conditions:default": ["//external:zlib"],
}),
)
diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc
--- a/src/google/protobuf/port_def.inc 2023-06-27 01:17:34.917105764 +0000
+++ b/src/google/protobuf/port_def.inc 2023-06-27 01:18:12.069060142 +0000
@@ -1004,7 +1004,7 @@
#pragma clang diagnostic ignored "-Wshorten-64-to-32"
// Turn on -Wdeprecated-enum-enum-conversion. This deprecation comes in C++20
// via http://wg21.link/p1120r0.
-#pragma clang diagnostic error "-Wdeprecated-enum-enum-conversion"
+// #pragma clang diagnostic error "-Wdeprecated-enum-enum-conversion"
// This error has been generally flaky, but we need to disable it specifically
// to fix https://github.com/protocolbuffers/protobuf/issues/12313
#pragma clang diagnostic ignored "-Wunused-parameter"
diff --git a/src/google/protobuf/compiler/BUILD.bazel b/src/google/protobuf/compiler/BUILD.bazel
--- a/src/google/protobuf/compiler/BUILD.bazel
+++ b/src/google/protobuf/compiler/BUILD.bazel
@@ -306,7 +306,7 @@
srcs = ["retention.cc"],
hdrs = ["retention.h"],
strip_include_prefix = "/src",
- visibility = ["//src/google/protobuf:__subpackages__"],
+ visibility = ["//visibility:public"],
deps = [
"//src/google/protobuf",
"//src/google/protobuf:port",
diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc
index 1c6a24945..c27d0bf2a 100644
--- a/src/google/protobuf/port_def.inc
+++ b/src/google/protobuf/port_def.inc
@@ -1062,6 +1062,9 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3),
#pragma warning(disable: 4125)
#endif
+#if defined(__GNUC__)
+#pragma GCC diagnostic ignored "-Wundef"
+#endif
#if PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII
#define PROTOBUF_DEBUG true
#else