gnu: protobuf: Update to 3.21.9.
* gnu/packages/protobuf.scm (protobuf): Update to 3.21.9. Move outputs field before build system. Move inputs field below arguments. [source]: Apply patch and update URL. [build-system]: Use cmake-build-system. This causes the CMake support files to be installed, which is expected by some packages such as hyperledger-iroha. [arguments]: Use gexps. [configure-flags]: Add BUILD_SHARED_LIBS=ON. [phases]: Add set-c++-standard. [home-page]: Update URL. (protobuf-3.6): Adjust to continue using the gnu-build-system. * gnu/packages/patches/protobuf-fix-build-on-32bit.patch: New patch. * gnu/local.mk (dist_patch_DATA): Register it.master
parent
68c2ed9714
commit
9f6479ecad
|
@ -1677,6 +1677,7 @@ dist_patch_DATA = \
|
||||||
%D%/packages/patches/procmail-ambiguous-getline-debian.patch \
|
%D%/packages/patches/procmail-ambiguous-getline-debian.patch \
|
||||||
%D%/packages/patches/procmail-CVE-2014-3618.patch \
|
%D%/packages/patches/procmail-CVE-2014-3618.patch \
|
||||||
%D%/packages/patches/procmail-CVE-2017-16844.patch \
|
%D%/packages/patches/procmail-CVE-2017-16844.patch \
|
||||||
|
%D%/packages/patches/protobuf-fix-build-on-32bit.patch \
|
||||||
%D%/packages/patches/psm-arch.patch \
|
%D%/packages/patches/psm-arch.patch \
|
||||||
%D%/packages/patches/psm-disable-memory-stats.patch \
|
%D%/packages/patches/psm-disable-memory-stats.patch \
|
||||||
%D%/packages/patches/psm-ldflags.patch \
|
%D%/packages/patches/psm-ldflags.patch \
|
||||||
|
|
|
@ -0,0 +1,139 @@
|
||||||
|
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
|
||||||
|
|
||||||
|
---
|
||||||
|
Edited to remove the patches touching the php directory.
|
||||||
|
|
||||||
|
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 8b436bc20c..84da3c5465 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
|
||||||
|
|
||||||
|
---
|
||||||
|
.../compiler/cpp/message_size_unittest.cc | 2 +-
|
||||||
|
.../protobuf/io/zero_copy_stream_unittest.cc | 3 ++
|
||||||
|
.../protobuf/repeated_field_unittest.cc | 4 +--
|
||||||
|
src/google/protobuf/util/time_util_test.cc | 28 +++++++++++--------
|
||||||
|
4 files changed, 23 insertions(+), 14 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/google/protobuf/compiler/cpp/message_size_unittest.cc b/src/google/protobuf/compiler/cpp/message_size_unittest.cc
|
||||||
|
index a75d77a70c..ed4a90e223 100644
|
||||||
|
--- a/src/google/protobuf/compiler/cpp/message_size_unittest.cc
|
||||||
|
+++ b/src/google/protobuf/compiler/cpp/message_size_unittest.cc
|
||||||
|
@@ -139,9 +139,9 @@ TEST(GeneratedMessageTest, OneStringSize) {
|
||||||
|
|
||||||
|
TEST(GeneratedMessageTest, MoreStringSize) {
|
||||||
|
struct MockGenerated : public MockMessageBase { // 16 bytes
|
||||||
|
- int has_bits[1]; // 4 bytes
|
||||||
|
int cached_size; // 4 bytes
|
||||||
|
MockRepeatedPtrField data; // 24 bytes
|
||||||
|
+ // + 4 bytes padding
|
||||||
|
};
|
||||||
|
GOOGLE_CHECK_MESSAGE_SIZE(MockGenerated, 48);
|
||||||
|
EXPECT_EQ(sizeof(protobuf_unittest::MoreString), sizeof(MockGenerated));
|
||||||
|
diff --git a/src/google/protobuf/io/zero_copy_stream_unittest.cc b/src/google/protobuf/io/zero_copy_stream_unittest.cc
|
||||||
|
index d82354e571..d656da5f13 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 eb0b9091cf..3baf6f25bb 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 464e57b4ee..dceb6dbe2b 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);
|
||||||
|
n@@ -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.
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#:use-module (guix build-system ruby)
|
#:use-module (guix build-system ruby)
|
||||||
#:use-module ((guix licenses) #:prefix license:)
|
#:use-module ((guix licenses) #:prefix license:)
|
||||||
#:use-module (guix utils)
|
#:use-module (guix utils)
|
||||||
|
#:use-module (gnu packages)
|
||||||
#:use-module (gnu packages build-tools)
|
#:use-module (gnu packages build-tools)
|
||||||
#:use-module (gnu packages compression)
|
#:use-module (gnu packages compression)
|
||||||
#:use-module (gnu packages check)
|
#:use-module (gnu packages check)
|
||||||
|
@ -48,7 +49,8 @@
|
||||||
#:use-module (gnu packages python-check)
|
#:use-module (gnu packages python-check)
|
||||||
#:use-module (gnu packages python-xyz)
|
#:use-module (gnu packages python-xyz)
|
||||||
#:use-module (gnu packages rpc)
|
#:use-module (gnu packages rpc)
|
||||||
#:use-module (gnu packages ruby))
|
#:use-module (gnu packages ruby)
|
||||||
|
#:use-module (srfi srfi-1))
|
||||||
|
|
||||||
(define-public fstrm
|
(define-public fstrm
|
||||||
(package
|
(package
|
||||||
|
@ -91,55 +93,69 @@ data in motion, or as a file format for data at rest.")
|
||||||
(define-public protobuf
|
(define-public protobuf
|
||||||
(package
|
(package
|
||||||
(name "protobuf")
|
(name "protobuf")
|
||||||
(version "3.17.3")
|
(version "3.21.9")
|
||||||
(source (origin
|
(source (origin
|
||||||
(method url-fetch)
|
(method url-fetch)
|
||||||
(uri (string-append "https://github.com/google/protobuf/releases/"
|
(uri (string-append
|
||||||
"download/v" version "/protobuf-cpp-"
|
"https://github.com/protocolbuffers/"
|
||||||
version ".tar.gz"))
|
"protobuf/releases/download/v"
|
||||||
|
(string-join (drop (string-split version #\.) 1) ".")
|
||||||
|
"/protobuf-cpp-" version ".tar.gz"))
|
||||||
|
(modules '((guix build utils)))
|
||||||
|
(snippet '(delete-file-recursively "third_party"))
|
||||||
(sha256
|
(sha256
|
||||||
(base32
|
(base32
|
||||||
"1jzqrklhj9grs6xbddyb5dyxfbgbgbyhl5zig8ml50wb22gwkkji"))))
|
"01cl4l0rnnzjbhjjs2gyg2pk13505gh86ikh22jqjp54dp8mvp5x"))
|
||||||
(build-system gnu-build-system)
|
(patches (search-patches "protobuf-fix-build-on-32bit.patch"))))
|
||||||
(inputs (list zlib))
|
|
||||||
(outputs (list "out"
|
(outputs (list "out"
|
||||||
"static")) ; ~12 MiB of .a files
|
"static")) ; ~12 MiB of .a files
|
||||||
|
(build-system cmake-build-system)
|
||||||
(arguments
|
(arguments
|
||||||
`(#:phases
|
(list
|
||||||
(modify-phases %standard-phases
|
;; TODO: Add the BUILD_SHARED_LIBS flag to cmake-build-system.
|
||||||
(add-after 'unpack 'disable-broken-tests
|
#:configure-flags #~(list "-DBUILD_SHARED_LIBS=ON")
|
||||||
;; The following tests fail on 32 bit architectures such as
|
#:phases
|
||||||
;; i686-linux.
|
#~(modify-phases %standard-phases
|
||||||
(lambda _
|
(add-after 'unpack 'disable-broken-tests
|
||||||
(let-syntax ((disable-tests
|
;; The following tests fail on 32 bit architectures such as
|
||||||
(syntax-rules ()
|
;; i686-linux.
|
||||||
((_ file test ...)
|
(lambda _
|
||||||
(substitute* file
|
(let-syntax ((disable-tests
|
||||||
((test name)
|
(syntax-rules ()
|
||||||
(string-append "DISABLED_" name)) ...)))))
|
((_ file test ...)
|
||||||
;; See: https://github.com/protocolbuffers/protobuf/issues/8460.
|
(substitute* file
|
||||||
(disable-tests "src/google/protobuf/any_test.cc"
|
((test name)
|
||||||
"TestPackFromSerializationExceedsSizeLimit")
|
(string-append "DISABLED_" name)) ...)))))
|
||||||
;; See: https://github.com/protocolbuffers/protobuf/issues/8459.
|
;; See: https://github.com/protocolbuffers/protobuf/issues/8460.
|
||||||
(disable-tests "src/google/protobuf/arena_unittest.cc"
|
(disable-tests "src/google/protobuf/any_test.cc"
|
||||||
"SpaceAllocated_and_Used"
|
"TestPackFromSerializationExceedsSizeLimit")
|
||||||
"BlockSizeSmallerThanAllocation")
|
;; See: https://github.com/protocolbuffers/protobuf/issues/8459.
|
||||||
;; See: https://github.com/protocolbuffers/protobuf/issues/8082.
|
(disable-tests "src/google/protobuf/arena_unittest.cc"
|
||||||
(disable-tests "src/google/protobuf/io/zero_copy_stream_unittest.cc"
|
"SpaceAllocated_and_Used"
|
||||||
"LargeOutput"))))
|
"BlockSizeSmallerThanAllocation")
|
||||||
(add-after 'install 'move-static-libraries
|
;; See: https://github.com/protocolbuffers/protobuf/issues/8082.
|
||||||
(lambda* (#:key outputs #:allow-other-keys)
|
(disable-tests "src/google/protobuf/io/zero_copy_stream_unittest.cc"
|
||||||
;; Move static libraries to the "static" output.
|
"LargeOutput"))))
|
||||||
(let* ((out (assoc-ref outputs "out"))
|
(add-before 'configure 'set-c++-standard
|
||||||
(lib (string-append out "/lib"))
|
(lambda _
|
||||||
(static (assoc-ref outputs "static"))
|
(substitute* "CMakeLists.txt"
|
||||||
(slib (string-append static "/lib")))
|
;; The 32bit patch requires C++14.
|
||||||
(mkdir-p slib)
|
;; TODO: Remove after next release.
|
||||||
(for-each (lambda (file)
|
(("CMAKE_CXX_STANDARD 11") "CMAKE_CXX_STANDARD 14"))))
|
||||||
(install-file file slib)
|
(add-after 'install 'move-static-libraries
|
||||||
(delete-file file))
|
(lambda* (#:key outputs #:allow-other-keys)
|
||||||
(find-files lib "\\.a$"))))))))
|
;; Move static libraries to the "static" output.
|
||||||
(home-page "https://github.com/google/protobuf")
|
(let* ((out (assoc-ref outputs "out"))
|
||||||
|
(lib (string-append out "/lib"))
|
||||||
|
(static (assoc-ref outputs "static"))
|
||||||
|
(slib (string-append static "/lib")))
|
||||||
|
(mkdir-p slib)
|
||||||
|
(for-each (lambda (file)
|
||||||
|
(install-file file slib)
|
||||||
|
(delete-file file))
|
||||||
|
(find-files lib "\\.a$"))))))))
|
||||||
|
(inputs (list zlib))
|
||||||
|
(home-page "https://github.com/protocolbuffers/protobuf")
|
||||||
(synopsis "Data encoding for remote procedure calls (RPCs)")
|
(synopsis "Data encoding for remote procedure calls (RPCs)")
|
||||||
(description
|
(description
|
||||||
"Protocol Buffers are a way of encoding structured data in an efficient
|
"Protocol Buffers are a way of encoding structured data in an efficient
|
||||||
|
@ -159,7 +175,14 @@ internal RPC protocols and file formats.")
|
||||||
version ".tar.gz"))
|
version ".tar.gz"))
|
||||||
(sha256
|
(sha256
|
||||||
(base32
|
(base32
|
||||||
"0a955bz59ihrb5wg7dwi12xajdi5pmz4bl0g147rbdwv393jwwxk"))))))
|
"0a955bz59ihrb5wg7dwi12xajdi5pmz4bl0g147rbdwv393jwwxk"))))
|
||||||
|
(build-system gnu-build-system)
|
||||||
|
(arguments (substitute-keyword-arguments (package-arguments protobuf)
|
||||||
|
((#:configure-flags _ #f)
|
||||||
|
#~(list))
|
||||||
|
((#:phases phases)
|
||||||
|
#~(modify-phases #$phases
|
||||||
|
(delete 'set-c++-standard)))))))
|
||||||
|
|
||||||
;; The 3.5 series are the last versions that do not require C++ 11.
|
;; The 3.5 series are the last versions that do not require C++ 11.
|
||||||
(define-public protobuf-3.5
|
(define-public protobuf-3.5
|
||||||
|
|
Reference in New Issue