This pulls in an upstream patch to make protobuf-c build with newer protobuf that depend on abseil-cpp and thus need C++17
https://github.com/protobuf-c/protobuf-c/pull/673 This builds and packages fine on current and passes regress on arm64 and sparc64. I'm sending this diff since I'd like a review of the Makefile changes from someone who understands the CONFIGURE_STYLE vs autoconf magic. Index: Makefile =================================================================== RCS file: /cvs/ports/devel/protobuf-c/Makefile,v retrieving revision 1.21 diff -u -p -r1.21 Makefile --- Makefile 3 Oct 2022 22:17:24 -0000 1.21 +++ Makefile 8 Sep 2023 12:50:11 -0000 @@ -2,6 +2,7 @@ COMMENT = c protocol buffers V = 1.4.1 DISTNAME = protobuf-c-$V +REVISION = 0 SHARED_LIBS = protobuf-c 2.0 # 1.0 @@ -17,11 +18,13 @@ PERMIT_PACKAGE = Yes WANTLIB = c m protobuf protoc pthread ${COMPILER_LIBCXX} z COMPILER = base-clang ports-gcc -CXXFLAGS += -std=gnu++11 +CXXFLAGS += -std=gnu++17 LIB_DEPENDS = devel/protobuf -CONFIGURE_STYLE = gnu +CONFIGURE_STYLE = autoconf +AUTOCONF_VERSION = 2.71 +AUTOMAKE_VERSION = 1.16 CONFIGURE_ENV = CPPFLAGS="-I${LOCALBASE}/include" \ LDFLAGS="-L${LOCALBASE}/lib" Index: patches/patch-build-cmake_CMakeLists_txt =================================================================== RCS file: patches/patch-build-cmake_CMakeLists_txt diff -N patches/patch-build-cmake_CMakeLists_txt --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-build-cmake_CMakeLists_txt 8 Sep 2023 13:22:30 -0000 @@ -0,0 +1,14 @@ +https://github.com/protobuf-c/protobuf-c/pull/673 + +Index: build-cmake/CMakeLists.txt +--- build-cmake/CMakeLists.txt.orig ++++ build-cmake/CMakeLists.txt +@@ -88,7 +88,7 @@ if (MSVC AND NOT BUILD_SHARED_LIBS) + endif (MSVC AND NOT BUILD_SHARED_LIBS) + + IF(BUILD_PROTOC) +-SET(CMAKE_CXX_STANDARD 11) ++SET(CMAKE_CXX_STANDARD 17) + SET(CMAKE_CXX_STANDARD_REQUIRED ON) + SET(CMAKE_CXX_EXTENSIONS OFF) + ADD_CUSTOM_COMMAND(OUTPUT protobuf-c/protobuf-c.pb.cc protobuf-c/protobuf-c.pb.h Index: patches/patch-configure_ac =================================================================== RCS file: patches/patch-configure_ac diff -N patches/patch-configure_ac --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-configure_ac 8 Sep 2023 13:22:30 -0000 @@ -0,0 +1,20 @@ +https://github.com/protobuf-c/protobuf-c/pull/673 + +Index: configure.ac +--- configure.ac.orig ++++ configure.ac +@@ -76,12 +76,8 @@ AC_ARG_ENABLE([protoc], + 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" Index: patches/patch-protoc-c_c_bytes_field_h =================================================================== RCS file: patches/patch-protoc-c_c_bytes_field_h diff -N patches/patch-protoc-c_c_bytes_field_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-protoc-c_c_bytes_field_h 8 Sep 2023 13:22:30 -0000 @@ -0,0 +1,14 @@ +https://github.com/protobuf-c/protobuf-c/pull/673 + +Index: protoc-c/c_bytes_field.h +--- protoc-c/c_bytes_field.h.orig ++++ protoc-c/c_bytes_field.h +@@ -87,8 +87,6 @@ class BytesFieldGenerator : public FieldGenerator { + + private: + std::map<std::string, std::string> variables_; +- +- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(BytesFieldGenerator); + }; + + Index: patches/patch-protoc-c_c_enum_field_h =================================================================== RCS file: patches/patch-protoc-c_c_enum_field_h diff -N patches/patch-protoc-c_c_enum_field_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-protoc-c_c_enum_field_h 8 Sep 2023 13:22:30 -0000 @@ -0,0 +1,14 @@ +https://github.com/protobuf-c/protobuf-c/pull/673 + +Index: protoc-c/c_enum_field.h +--- protoc-c/c_enum_field.h.orig ++++ protoc-c/c_enum_field.h +@@ -85,8 +85,6 @@ class EnumFieldGenerator : public FieldGenerator { + + private: + std::map<std::string, std::string> variables_; +- +- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator); + }; + + Index: patches/patch-protoc-c_c_enum_h =================================================================== RCS file: patches/patch-protoc-c_c_enum_h diff -N patches/patch-protoc-c_c_enum_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-protoc-c_c_enum_h 8 Sep 2023 13:22:30 -0000 @@ -0,0 +1,14 @@ +https://github.com/protobuf-c/protobuf-c/pull/673 + +Index: protoc-c/c_enum.h +--- protoc-c/c_enum.h.orig ++++ 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 Index: patches/patch-protoc-c_c_extension_h =================================================================== RCS file: patches/patch-protoc-c_c_extension_h diff -N patches/patch-protoc-c_c_extension_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-protoc-c_c_extension_h 8 Sep 2023 13:22:30 -0000 @@ -0,0 +1,14 @@ +https://github.com/protobuf-c/protobuf-c/pull/673 + +Index: protoc-c/c_extension.h +--- protoc-c/c_extension.h.orig ++++ 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 Index: patches/patch-protoc-c_c_field_h =================================================================== RCS file: patches/patch-protoc-c_c_field_h diff -N patches/patch-protoc-c_c_field_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-protoc-c_c_field_h 8 Sep 2023 13:22:30 -0000 @@ -0,0 +1,24 @@ +https://github.com/protobuf-c/protobuf-c/pull/673 + +Index: protoc-c/c_field.h +--- protoc-c/c_field.h.orig ++++ 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<std::unique_ptr<FieldGenerator>[]> field_generators_; + + static FieldGenerator* MakeGenerator(const FieldDescriptor* field); +- +- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap); + }; + + } // namespace c Index: patches/patch-protoc-c_c_file_cc =================================================================== RCS file: patches/patch-protoc-c_c_file_cc diff -N patches/patch-protoc-c_c_file_cc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-protoc-c_c_file_cc 8 Sep 2023 13:22:30 -0000 @@ -0,0 +1,17 @@ +https://github.com/protobuf-c/protobuf-c/pull/673 + +Index: protoc-c/c_file.cc +--- protoc-c/c_file.cc.orig ++++ protoc-c/c_file.cc +@@ -119,7 +119,11 @@ void FileGenerator::GenerateHeader(io::Printer* printe + + 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 Index: patches/patch-protoc-c_c_file_h =================================================================== RCS file: patches/patch-protoc-c_c_file_h diff -N patches/patch-protoc-c_c_file_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-protoc-c_c_file_h 8 Sep 2023 13:22:30 -0000 @@ -0,0 +1,14 @@ +https://github.com/protobuf-c/protobuf-c/pull/673 + +Index: protoc-c/c_file.h +--- protoc-c/c_file.h.orig ++++ protoc-c/c_file.h +@@ -103,8 +103,6 @@ class FileGenerator { + std::unique_ptr<std::unique_ptr<EnumGenerator>[]> enum_generators_; + std::unique_ptr<std::unique_ptr<ServiceGenerator>[]> service_generators_; + std::unique_ptr<std::unique_ptr<ExtensionGenerator>[]> extension_generators_; +- +- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator); + }; + + } // namespace c Index: patches/patch-protoc-c_c_generator_h =================================================================== RCS file: patches/patch-protoc-c_c_generator_h diff -N patches/patch-protoc-c_c_generator_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-protoc-c_c_generator_h 8 Sep 2023 13:22:30 -0000 @@ -0,0 +1,15 @@ +https://github.com/protobuf-c/protobuf-c/pull/673 + +Index: protoc-c/c_generator.h +--- protoc-c/c_generator.h.orig ++++ protoc-c/c_generator.h +@@ -93,9 +93,6 @@ class PROTOC_C_EXPORT CGenerator : public CodeGenerato + const std::string& parameter, + OutputDirectory* output_directory, + std::string* error) const; +- +- private: +- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CGenerator); + }; + + } // namespace c Index: patches/patch-protoc-c_c_helpers_h =================================================================== RCS file: patches/patch-protoc-c_c_helpers_h diff -N patches/patch-protoc-c_c_helpers_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-protoc-c_c_helpers_h 8 Sep 2023 13:22:30 -0000 @@ -0,0 +1,42 @@ +https://github.com/protobuf-c/protobuf-c/pull/673 + +Index: protoc-c/c_helpers.h +--- protoc-c/c_helpers.h.orig ++++ protoc-c/c_helpers.h +@@ -70,6 +70,10 @@ + #include <protobuf-c/protobuf-c.pb.h> + #include <google/protobuf/io/printer.h> + ++#if GOOGLE_PROTOBUF_VERSION >= 4023000 ++# include <google/protobuf/descriptor_legacy.h> ++#endif ++ + namespace google { + namespace protobuf { + namespace compiler { +@@ -172,11 +176,25 @@ int compare_name_indices_by_name(const void*, const vo + // 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 + } ++ ++// 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 Index: patches/patch-protoc-c_c_message_cc =================================================================== RCS file: patches/patch-protoc-c_c_message_cc diff -N patches/patch-protoc-c_c_message_cc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-protoc-c_c_message_cc 8 Sep 2023 13:22:30 -0000 @@ -0,0 +1,23 @@ +https://github.com/protobuf-c/protobuf-c/pull/673 + +Index: protoc-c/c_message.cc +--- protoc-c/c_message.cc.orig ++++ protoc-c/c_message.cc +@@ -499,7 +499,7 @@ GenerateMessageDescriptor(io::Printer* printer, bool g + // 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 g + break; + } + default: +- GOOGLE_LOG(DFATAL) << "Unknown CPPTYPE"; ++ GOOGLE_LOG(FATAL) << "Unknown CPPTYPE"; + break; + } + if (!already_defined) Index: patches/patch-protoc-c_c_message_field_h =================================================================== RCS file: patches/patch-protoc-c_c_message_field_h diff -N patches/patch-protoc-c_c_message_field_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-protoc-c_c_message_field_h 8 Sep 2023 13:22:30 -0000 @@ -0,0 +1,16 @@ +https://github.com/protobuf-c/protobuf-c/pull/673 + +Index: protoc-c/c_message_field.h +--- protoc-c/c_message_field.h.orig ++++ 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); + }; + + Index: patches/patch-protoc-c_c_message_h =================================================================== RCS file: patches/patch-protoc-c_c_message_h diff -N patches/patch-protoc-c_c_message_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-protoc-c_c_message_h 8 Sep 2023 13:22:30 -0000 @@ -0,0 +1,14 @@ +https://github.com/protobuf-c/protobuf-c/pull/673 + +Index: protoc-c/c_message.h +--- protoc-c/c_message.h.orig ++++ protoc-c/c_message.h +@@ -136,8 +136,6 @@ class MessageGenerator { + std::unique_ptr<std::unique_ptr<MessageGenerator>[]> nested_generators_; + std::unique_ptr<std::unique_ptr<EnumGenerator>[]> enum_generators_; + std::unique_ptr<std::unique_ptr<ExtensionGenerator>[]> extension_generators_; +- +- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator); + }; + + } // namespace c Index: patches/patch-protoc-c_c_primitive_field_cc =================================================================== RCS file: patches/patch-protoc-c_c_primitive_field_cc diff -N patches/patch-protoc-c_c_primitive_field_cc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-protoc-c_c_primitive_field_cc 8 Sep 2023 13:22:30 -0000 @@ -0,0 +1,14 @@ +https://github.com/protobuf-c/protobuf-c/pull/673 + +Index: protoc-c/c_primitive_field.cc +--- protoc-c/c_primitive_field.cc.orig ++++ protoc-c/c_primitive_field.cc +@@ -143,7 +143,7 @@ std::string PrimitiveFieldGenerator::GetDefaultValue() + 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"; + } + } Index: patches/patch-protoc-c_c_primitive_field_h =================================================================== RCS file: patches/patch-protoc-c_c_primitive_field_h diff -N patches/patch-protoc-c_c_primitive_field_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-protoc-c_c_primitive_field_h 8 Sep 2023 13:22:30 -0000 @@ -0,0 +1,16 @@ +https://github.com/protobuf-c/protobuf-c/pull/673 + +Index: protoc-c/c_primitive_field.h +--- protoc-c/c_primitive_field.h.orig ++++ 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 Index: patches/patch-protoc-c_c_service_h =================================================================== RCS file: patches/patch-protoc-c_c_service_h diff -N patches/patch-protoc-c_c_service_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-protoc-c_c_service_h 8 Sep 2023 13:22:30 -0000 @@ -0,0 +1,14 @@ +https://github.com/protobuf-c/protobuf-c/pull/673 + +Index: protoc-c/c_service.h +--- protoc-c/c_service.h.orig ++++ protoc-c/c_service.h +@@ -100,8 +100,6 @@ class ServiceGenerator { + + const ServiceDescriptor* descriptor_; + std::map<std::string, std::string> vars_; +- +- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ServiceGenerator); + }; + + } // namespace c Index: patches/patch-protoc-c_c_string_field_h =================================================================== RCS file: patches/patch-protoc-c_c_string_field_h diff -N patches/patch-protoc-c_c_string_field_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-protoc-c_c_string_field_h 8 Sep 2023 13:22:30 -0000 @@ -0,0 +1,14 @@ +https://github.com/protobuf-c/protobuf-c/pull/673 + +Index: protoc-c/c_string_field.h +--- protoc-c/c_string_field.h.orig ++++ protoc-c/c_string_field.h +@@ -87,8 +87,6 @@ class StringFieldGenerator : public FieldGenerator { + + private: + std::map<std::string, std::string> variables_; +- +- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(StringFieldGenerator); + }; + +
