$(package)_sha256_hash=$(native_$(package)_sha256_hash)
$(package)_dependencies=native_$(package)
$(package)_cxxflags=-std=c++11
-$(package)_patches = fix-abi.patch
define $(package)_set_vars
$(package)_config_opts=--disable-shared --with-protoc=$(build_prefix)/bin/protoc
$(package)_config_opts_linux=--with-pic
endef
-define $(package)_preprocess_cmds
- patch -p1 -i $($(package)_patch_dir)/fix-abi.patch
-endef
-
define $(package)_config_cmds
cp -f $(BASEDIR)/config.guess $(BASEDIR)/config.sub . && \
cp -f $(BASEDIR)/config.guess $(BASEDIR)/config.sub ./third_party/googletest/googletest/build-aux/ && \
+++ /dev/null
-From 101b6199f33a396b5758057ca10b8f9c8d8e8855 Mon Sep 17 00:00:00 2001
-From: Antoine Pitrou <antoine@python.org>
-Date: Tue, 19 Jul 2022 16:40:28 +0200
-Subject: [PATCH] Fix #9947: make the ABI identical between debug and non-debug
- builds
-
----
- src/google/protobuf/message_lite.cc | 8 ++------
- src/google/protobuf/metadata_lite.h | 13 ++++++++++---
- 2 files changed, 12 insertions(+), 9 deletions(-)
-
-diff --git a/src/google/protobuf/message_lite.cc b/src/google/protobuf/message_lite.cc
-index 3a1b67bf6..da66c1965 100644
---- a/src/google/protobuf/message_lite.cc
-+++ b/src/google/protobuf/message_lite.cc
-@@ -520,18 +520,14 @@ void GenericTypeHandler<std::string>::Merge(const std::string& from,
- *to = from;
- }
-
--// Non-inline implementations of InternalMetadata routines
--#if defined(NDEBUG) || defined(_MSC_VER)
--// for opt and MSVC builds, the destructor is defined in the header.
--#else
-+// Non-inline implementations of InternalMetadata destructor
- // This is moved out of the header because the GOOGLE_DCHECK produces a lot of code.
--InternalMetadata::~InternalMetadata() {
-+void InternalMetadata::CheckedDestruct() {
- if (HasMessageOwnedArenaTag()) {
- GOOGLE_DCHECK(!HasUnknownFieldsTag());
- delete reinterpret_cast<Arena*>(ptr_ - kMessageOwnedArenaTagMask);
- }
- }
--#endif
-
- // Non-inline variants of std::string specializations for
- // various InternalMetadata routines.
-diff --git a/src/google/protobuf/metadata_lite.h b/src/google/protobuf/metadata_lite.h
-index 11faba69f..0c31517f0 100644
---- a/src/google/protobuf/metadata_lite.h
-+++ b/src/google/protobuf/metadata_lite.h
-@@ -74,15 +74,19 @@ class PROTOBUF_EXPORT InternalMetadata {
- GOOGLE_DCHECK(!is_message_owned || arena != nullptr);
- }
-
--#if defined(NDEBUG) || defined(_MSC_VER)
-+ // To keep the ABI identical between debug and non-debug builds,
-+ // the destructor is always defined here even though it may delegate
-+ // to a non-inline private method.
-+ // (see https://github.com/protocolbuffers/protobuf/issues/9947)
- ~InternalMetadata() {
-+#if defined(NDEBUG) || defined(_MSC_VER)
- if (HasMessageOwnedArenaTag()) {
- delete reinterpret_cast<Arena*>(ptr_ - kMessageOwnedArenaTagMask);
- }
-- }
- #else
-- ~InternalMetadata();
-+ CheckedDestruct();
- #endif
-+ }
-
- template <typename T>
- void Delete() {
-@@ -261,6 +265,9 @@ class PROTOBUF_EXPORT InternalMetadata {
- PROTOBUF_NOINLINE void DoSwap(T* other) {
- mutable_unknown_fields<T>()->Swap(other);
- }
-+
-+ // Private helper with debug checks for ~InternalMetadata()
-+ void CheckedDestruct();
- };
-
- // String Template specializations.
---
-2.40.1