diff --git a/backport-Makefile.am-Remove-conditional-BUILD_PROTO3-rules.patch b/backport-Makefile.am-Remove-conditional-BUILD_PROTO3-rules.patch new file mode 100644 index 0000000000000000000000000000000000000000..3cb45f72b82f9c42e8d47896dda1717a0d96fcad --- /dev/null +++ b/backport-Makefile.am-Remove-conditional-BUILD_PROTO3-rules.patch @@ -0,0 +1,127 @@ +From 5c4be20f1bf59f1abad41d69ec3c80596d346a7f Mon Sep 17 00:00:00 2001 +From: Robert Edmonds +Date: Sat, 8 Jul 2023 23:11:54 -0400 +Subject: [PATCH 2/5] Makefile.am: Remove conditional BUILD_PROTO3 rules + +Now that we require protobuf >= 3.0.0, we are always building with +proto3 syntax support. + +Note that the test-generated-code3 test keeps `-DPROTO3` which is +separate from the HAVE_PROTO3 identifier. This test is building built +from the same source file as test-generated-code but the source file +supports proto2 and proto3 syntax depending on how it's compiled. +--- + Makefile.am | 48 ++++++++++++++++++------------------------------ + 1 file changed, 18 insertions(+), 30 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 86864a7..ff12664 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -139,11 +139,13 @@ LOG_COMPILER = $(VALGRIND) + check_PROGRAMS += \ + t/generated-code/test-generated-code \ + t/generated-code2/test-generated-code2 \ ++ t/generated-code3/test-generated-code3 \ + t/version/version + + TESTS += \ + t/generated-code/test-generated-code \ + t/generated-code2/test-generated-code2 \ ++ t/generated-code3/test-generated-code3 \ + t/version/version + + t_generated_code_test_generated_code_SOURCES = \ +@@ -159,6 +161,16 @@ t_generated_code2_test_generated_code2_SOURCES = \ + t_generated_code2_test_generated_code2_LDADD = \ + protobuf-c/libprotobuf-c.la + ++t_generated_code3_test_generated_code3_CPPFLAGS = \ ++ -DPROTO3 ++ ++t_generated_code3_test_generated_code3_SOURCES = \ ++ t/generated-code/test-generated-code.c \ ++ t/test-proto3.pb-c.c ++ ++t_generated_code3_test_generated_code3_LDADD = \ ++ protobuf-c/libprotobuf-c.la ++ + noinst_PROGRAMS += \ + t/generated-code2/cxx-generate-packed-data + +@@ -185,6 +197,9 @@ t/test-full.pb-c.c t/test-full.pb-c.h: $(top_builddir)/protoc-c/protoc-gen-c$(EX + t/test-full.pb.cc t/test-full.pb.h: @PROTOC@ $(top_srcdir)/t/test-full.proto + $(AM_V_GEN)@PROTOC@ -I$(top_srcdir) --cpp_out=$(top_builddir) $(top_srcdir)/t/test-full.proto + ++t/test-proto3.pb-c.c t/test-proto3.pb-c.h: $(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) $(top_srcdir)/t/test-proto3.proto ++ $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) --c_out=$(top_builddir) $(top_srcdir)/t/test-proto3.proto ++ + t/generated-code2/test-full-cxx-output.inc: t/generated-code2/cxx-generate-packed-data$(EXEEXT) + $(AM_V_GEN)$(top_builddir)/t/generated-code2/cxx-generate-packed-data$(EXEEXT) > $(top_builddir)/t/generated-code2/test-full-cxx-output.inc + +@@ -193,34 +208,9 @@ BUILT_SOURCES += \ + t/test-full.pb-c.c t/test-full.pb-c.h \ + t/test-optimized.pb-c.c t/test-optimized.pb-c.h \ + t/test-full.pb.cc t/test-full.pb.h \ ++ t/test-proto3.pb-c.c t/test-proto3.pb-c.h \ + t/generated-code2/test-full-cxx-output.inc + +-if BUILD_PROTO3 +- +-check_PROGRAMS += \ +- t/generated-code3/test-generated-code3 +- +-TESTS += \ +- t/generated-code3/test-generated-code3 +- +-t_generated_code3_test_generated_code3_CPPFLAGS = \ +- -DPROTO3 +- +-t_generated_code3_test_generated_code3_LDADD = \ +- protobuf-c/libprotobuf-c.la +- +-t_generated_code3_test_generated_code3_SOURCES = \ +- t/generated-code/test-generated-code.c \ +- t/test-proto3.pb-c.c +- +-t/test-proto3.pb-c.c t/test-proto3.pb-c.h: $(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) $(top_srcdir)/t/test-proto3.proto +- $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) --c_out=$(top_builddir) $(top_srcdir)/t/test-proto3.proto +- +-BUILT_SOURCES += \ +- t/test-proto3.pb-c.c t/test-proto3.pb-c.h +- +-endif # BUILD_PROTO3 +- + t_version_version_SOURCES = \ + t/version/version.c + t_version_version_LDADD = \ +@@ -278,7 +268,6 @@ EXTRA_DIST += \ + t/issue251/issue251.proto + + # Issue #330 +-if BUILD_PROTO3 + check_PROGRAMS += \ + t/issue330/issue330 + TESTS += \ +@@ -292,6 +281,8 @@ t/issue330/issue330.pb-c.c t/issue330/issue330.pb-c.h: $(top_builddir)/protoc-c/ + $(AM_V_GEN)@PROTOC@ --plugin=protoc-gen-c=$(top_builddir)/protoc-c/protoc-gen-c$(EXEEXT) -I$(top_srcdir) --c_out=$(top_builddir) $(top_srcdir)/t/issue330/issue330.proto + BUILT_SOURCES += \ + t/issue330/issue330.pb-c.c t/issue330/issue330.pb-c.h ++EXTRA_DIST += \ ++ t/issue330/issue330.proto + + t_issue330_issue330_SOURCES += \ + t/issue389/issue389.pb-c.c # Tack onto issue330 since there is no need for a separate binary here +@@ -317,9 +308,6 @@ BUILT_SOURCES += \ + t/issue440/issue440.pb-c.c t/issue440/issue440.pb-c.h + EXTRA_DIST += \ + t/issue440/issue440.proto +-endif # BUILD_PROTO3 +-EXTRA_DIST += \ +- t/issue330/issue330.proto + + # Issue #375 + check_PROGRAMS += \ +-- +2.33.0 + diff --git a/backport-Update-autotools.patch b/backport-Update-autotools.patch new file mode 100644 index 0000000000000000000000000000000000000000..51978d8112a049d5597d3f60414e76bb440e9174 --- /dev/null +++ b/backport-Update-autotools.patch @@ -0,0 +1,32 @@ +From 59a3f1925ecec6481118e0d407a34fae15c54215 Mon Sep 17 00:00:00 2001 +From: Rose <83477269+AtariDreams@users.noreply.github.com> +Date: Sat, 6 May 2023 19:18:26 -0400 +Subject: [PATCH] Update autotools + +AC_PROG_CC_STDC is obsolete. Instead, AC_PROG_CC is recommended. +--- + configure.ac | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index f5a0261..94d01dc 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1,4 +1,4 @@ +-AC_PREREQ(2.63) ++AC_PREREQ([2.63]) + + AC_INIT([protobuf-c], + [1.4.1], +@@ -11,7 +11,7 @@ AC_SUBST(PACKAGE_DESCRIPTION) + AC_CONFIG_SRCDIR([protobuf-c/protobuf-c.c]) + AC_CONFIG_AUX_DIR([build-aux]) + AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules subdir-objects]) +-AC_PROG_CC_STDC ++AC_PROG_CC + AC_PROG_CXX + AC_PROG_LN_S + AC_PROG_MKDIR_P +-- +2.33.0 + diff --git a/backport-Use-GOOGLE_LOG-FATAL-instead-of-GOOGLE_LOG-DFATAL.patch b/backport-Use-GOOGLE_LOG-FATAL-instead-of-GOOGLE_LOG-DFATAL.patch new file mode 100644 index 0000000000000000000000000000000000000000..ba408252b755d3b654b8c26f5ce8709469f3f493 --- /dev/null +++ b/backport-Use-GOOGLE_LOG-FATAL-instead-of-GOOGLE_LOG-DFATAL.patch @@ -0,0 +1,58 @@ +From 7b90330bff40ab555bb3f0c5ee43ae208a275104 Mon Sep 17 00:00:00 2001 +From: Robert Edmonds +Date: Sun, 2 Jul 2023 19:35:43 -0400 +Subject: [PATCH] Use GOOGLE_LOG(FATAL) instead of GOOGLE_LOG(DFATAL) + +Looking at where these identifiers are ultimately defined [0], it looks +like "DFATAL" means either "ERROR" or "FATAL" depending on whether +NDEBUG is defined. However, looking at the actual code sites in protoc-c +where DFATAL is used, it's not clear why we couldn't just use FATAL +unconditionally. + +This is aimed at supporting newer versions of protobuf where the DFATAL +identifier apparently no longer exists. + +[0] https://github.com/protocolbuffers/protobuf/blob/v21.12/src/google/protobuf/stubs/logging.h#L61-L65 +--- + protoc-c/c_message.cc | 4 ++-- + protoc-c/c_primitive_field.cc | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/protoc-c/c_message.cc b/protoc-c/c_message.cc +index 37e8bf8..af2974c 100755 +--- a/protoc-c/c_message.cc ++++ b/protoc-c/c_message.cc +@@ -499,7 +499,7 @@ GenerateMessageDescriptor(io::Printer* printer, bool gen_init) { + // NOTE: not supported by protobuf + vars["maybe_static"] = ""; + vars["field_dv_ctype"] = "{ ... }"; +- GOOGLE_LOG(DFATAL) << "Messages can't have default values!"; ++ GOOGLE_LOG(FATAL) << "Messages can't have default values!"; + break; + case FieldDescriptor::CPPTYPE_STRING: + if (fd->type() == FieldDescriptor::TYPE_BYTES || opt.string_as_bytes()) +@@ -521,7 +521,7 @@ GenerateMessageDescriptor(io::Printer* printer, bool gen_init) { + break; + } + default: +- GOOGLE_LOG(DFATAL) << "Unknown CPPTYPE"; ++ GOOGLE_LOG(FATAL) << "Unknown CPPTYPE"; + break; + } + if (!already_defined) +diff --git a/protoc-c/c_primitive_field.cc b/protoc-c/c_primitive_field.cc +index 6990893..1727af3 100644 +--- a/protoc-c/c_primitive_field.cc ++++ b/protoc-c/c_primitive_field.cc +@@ -143,7 +143,7 @@ std::string PrimitiveFieldGenerator::GetDefaultValue() const + case FieldDescriptor::CPPTYPE_BOOL: + return descriptor_->default_value_bool() ? "1" : "0"; + default: +- GOOGLE_LOG(DFATAL) << "unexpected CPPTYPE in c_primitive_field"; ++ GOOGLE_LOG(FATAL) << "unexpected CPPTYPE in c_primitive_field"; + return "UNEXPECTED_CPPTYPE"; + } + } +-- +2.33.0 + diff --git a/backport-Work-around-GOOGLE_-changes-in-protobuf-22.0.patch b/backport-Work-around-GOOGLE_-changes-in-protobuf-22.0.patch new file mode 100644 index 0000000000000000000000000000000000000000..589efd0ee23c44813a0685cff50715265eec7835 --- /dev/null +++ b/backport-Work-around-GOOGLE_-changes-in-protobuf-22.0.patch @@ -0,0 +1,44 @@ +From 8d334a7204d98874cbf970cb96ab0c7b52e06695 Mon Sep 17 00:00:00 2001 +From: Robert Edmonds +Date: Sun, 2 Jul 2023 19:42:19 -0400 +Subject: [PATCH] Work around GOOGLE_* changes in protobuf >= 22.0 + +According to the protobuf migration guide as of June 2023 [0], protobuf +22.0 (aka 4.22.0) took a dependency on something called "abseil" and as +a result the "stubs" have been removed. This apparently caused all the +uses of GOOGLE_* identifiers in protoc-c to fail when building against +newer versions of protobuf. + +This commit introduces compatibility definitions when building against +protobuf >= 4.22.0 so that protobuf-c can build against older and newer +versions of protobuf. + +[0] https://web.archive.org/web/20230611151200/https://protobuf.dev/support/migration/#abseil +--- + protoc-c/c_helpers.h | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/protoc-c/c_helpers.h b/protoc-c/c_helpers.h +index 7598a4e..adc7ee2 100644 +--- a/protoc-c/c_helpers.h ++++ b/protoc-c/c_helpers.h +@@ -178,6 +178,16 @@ inline int FieldSyntax(const FieldDescriptor* field) { + #endif + } + ++// Work around changes in protobuf >= 22.x without breaking compilation against ++// older protobuf versions. ++#if GOOGLE_PROTOBUF_VERSION >= 4022000 ++# define GOOGLE_ARRAYSIZE ABSL_ARRAYSIZE ++# define GOOGLE_CHECK_EQ ABSL_CHECK_EQ ++# define GOOGLE_CHECK_EQ ABSL_CHECK_EQ ++# define GOOGLE_DCHECK_GE ABSL_DCHECK_GE ++# define GOOGLE_LOG ABSL_LOG ++#endif ++ + } // namespace c + } // namespace compiler + } // namespace protobuf +-- +2.33.0 + diff --git a/backport-cmake-Remove-BUILD_PROTO3-HAVE_PROTO3.patch b/backport-cmake-Remove-BUILD_PROTO3-HAVE_PROTO3.patch new file mode 100644 index 0000000000000000000000000000000000000000..09f89c2cd4be977d392f297931466d0f958d55ff --- /dev/null +++ b/backport-cmake-Remove-BUILD_PROTO3-HAVE_PROTO3.patch @@ -0,0 +1,34 @@ +From 824a7fed75e15b9a4cb5961593bcc46e45a79559 Mon Sep 17 00:00:00 2001 +From: Robert Edmonds +Date: Sat, 8 Jul 2023 23:15:14 -0400 +Subject: [PATCH 5/5] cmake: Remove BUILD_PROTO3, HAVE_PROTO3 + +--- + build-cmake/CMakeLists.txt | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/build-cmake/CMakeLists.txt b/build-cmake/CMakeLists.txt +index 379dd1a..6dbf193 100644 +--- a/build-cmake/CMakeLists.txt ++++ b/build-cmake/CMakeLists.txt +@@ -9,7 +9,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.10 FATAL_ERROR) + PROJECT(protobuf-c) + + #options +-option(BUILD_PROTO3 "BUILD_PROTO3" ON) + option(BUILD_PROTOC "Build protoc-gen-c" ON) + if(CMAKE_BUILD_TYPE MATCHES Debug) + option(BUILD_TESTS "Build tests" ON) +@@ -73,9 +72,6 @@ endif (MSVC AND NOT BUILD_SHARED_LIBS) + FIND_PACKAGE(Protobuf REQUIRED) + INCLUDE_DIRECTORIES(${PROTOBUF_INCLUDE_DIR}) + +-if (BUILD_PROTO3) +- ADD_DEFINITIONS(-DHAVE_PROTO3) +-endif() + ENDIF() + + if (MSVC AND NOT BUILD_SHARED_LIBS) +-- +2.33.0 + diff --git a/backport-configure.ac-Drop-Wc99-c11-compat.patch b/backport-configure.ac-Drop-Wc99-c11-compat.patch new file mode 100644 index 0000000000000000000000000000000000000000..11239fd48c213dd70cbbafb9aa9f20f4e32d5445 --- /dev/null +++ b/backport-configure.ac-Drop-Wc99-c11-compat.patch @@ -0,0 +1,29 @@ +From 7f006f8ad53e3da49c408e70a6a2d9193b2b8684 Mon Sep 17 00:00:00 2001 +From: Robert Edmonds +Date: Sat, 8 Jul 2023 23:27:18 -0400 +Subject: [PATCH] configure.ac: Drop -Wc99-c11-compat + +This diagnostic isn't particularly useful since it fires on generated +.pb-c.h files. +--- + configure.ac | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/configure.ac b/configure.ac +index f03198a..065a0a5 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -38,10 +38,6 @@ my_CFLAGS="\ + -Wstrict-prototypes \ + -Wtype-limits \ + " +-#AX_CHECK_COMPILE_FLAG(["-Wc90-c99-compat"], +-# [my_CFLAGS="$my_CFLAGS -Wc90-c99-compat"]) +-AX_CHECK_COMPILE_FLAG(["-Wc99-c11-compat"], +- [my_CFLAGS="$my_CFLAGS -Wc99-c11-compat"]) + AX_CHECK_COMPILE_FLAG(["-Werror=incompatible-pointer-types"], + [my_CFLAGS="$my_CFLAGS -Werror=incompatible-pointer-types"]) + AX_CHECK_COMPILE_FLAG(["-Werror=int-conversion"], +-- +2.33.0 + diff --git a/backport-configure.ac-Remove-proto3_supported-BUILD_PROTO3.patch b/backport-configure.ac-Remove-proto3_supported-BUILD_PROTO3.patch new file mode 100644 index 0000000000000000000000000000000000000000..80dd8c16ce5ba3696e68636ca52236527aa0474b --- /dev/null +++ b/backport-configure.ac-Remove-proto3_supported-BUILD_PROTO3.patch @@ -0,0 +1,46 @@ +From 7dca1c382c2096ac1324b001cea53c39052843da Mon Sep 17 00:00:00 2001 +From: Robert Edmonds +Date: Sat, 8 Jul 2023 23:11:03 -0400 +Subject: [PATCH 1/5] configure.ac: Remove `proto3_supported`, `BUILD_PROTO3` + +Since we require protobuf >= 3.0.0 now, the proto3 syntax is always +supported. +--- + configure.ac | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 586ac3c..f03198a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -69,14 +69,12 @@ if test -n "$PKG_CONFIG"; then + fi + fi + +-proto3_supported="no" +- + AC_ARG_ENABLE([protoc], + AS_HELP_STRING([--disable-protoc], [Disable building protoc_c (also disables tests)])) + if test "x$enable_protoc" != "xno"; then + AC_LANG_PUSH([C++]) + AX_CXX_COMPILE_STDCXX(17, noext, mandatory) +- PKG_CHECK_MODULES([protobuf], [protobuf >= 3.0.0], [proto3_supported=yes]) ++ PKG_CHECK_MODULES([protobuf], [protobuf >= 3.0.0]) + + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$save_CPPFLAGS $protobuf_CFLAGS" +@@ -99,11 +97,8 @@ else + fi + + AM_CONDITIONAL([BUILD_COMPILER], [test "x$enable_protoc" != "xno"]) +-AM_CONDITIONAL([BUILD_PROTO3], [test "x$proto3_supported" != "xno"]) + AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" != "xno"]) + +-AM_COND_IF([BUILD_PROTO3], [AC_DEFINE([HAVE_PROTO3], [1], [Support proto3 syntax])]) +- + gl_LD_VERSION_SCRIPT + + gl_VALGRIND_TESTS +-- +2.33.0 + diff --git a/backport-configure.ac-Require-C-17.patch b/backport-configure.ac-Require-C-17.patch new file mode 100644 index 0000000000000000000000000000000000000000..efe6529178f24d07c87cb8b4a27c8c7a8c91c5ea --- /dev/null +++ b/backport-configure.ac-Require-C-17.patch @@ -0,0 +1,39 @@ +From 5b0661f1e8a0e03f75cc6f53b8d42507e95403c9 Mon Sep 17 00:00:00 2001 +From: Robert Edmonds +Date: Mon, 3 Jul 2023 01:10:28 -0400 +Subject: [PATCH] configure.ac: Require C++17 + +There are some recent reports of strange build failures that might have +been fixed by compiling in C++17 mode, so it might be a good idea to use +C++17 in general, and not just when building against very recent +protobuf versions. + +Since it looks like we've lost protobuf < 3.0.0 support, configure.ac +can be simplified a bit if we just use C++17 by default. +--- + configure.ac | 23 ++--------------------- + 1 file changed, 2 insertions(+), 21 deletions(-) + +diff --git a/configure.ac b/configure.ac +index fa024b6..586ac3c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -75,13 +75,8 @@ AC_ARG_ENABLE([protoc], + AS_HELP_STRING([--disable-protoc], [Disable building protoc_c (also disables tests)])) + if test "x$enable_protoc" != "xno"; then + AC_LANG_PUSH([C++]) +- +- AX_CXX_COMPILE_STDCXX(11, noext, mandatory) +- +- PKG_CHECK_MODULES([protobuf], [protobuf >= 3.0.0], +- [proto3_supported=yes], +- [PKG_CHECK_MODULES([protobuf], [protobuf >= 2.6.0])] +- ) ++ AX_CXX_COMPILE_STDCXX(17, noext, mandatory) ++ PKG_CHECK_MODULES([protobuf], [protobuf >= 3.0.0], [proto3_supported=yes]) + + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$save_CPPFLAGS $protobuf_CFLAGS" +-- +2.33.0 + diff --git a/backport-protoc-c-Remove-GOOGLE_DISALLOW_EVIL_CONSTRUCTORS-ma.patch b/backport-protoc-c-Remove-GOOGLE_DISALLOW_EVIL_CONSTRUCTORS-ma.patch new file mode 100644 index 0000000000000000000000000000000000000000..4ac39d0585c93b41dc64a795d60f99b0e2833cb7 --- /dev/null +++ b/backport-protoc-c-Remove-GOOGLE_DISALLOW_EVIL_CONSTRUCTORS-ma.patch @@ -0,0 +1,202 @@ +From ad48868dfe77592c4bacf936ade208f384a26b09 Mon Sep 17 00:00:00 2001 +From: Robert Edmonds +Date: Sun, 2 Jul 2023 17:48:18 -0400 +Subject: [PATCH] protoc-c: Remove GOOGLE_DISALLOW_EVIL_CONSTRUCTORS macro + invocations + +protobuf has removed the definition of this macro as of commit +1595417dd3859bbff7d3d61ad0b6e39044d47489, so the invocation of this +macro in protobuf-c breaks the build when building agaist the protobuf +22.x or 23.x series. + +Simply removing the macro invocations seems to be safe and doesn't break +the build on Debian's protobuf 3.21.12 nor Debian's protobuf 3.6.1.3. +--- + protoc-c/c_bytes_field.h | 2 -- + protoc-c/c_enum.h | 2 -- + protoc-c/c_enum_field.h | 2 -- + protoc-c/c_extension.h | 2 -- + protoc-c/c_field.h | 5 ----- + protoc-c/c_file.h | 2 -- + protoc-c/c_generator.h | 3 --- + protoc-c/c_message.h | 2 -- + protoc-c/c_message_field.h | 4 ---- + protoc-c/c_primitive_field.h | 4 ---- + protoc-c/c_service.h | 2 -- + protoc-c/c_string_field.h | 2 -- + 12 files changed, 32 deletions(-) + +diff --git a/protoc-c/c_bytes_field.h b/protoc-c/c_bytes_field.h +index bf873f0..df91ef7 100644 +--- a/protoc-c/c_bytes_field.h ++++ b/protoc-c/c_bytes_field.h +@@ -87,8 +87,6 @@ class BytesFieldGenerator : public FieldGenerator { + + private: + std::map variables_; +- +- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(BytesFieldGenerator); + }; + + +diff --git a/protoc-c/c_enum.h b/protoc-c/c_enum.h +index 9c34b69..089c336 100644 +--- a/protoc-c/c_enum.h ++++ b/protoc-c/c_enum.h +@@ -106,8 +106,6 @@ class EnumGenerator { + private: + const EnumDescriptor* descriptor_; + std::string dllexport_decl_; +- +- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator); + }; + + } // namespace c +diff --git a/protoc-c/c_enum_field.h b/protoc-c/c_enum_field.h +index 3f8c005..e0c96ad 100644 +--- a/protoc-c/c_enum_field.h ++++ b/protoc-c/c_enum_field.h +@@ -85,8 +85,6 @@ class EnumFieldGenerator : public FieldGenerator { + + private: + std::map variables_; +- +- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator); + }; + + +diff --git a/protoc-c/c_extension.h b/protoc-c/c_extension.h +index 9541388..bda0bc5 100644 +--- a/protoc-c/c_extension.h ++++ b/protoc-c/c_extension.h +@@ -98,8 +98,6 @@ class ExtensionGenerator { + const FieldDescriptor* descriptor_; + std::string type_traits_; + std::string dllexport_decl_; +- +- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator); + }; + + } // namespace c +diff --git a/protoc-c/c_field.h b/protoc-c/c_field.h +index 3cad35d..623a872 100644 +--- a/protoc-c/c_field.h ++++ b/protoc-c/c_field.h +@@ -103,9 +103,6 @@ class FieldGenerator { + const std::string &type_macro, + const std::string &descriptor_addr) const; + const FieldDescriptor *descriptor_; +- +- private: +- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator); + }; + + // Convenience class which constructs FieldGenerators for a Descriptor. +@@ -121,8 +118,6 @@ class FieldGeneratorMap { + std::unique_ptr[]> field_generators_; + + static FieldGenerator* MakeGenerator(const FieldDescriptor* field); +- +- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap); + }; + + } // namespace c +diff --git a/protoc-c/c_file.h b/protoc-c/c_file.h +index 8dfd8ba..db1866c 100644 +--- a/protoc-c/c_file.h ++++ b/protoc-c/c_file.h +@@ -103,8 +103,6 @@ class FileGenerator { + std::unique_ptr[]> enum_generators_; + std::unique_ptr[]> service_generators_; + std::unique_ptr[]> extension_generators_; +- +- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator); + }; + + } // namespace c +diff --git a/protoc-c/c_generator.h b/protoc-c/c_generator.h +index ac1ffaf..b8b44aa 100644 +--- a/protoc-c/c_generator.h ++++ b/protoc-c/c_generator.h +@@ -93,9 +93,6 @@ class PROTOC_C_EXPORT CGenerator : public CodeGenerator { + const std::string& parameter, + OutputDirectory* output_directory, + std::string* error) const; +- +- private: +- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CGenerator); + }; + + } // namespace c +diff --git a/protoc-c/c_message.h b/protoc-c/c_message.h +index ea1c3ab..0d8c644 100644 +--- a/protoc-c/c_message.h ++++ b/protoc-c/c_message.h +@@ -136,8 +136,6 @@ class MessageGenerator { + std::unique_ptr[]> nested_generators_; + std::unique_ptr[]> enum_generators_; + std::unique_ptr[]> extension_generators_; +- +- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator); + }; + + } // namespace c +diff --git a/protoc-c/c_message_field.h b/protoc-c/c_message_field.h +index 39b8d99..e485921 100644 +--- a/protoc-c/c_message_field.h ++++ b/protoc-c/c_message_field.h +@@ -82,10 +82,6 @@ class MessageFieldGenerator : public FieldGenerator { + void GenerateDescriptorInitializer(io::Printer* printer) const; + std::string GetDefaultValue(void) const; + void GenerateStaticInit(io::Printer* printer) const; +- +- private: +- +- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator); + }; + + +diff --git a/protoc-c/c_primitive_field.h b/protoc-c/c_primitive_field.h +index a9eb893..aa7079f 100644 +--- a/protoc-c/c_primitive_field.h ++++ b/protoc-c/c_primitive_field.h +@@ -82,10 +82,6 @@ class PrimitiveFieldGenerator : public FieldGenerator { + void GenerateDescriptorInitializer(io::Printer* printer) const; + std::string GetDefaultValue(void) const; + void GenerateStaticInit(io::Printer* printer) const; +- +- private: +- +- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator); + }; + + } // namespace c +diff --git a/protoc-c/c_service.h b/protoc-c/c_service.h +index 27125a6..b51472f 100644 +--- a/protoc-c/c_service.h ++++ b/protoc-c/c_service.h +@@ -100,8 +100,6 @@ class ServiceGenerator { + + const ServiceDescriptor* descriptor_; + std::map vars_; +- +- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ServiceGenerator); + }; + + } // namespace c +diff --git a/protoc-c/c_string_field.h b/protoc-c/c_string_field.h +index 513cea7..b3a1a7f 100644 +--- a/protoc-c/c_string_field.h ++++ b/protoc-c/c_string_field.h +@@ -87,8 +87,6 @@ class StringFieldGenerator : public FieldGenerator { + + private: + std::map variables_; +- +- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringFieldGenerator); + }; + + +-- +2.33.0 + diff --git a/backport-protoc-c-Use-FileDescriptorLegacy-to-obtain-proto-sy.patch b/backport-protoc-c-Use-FileDescriptorLegacy-to-obtain-proto-sy.patch new file mode 100644 index 0000000000000000000000000000000000000000..eac66458f622ffb2cfab57685c4e65ece427d8d9 --- /dev/null +++ b/backport-protoc-c-Use-FileDescriptorLegacy-to-obtain-proto-sy.patch @@ -0,0 +1,66 @@ +From 1937ba946b0a7a62c0f534e60f4d4799d7e0daed Mon Sep 17 00:00:00 2001 +From: Robert Edmonds +Date: Sun, 2 Jul 2023 22:57:57 -0400 +Subject: [PATCH] protoc-c: Use FileDescriptorLegacy to obtain proto syntax + version on protobuf >= 23.0 + +Use the newer "legacy" way of determining whether a file descriptor is +using proto2 or proto3 syntax on protobuf >= 23.0. + +Based on +https://github.com/protobuf-c/protobuf-c/pull/556/commits/66574f3fd85a205eb7c90b790477d5415364209e +but continues to support older versions of protobuf. + +Unfortunately, since this is a "deprecated", "legacy" API it'll probably +disappear in about five seconds. +--- + protoc-c/c_file.cc | 4 ++++ + protoc-c/c_helpers.h | 8 ++++++++ + 2 files changed, 12 insertions(+) + +diff --git a/protoc-c/c_file.cc b/protoc-c/c_file.cc +index 59c1824..d211a3d 100644 +--- a/protoc-c/c_file.cc ++++ b/protoc-c/c_file.cc +@@ -119,7 +119,11 @@ void FileGenerator::GenerateHeader(io::Printer* printer) { + + int min_header_version = 1000000; + #if defined(HAVE_PROTO3) ++# if GOOGLE_PROTOBUF_VERSION >= 4023000 ++ if (FileDescriptorLegacy(file_).syntax() == FileDescriptorLegacy::SYNTAX_PROTO3) { ++# else + if (file_->syntax() == FileDescriptor::SYNTAX_PROTO3) { ++#endif + min_header_version = 1003000; + } + #endif +diff --git a/protoc-c/c_helpers.h b/protoc-c/c_helpers.h +index adc7ee2..055528b 100644 +--- a/protoc-c/c_helpers.h ++++ b/protoc-c/c_helpers.h +@@ -70,6 +70,10 @@ + #include + #include + ++#if GOOGLE_PROTOBUF_VERSION >= 4023000 ++# include ++#endif ++ + namespace google { + namespace protobuf { + namespace compiler { +@@ -172,7 +176,11 @@ int compare_name_indices_by_name(const void*, const void*); + // This wrapper is needed to be able to compile against protobuf2. + inline int FieldSyntax(const FieldDescriptor* field) { + #ifdef HAVE_PROTO3 ++# if GOOGLE_PROTOBUF_VERSION >= 4023000 ++ return FileDescriptorLegacy(field->file()).syntax() == FileDescriptorLegacy::SYNTAX_PROTO3 ? 3 : 2; ++# else + return field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 ? 3 : 2; ++# endif + #else + return 2; + #endif +-- +2.33.0 + diff --git a/backport-protoc-c-c_file.cc-Remove-HAVE_PROTO3-conditional.patch b/backport-protoc-c-c_file.cc-Remove-HAVE_PROTO3-conditional.patch new file mode 100644 index 0000000000000000000000000000000000000000..3092c86fe10d2fa2ab898fcdb7a4613223025077 --- /dev/null +++ b/backport-protoc-c-c_file.cc-Remove-HAVE_PROTO3-conditional.patch @@ -0,0 +1,34 @@ +From 7ed03a715bce3eab94eb77b66378c984bf7e633a Mon Sep 17 00:00:00 2001 +From: Robert Edmonds +Date: Sat, 8 Jul 2023 23:13:59 -0400 +Subject: [PATCH 3/5] protoc-c/c_file.cc: Remove HAVE_PROTO3 conditional + +--- + protoc-c/c_file.cc | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/protoc-c/c_file.cc b/protoc-c/c_file.cc +index d211a3d..ca0ad34 100644 +--- a/protoc-c/c_file.cc ++++ b/protoc-c/c_file.cc +@@ -118,15 +118,13 @@ void FileGenerator::GenerateHeader(io::Printer* printer) { + std::string filename_identifier = FilenameIdentifier(file_->name()); + + int min_header_version = 1000000; +-#if defined(HAVE_PROTO3) +-# if GOOGLE_PROTOBUF_VERSION >= 4023000 ++#if GOOGLE_PROTOBUF_VERSION >= 4023000 + if (FileDescriptorLegacy(file_).syntax() == FileDescriptorLegacy::SYNTAX_PROTO3) { +-# else ++#else + if (file_->syntax() == FileDescriptor::SYNTAX_PROTO3) { + #endif + min_header_version = 1003000; + } +-#endif + + // Generate top of header. + printer->Print( +-- +2.33.0 + diff --git a/backport-protoc-c-c_helpers.h-Remove-HAVE_PROTO3-conditional.patch b/backport-protoc-c-c_helpers.h-Remove-HAVE_PROTO3-conditional.patch new file mode 100644 index 0000000000000000000000000000000000000000..7c5db475bf3e32392332ab6811fcd562b6e1c806 --- /dev/null +++ b/backport-protoc-c-c_helpers.h-Remove-HAVE_PROTO3-conditional.patch @@ -0,0 +1,33 @@ +From e08fe625655dca6e095b103869e030b79e5d0df2 Mon Sep 17 00:00:00 2001 +From: Robert Edmonds +Date: Sat, 8 Jul 2023 23:14:23 -0400 +Subject: [PATCH 4/5] protoc-c/c_helpers.h: Remove HAVE_PROTO3 conditional + +--- + protoc-c/c_helpers.h | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +diff --git a/protoc-c/c_helpers.h b/protoc-c/c_helpers.h +index 055528b..062d330 100644 +--- a/protoc-c/c_helpers.h ++++ b/protoc-c/c_helpers.h +@@ -175,14 +175,10 @@ int compare_name_indices_by_name(const void*, const void*); + // Return the syntax version of the file containing the field. + // This wrapper is needed to be able to compile against protobuf2. + inline int FieldSyntax(const FieldDescriptor* field) { +-#ifdef HAVE_PROTO3 +-# if GOOGLE_PROTOBUF_VERSION >= 4023000 ++#if GOOGLE_PROTOBUF_VERSION >= 4023000 + return FileDescriptorLegacy(field->file()).syntax() == FileDescriptorLegacy::SYNTAX_PROTO3 ? 3 : 2; +-# else +- return field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 ? 3 : 2; +-# endif + #else +- return 2; ++ return field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 ? 3 : 2; + #endif + } + +-- +2.33.0 + diff --git a/protobuf-c.spec b/protobuf-c.spec index b18e55ef0919850bb1fd1f617c078705ba3dbcf6..c6339439bd01c21a4e1ac2ef54338f337733a874 100644 --- a/protobuf-c.spec +++ b/protobuf-c.spec @@ -1,5 +1,5 @@ Name: protobuf-c -Version: 1.5.0 +Version: 1.4.1 Release: 1 Summary: This is protobuf-c, a C implementation of the Google Protocol Buffers data serialization format License: BSD-2-Clause @@ -9,6 +9,19 @@ BuildRequires: autoconf automake libtool gcc-c++ pkgconfig(protobuf) Provides: %{name}-compiler = %{version}-%{release} Obsoletes: %{name}-compiler < %{version}-%{release} +Patch6000: backport-Update-autotools.patch +Patch6001: backport-configure.ac-Require-C-17.patch +Patch6002: backport-protoc-c-Remove-GOOGLE_DISALLOW_EVIL_CONSTRUCTORS-ma.patch +Patch6003: backport-protoc-c-Use-FileDescriptorLegacy-to-obtain-proto-sy.patch +Patch6004: backport-configure.ac-Remove-proto3_supported-BUILD_PROTO3.patch +Patch6005: backport-Makefile.am-Remove-conditional-BUILD_PROTO3-rules.patch +Patch6006: backport-protoc-c-c_file.cc-Remove-HAVE_PROTO3-conditional.patch +Patch6007: backport-protoc-c-c_helpers.h-Remove-HAVE_PROTO3-conditional.patch +Patch6008: backport-cmake-Remove-BUILD_PROTO3-HAVE_PROTO3.patch +Patch6009: backport-configure.ac-Drop-Wc99-c11-compat.patch +Patch6010: backport-Work-around-GOOGLE_-changes-in-protobuf-22.0.patch +Patch6011: backport-Use-GOOGLE_LOG-FATAL-instead-of-GOOGLE_LOG-DFATAL.patch + %description This is protobuf-c, a C implementation of the Google Protocol Buffers data serialization format. @@ -38,7 +51,7 @@ make check %ldconfig_scriptlets %files -%doc TODO LICENSE ChangeLog.old CHANGELOG.md +%doc TODO LICENSE ChangeLog %{_libdir}/libprotobuf-c.so.* %{_bindir}/{protoc-c,protoc-gen-c} @@ -48,6 +61,9 @@ make check %{_libdir}/{libprotobuf-c.so,pkgconfig/libprotobuf-c.pc} %changelog +* Tue Feb 27 2024 liuchao - 1.4.1-1 +- downgrade to 1.4.1 to match the 24.03 LTS's minimum set of core packages + * Wed Jan 24 2024 liuchao - 1.5.0-1 - upgrade to 1.5.0: - Makefile.am: change link order diff --git a/v1.4.1.tar.gz b/v1.4.1.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..0cde445cc5aeda27c4ba923bacf3abab0a72cb61 Binary files /dev/null and b/v1.4.1.tar.gz differ diff --git a/v1.5.0.tar.gz b/v1.5.0.tar.gz deleted file mode 100644 index c5a95c317d11db9b4e21f8004b38b0256c43d8b7..0000000000000000000000000000000000000000 Binary files a/v1.5.0.tar.gz and /dev/null differ