summaryrefslogtreecommitdiff
path: root/user
diff options
context:
space:
mode:
Diffstat (limited to 'user')
-rw-r--r--user/protobuf/32bit.patch121
-rw-r--r--user/protobuf/APKBUILD15
-rw-r--r--user/protobuf/cxx14.patch115
3 files changed, 247 insertions, 4 deletions
diff --git a/user/protobuf/32bit.patch b/user/protobuf/32bit.patch
new file mode 100644
index 000000000..4630d8afa
--- /dev/null
+++ b/user/protobuf/32bit.patch
@@ -0,0 +1,121 @@
+From 5f4a52d9bff7595ec47fb6727662a1cada3cd404 Mon Sep 17 00:00:00 2001
+From: Mike Kruskal <mkruskal@google.com>
+Date: Thu, 15 Sep 2022 10:23:23 -0700
+Subject: [PATCH 3/7] Patching static assert test failure
+
+---
+ src/google/protobuf/extension_set_unittest.cc | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/google/protobuf/extension_set_unittest.cc b/src/google/protobuf/extension_set_unittest.cc
+index 8b436bc20c9..84da3c5465a 100644
+--- a/src/google/protobuf/extension_set_unittest.cc
++++ b/src/google/protobuf/extension_set_unittest.cc
+@@ -855,8 +855,10 @@ TEST(ExtensionSetTest, SpaceUsedExcludingSelf) {
+ const size_t old_capacity = \
+ message->GetRepeatedExtension(unittest::repeated_##type##_extension) \
+ .Capacity(); \
+- EXPECT_GE(old_capacity, \
+- (RepeatedFieldLowerClampLimit<cpptype, sizeof(void*)>())); \
++ EXPECT_GE( \
++ old_capacity, \
++ (RepeatedFieldLowerClampLimit<cpptype, std::max(sizeof(cpptype), \
++ sizeof(void*))>())); \
+ for (int i = 0; i < 16; ++i) { \
+ message->AddExtension(unittest::repeated_##type##_extension, value); \
+ } \
+
+From c94b66706bec17d918495f4715183a5eaf0f8044 Mon Sep 17 00:00:00 2001
+From: Mike Kruskal <mkruskal@google.com>
+Date: Thu, 15 Sep 2022 11:31:31 -0700
+Subject: [PATCH 4/7] Test fixes for 32-bit architectures
+
+---
+ .../protobuf/io/zero_copy_stream_unittest.cc | 3 ++
+ .../protobuf/repeated_field_unittest.cc | 4 +--
+ src/google/protobuf/util/time_util_test.cc | 28 +++++++++++--------
+ 3 files changed, 22 insertions(+), 13 deletions(-)
+
+diff --git a/src/google/protobuf/io/zero_copy_stream_unittest.cc b/src/google/protobuf/io/zero_copy_stream_unittest.cc
+index d82354e571b..d656da5f13b 100644
+--- a/src/google/protobuf/io/zero_copy_stream_unittest.cc
++++ b/src/google/protobuf/io/zero_copy_stream_unittest.cc
+@@ -720,6 +720,9 @@ TEST_F(IoTest, StringIo) {
+
+ // Verifies that outputs up to kint32max can be created.
+ TEST_F(IoTest, LargeOutput) {
++ // Filter out this test on 32-bit architectures.
++ if(sizeof(void*) < 8) return;
++
+ std::string str;
+ StringOutputStream output(&str);
+ void* unused_data;
+diff --git a/src/google/protobuf/repeated_field_unittest.cc b/src/google/protobuf/repeated_field_unittest.cc
+index eb0b9091cf8..3baf6f25bb2 100644
+--- a/src/google/protobuf/repeated_field_unittest.cc
++++ b/src/google/protobuf/repeated_field_unittest.cc
+@@ -429,14 +429,14 @@ TEST(RepeatedField, ReserveNothing) {
+
+ TEST(RepeatedField, ReserveLowerClamp) {
+ int clamped_value = internal::CalculateReserveSize<bool, sizeof(void*)>(0, 1);
+- EXPECT_GE(clamped_value, 8 / sizeof(bool));
++ EXPECT_GE(clamped_value, sizeof(void*) / sizeof(bool));
+ EXPECT_EQ((internal::RepeatedFieldLowerClampLimit<bool, sizeof(void*)>()),
+ clamped_value);
+ // EXPECT_EQ(clamped_value, (internal::CalculateReserveSize<bool,
+ // sizeof(void*)>( clamped_value, 2)));
+
+ clamped_value = internal::CalculateReserveSize<int, sizeof(void*)>(0, 1);
+- EXPECT_GE(clamped_value, 8 / sizeof(int));
++ EXPECT_GE(clamped_value, sizeof(void*) / sizeof(int));
+ EXPECT_EQ((internal::RepeatedFieldLowerClampLimit<int, sizeof(void*)>()),
+ clamped_value);
+ // EXPECT_EQ(clamped_value, (internal::CalculateReserveSize<int,
+diff --git a/src/google/protobuf/util/time_util_test.cc b/src/google/protobuf/util/time_util_test.cc
+index 464e57b4ee5..dceb6dbe2bf 100644
+--- a/src/google/protobuf/util/time_util_test.cc
++++ b/src/google/protobuf/util/time_util_test.cc
+@@ -48,15 +48,18 @@ using google::protobuf::Timestamp;
+ namespace {
+
+ TEST(TimeUtilTest, TimestampStringFormat) {
+- Timestamp begin, end;
+- EXPECT_TRUE(TimeUtil::FromString("0001-01-01T00:00:00Z", &begin));
+- EXPECT_EQ(TimeUtil::kTimestampMinSeconds, begin.seconds());
+- EXPECT_EQ(0, begin.nanos());
+- EXPECT_TRUE(TimeUtil::FromString("9999-12-31T23:59:59.999999999Z", &end));
+- EXPECT_EQ(TimeUtil::kTimestampMaxSeconds, end.seconds());
+- EXPECT_EQ(999999999, end.nanos());
+- EXPECT_EQ("0001-01-01T00:00:00Z", TimeUtil::ToString(begin));
+- EXPECT_EQ("9999-12-31T23:59:59.999999999Z", TimeUtil::ToString(end));
++ // These these are out of bounds for 32-bit architectures.
++ if(sizeof(time_t) >= sizeof(uint64_t)) {
++ Timestamp begin, end;
++ EXPECT_TRUE(TimeUtil::FromString("0001-01-01T00:00:00Z", &begin));
++ EXPECT_EQ(TimeUtil::kTimestampMinSeconds, begin.seconds());
++ EXPECT_EQ(0, begin.nanos());
++ EXPECT_TRUE(TimeUtil::FromString("9999-12-31T23:59:59.999999999Z", &end));
++ EXPECT_EQ(TimeUtil::kTimestampMaxSeconds, end.seconds());
++ EXPECT_EQ(999999999, end.nanos());
++ EXPECT_EQ("0001-01-01T00:00:00Z", TimeUtil::ToString(begin));
++ EXPECT_EQ("9999-12-31T23:59:59.999999999Z", TimeUtil::ToString(end));
++ }
+
+ // Test negative timestamps.
+ Timestamp time = TimeUtil::NanosecondsToTimestamp(-1);
+@@ -94,9 +97,12 @@ TEST(TimeUtilTest, DurationStringFormat) {
+ EXPECT_TRUE(TimeUtil::FromString("0001-01-01T00:00:00Z", &begin));
+ EXPECT_TRUE(TimeUtil::FromString("9999-12-31T23:59:59.999999999Z", &end));
+
+- EXPECT_EQ("315537897599.999999999s", TimeUtil::ToString(end - begin));
++ // These these are out of bounds for 32-bit architectures.
++ if(sizeof(time_t) >= sizeof(uint64_t)) {
++ EXPECT_EQ("315537897599.999999999s", TimeUtil::ToString(end - begin));
++ EXPECT_EQ("-315537897599.999999999s", TimeUtil::ToString(begin - end));
++ }
+ EXPECT_EQ(999999999, (end - begin).nanos());
+- EXPECT_EQ("-315537897599.999999999s", TimeUtil::ToString(begin - end));
+ EXPECT_EQ(-999999999, (begin - end).nanos());
+
+ // Generated output should contain 3, 6, or 9 fractional digits.
+
diff --git a/user/protobuf/APKBUILD b/user/protobuf/APKBUILD
index c1c3b49af..e82d51e41 100644
--- a/user/protobuf/APKBUILD
+++ b/user/protobuf/APKBUILD
@@ -3,7 +3,7 @@
# Maintainer: Dan Theisen <djt@hxx.in>
pkgname=protobuf
_gemname=google-protobuf
-pkgver=3.20.1
+pkgver=3.20.3
_tstver=8d51dc50eb7e7698427fed81b85edad0e032112e
pkgrel=0
pkgdesc="Library for extensible, efficient structure packing"
@@ -19,9 +19,14 @@ makedepends="$depends_dev autoconf automake libtool ruby ruby-dev ruby-rake
checkdepends="ruby-json ruby-test-unit"
subpackages="ruby-$_gemname:_ruby py3-$pkgname:_python $pkgname-dev $pkgname-vim::noarch"
source="$pkgname-$pkgver.tar.gz::https://github.com/google/$pkgname/archive/v$pkgver.tar.gz
- googletest-$_tstver.tar.gz::https://github.com/google/googletest/archive/$_tstver.tar.gz"
+ googletest-$_tstver.tar.gz::https://github.com/google/googletest/archive/$_tstver.tar.gz
+ cxx14.patch
+ 32bit.patch
+ "
prepare() {
+ default_prepare
+
# symlink tests to the test directory
rm -rf third_party/googletest
ln -sf "$srcdir"/googletest-$_tstver \
@@ -114,5 +119,7 @@ vim() {
"$subpkgdir"/usr/share/vim/vimfiles/syntax/proto.vim
}
-sha512sums="fde3eb9f13946887ddfd87df428c5615ad09aaf191e4478b24e98e5e13231feeff4e70b4ca6a2ff7d9b9b2e2c60bc1d5479526edeafa78f9a8ed3bef2e0bacb0 protobuf-3.20.1.tar.gz
-f7f804abf68af5e4e6cd767151773394fb8297d7d7fc878532ebb22b8c41d13554f68fa38a27470d458b590259a939e93cee7e5f5f6de8f1726c7ce85a606099 googletest-8d51dc50eb7e7698427fed81b85edad0e032112e.tar.gz"
+sha512sums="01d6703bdbe769a1200ee6e4ebcdcb99688ec21f576988c60d82ec36e0822820fb245fcb4ca53293143d53e666d748b5a0c6937bc659fb3cdc4cd9b05ed12a1c protobuf-3.20.3.tar.gz
+f7f804abf68af5e4e6cd767151773394fb8297d7d7fc878532ebb22b8c41d13554f68fa38a27470d458b590259a939e93cee7e5f5f6de8f1726c7ce85a606099 googletest-8d51dc50eb7e7698427fed81b85edad0e032112e.tar.gz
+faf8962f0c7f1e4053b28a712b31ac9b254b17986326d2188d6edcc609f4b52f4cb85766c4bc02c6b9bc7bc30e2061f940a3089db54eb6056f729a80c1cfa891 cxx14.patch
+2dfb540395460f0ea9fad663851633b29fa368a6ec99a88a42e31d7547034191679ef868c0ec67613d070659d4e322dc942b54b21793764e3d2342927977c7eb 32bit.patch"
diff --git a/user/protobuf/cxx14.patch b/user/protobuf/cxx14.patch
new file mode 100644
index 000000000..bd7b5c374
--- /dev/null
+++ b/user/protobuf/cxx14.patch
@@ -0,0 +1,115 @@
+From 500cbd7b90fa7eb5716a3bbc6aa788ada028a1bf Mon Sep 17 00:00:00 2001
+From: Adam Cozzette <acozzette@google.com>
+Date: Thu, 11 Aug 2022 18:22:15 -0700
+Subject: [PATCH] Upgrade third_party/googletest submodule to current main
+ branch (#10393)
+
+* Upgrade third_party/googletest submodule to current main branch
+
+We can finally do this upgrade now that we have dropped our autotools
+build. Googletest recommends living at head, so let's go straight to the
+most recent commit on main. For some reason the googletest archive is
+not present in the Bazel build mirror, so I removed that entry and just
+left the GitHub download link in our WORKSPACE file.
+
+Googletest now requires C++14, so I updated all the C++11 flags I could
+find to C++14 instead. I added a .bazelrc file to add -std=c++14 for all
+our Bazel builds.
+
+* Delete the empty //src/google/protobuf:protobuf_test target
+
+* Avoid building C++ unit tests in aarch64 jobs for Python and Ruby
+---
+ .bazelrc | 1 +
+ CMakeLists.txt | 8 ++++----
+ WORKSPACE | 7 +++----
+ examples/Makefile | 4 ++--
+ python/setup.py | 2 +-
+ 5 files changed, 14 insertions(+), 24 deletions(-)
+ create mode 100644 .bazelrc
+
+diff --git a/.bazelrc b/.bazelrc
+new file mode 100644
+index 00000000000..f93facf00a8
+--- /dev/null
++++ b/.bazelrc
+@@ -0,0 +1 @@
++build --cxxopt=-std=c++14
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 345d7d05a49..b343c64e48e 100644
+--- a/cmake/CMakeLists.txt
++++ b/cmake/CMakeLists.txt
+@@ -32,11 +32,11 @@ if(protobuf_DEPRECATED_CMAKE_SUBDIRECTORY_USAGE)
+ get_filename_component(protobuf_SOURCE_DIR ${protobuf_SOURCE_DIR} DIRECTORY)
+ endif()
+
+-# Add c++11 flags
++# Add c++14 flags
+ if (CYGWIN)
+- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14")
+ else()
+- set(CMAKE_CXX_STANDARD 11)
++ set(CMAKE_CXX_STANDARD 14)
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
+ set(CMAKE_CXX_EXTENSIONS OFF)
+ endif()
+@@ -187,7 +187,7 @@ set(protobuf_LINK_LIBATOMIC false)
+ if (NOT MSVC)
+ include(CheckCXXSourceCompiles)
+ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+- set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -std=c++11)
++ set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -std=c++14)
+ check_cxx_source_compiles("
+ #include <atomic>
+ int main() {
+diff --git a/WORKSPACE b/WORKSPACE
+index ebe53315f03..20e7415a629 100644
+--- a/WORKSPACE
++++ b/WORKSPACE
+@@ -9,11 +9,10 @@ local_repository(
+
+ http_archive(
+ name = "com_google_googletest",
+- sha256 = "9dc9157a9a1551ec7a7e43daea9a694a0bb5fb8bec81235d8a1e6ef64c716dcb",
+- strip_prefix = "googletest-release-1.10.0",
++ sha256 = "ea54c9845568cb31c03f2eddc7a40f7f83912d04ab977ff50ec33278119548dd",
++ strip_prefix = "googletest-4c9a3bb62bf3ba1f1010bf96f9c8ed767b363774",
+ urls = [
+- "https://mirror.bazel.build/github.com/google/googletest/archive/release-1.10.0.tar.gz",
+- "https://github.com/google/googletest/archive/release-1.10.0.tar.gz",
++ "https://github.com/google/googletest/archive/4c9a3bb62bf3ba1f1010bf96f9c8ed767b363774.tar.gz",
+ ],
+ )
+
+diff --git a/examples/Makefile b/examples/Makefile
+index 2a64b64fe37..ef7a4ef58e9 100644
+--- a/examples/Makefile
++++ b/examples/Makefile
+@@ -41,11 +41,11 @@ protoc_middleman_dart: addressbook.proto
+
+ add_person_cpp: add_person.cc protoc_middleman
+ pkg-config --cflags protobuf # fails if protobuf is not installed
+- c++ -std=c++11 add_person.cc addressbook.pb.cc -o add_person_cpp `pkg-config --cflags --libs protobuf`
++ c++ -std=c++14 add_person.cc addressbook.pb.cc -o add_person_cpp `pkg-config --cflags --libs protobuf`
+
+ list_people_cpp: list_people.cc protoc_middleman
+ pkg-config --cflags protobuf # fails if protobuf is not installed
+- c++ -std=c++11 list_people.cc addressbook.pb.cc -o list_people_cpp `pkg-config --cflags --libs protobuf`
++ c++ -std=c++14 list_people.cc addressbook.pb.cc -o list_people_cpp `pkg-config --cflags --libs protobuf`
+
+ add_person_dart: add_person.dart protoc_middleman_dart
+
+diff --git a/python/setup.py b/python/setup.py
+index 283c99af607..3364ba9f7ad 100755
+--- a/python/setup.py
++++ b/python/setup.py
+@@ -331,7 +331,7 @@ def HasLibraryDirsOpt():
+ extra_compile_args.append('-Wno-invalid-offsetof')
+ extra_compile_args.append('-Wno-sign-compare')
+ extra_compile_args.append('-Wno-unused-variable')
+- extra_compile_args.append('-std=c++11')
++ extra_compile_args.append('-std=c++14')
+
+ if sys.platform == 'darwin':
+ extra_compile_args.append('-Wno-shorten-64-to-32')