commit: 295a4e97172b105b10b2f7197ab6827082c05481
Author: Alexis Ballier <aballier <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 3 10:05:31 2025 +0000
Commit: Alexis Ballier <aballier <AT> gentoo <DOT> org>
CommitDate: Fri Jun 6 12:51:43 2025 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=295a4e97
sci-electronics/gazebo: fix build with protobuf 30
Signed-off-by: Alexis Ballier <aballier <AT> gentoo.org>
sci-electronics/gazebo/files/protobuf30.patch | 223 ++++++++++++++++++++++++++
sci-electronics/gazebo/gazebo-11.15.1.ebuild | 1 +
2 files changed, 224 insertions(+)
diff --git a/sci-electronics/gazebo/files/protobuf30.patch
b/sci-electronics/gazebo/files/protobuf30.patch
new file mode 100644
index 000000000000..0639e0fa3abe
--- /dev/null
+++ b/sci-electronics/gazebo/files/protobuf30.patch
@@ -0,0 +1,223 @@
+Index: gazebo-11.15.1/gazebo/gui/ConfigWidget.cc
+===================================================================
+--- gazebo-11.15.1.orig/gazebo/gui/ConfigWidget.cc
++++ gazebo-11.15.1/gazebo/gui/ConfigWidget.cc
+@@ -595,7 +595,7 @@ QWidget *ConfigWidget::Parse(google::pro
+ if (!ref)
+ return NULL;
+
+- std::string name = field->name();
++ std::string name(field->name());
+
+ // Parse each field in the message
+ // TODO parse repeated fields
+@@ -754,7 +754,7 @@ QWidget *ConfigWidget::Parse(google::pro
+ if (typeValueDescriptor)
+ {
+ geometryTypeStr =
+- QString(typeValueDescriptor->name().c_str()).toLower().
++
QString(std::string(typeValueDescriptor->name()).c_str()).toLower().
+ toStdString();
+ }
+
+@@ -779,7 +779,7 @@ QWidget *ConfigWidget::Parse(google::pro
+ const google::protobuf::Descriptor *geomValueDescriptor =
+ geomValueMsg->GetDescriptor();
+
+- std::string geomMsgName = geomField->message_type()->name();
++ std::string geomMsgName(geomField->message_type()->name());
+ if (geomMsgName == "BoxGeom" || geomMsgName == "MeshGeom")
+ {
+ int fieldIdx = (geomMsgName == "BoxGeom") ? 0 : 1;
+@@ -1001,7 +1001,7 @@ QWidget *ConfigWidget::Parse(google::pro
+ const google::protobuf::EnumValueDescriptor *valueDescriptor =
+ descriptor->value(j);
+ if (valueDescriptor)
+- enumValues.push_back(valueDescriptor->name());
++ enumValues.push_back(std::string(valueDescriptor->name()));
+ }
+ configChildWidget =
+ this->CreateEnumWidget(name, enumValues, _level);
+@@ -1015,7 +1015,7 @@ QWidget *ConfigWidget::Parse(google::pro
+
+ newFieldWidget = configChildWidget;
+ }
+- this->UpdateEnumWidget(configChildWidget, value->name());
++ this->UpdateEnumWidget(configChildWidget,
std::string(value->name()));
+ break;
+ }
+ default:
+@@ -2086,7 +2086,7 @@ void ConfigWidget::UpdateMsg(google::pro
+ if (!ref)
+ return;
+
+- std::string name = field->name();
++ std::string name(field->name());
+
+ // Update each field in the message
+ // TODO update repeated fields
+Index: gazebo-11.15.1/gazebo/gui/ModelListWidget.cc
+===================================================================
+--- gazebo-11.15.1.orig/gazebo/gui/ModelListWidget.cc
++++ gazebo-11.15.1/gazebo/gui/ModelListWidget.cc
+@@ -1747,7 +1747,7 @@ void ModelListWidget::FillPropertyTree(c
+ else
+ {
+ for (int i = 0; i < surfaceModelEnum->value_count(); ++i)
+- types << surfaceModelEnum->value(i)->name().c_str();
++ types << std::string(surfaceModelEnum->value(i)->name()).c_str();
+ }
+
+ item->setAttribute("enumNames", types);
+@@ -3069,7 +3069,7 @@ void ModelListWidget::FillPropertyTree(c
+ }
+ else
+ {
+- types << engineTypeEnum->value(_msg.type()-1)->name().c_str();
++ types <<
std::string(engineTypeEnum->value(_msg.type()-1)->name()).c_str();
+ }
+
+ item->setAttribute("enumNames", types);
+Index: gazebo-11.15.1/gazebo/gui/plot/Palette.cc
+===================================================================
+--- gazebo-11.15.1.orig/gazebo/gui/plot/Palette.cc
++++ gazebo-11.15.1/gazebo/gui/plot/Palette.cc
+@@ -1179,7 +1179,7 @@ void Palette::FillFromMsg(google::protob
+ if (!field)
+ return;
+
+- auto name = field->name();
++ auto name = std::string(field->name());
+
+ if (field->is_repeated())
+ continue;
+Index: gazebo-11.15.1/gazebo/gui/plot/TopicCurveHandler.cc
+===================================================================
+--- gazebo-11.15.1.orig/gazebo/gui/plot/TopicCurveHandler.cc
++++ gazebo-11.15.1/gazebo/gui/plot/TopicCurveHandler.cc
+@@ -370,7 +370,7 @@ void TopicCurve::UpdateCurve(google::pro
+ if (!field)
+ continue;
+
+- std::string fieldName = field->name();
++ std::string fieldName(field->name());
+
+ // Check if message has timestamp and use it if it exists and is
+ // a top level msg field.
+Index: gazebo-11.15.1/gazebo/msgs/generator/GazeboGenerator.cc
+===================================================================
+--- gazebo-11.15.1.orig/gazebo/msgs/generator/GazeboGenerator.cc
++++ gazebo-11.15.1/gazebo/msgs/generator/GazeboGenerator.cc
+@@ -41,10 +41,10 @@ bool GazeboGenerator::Generate(const Fil
+ OutputDirectory *_generator_context,
+ std::string * /*_error*/) const
+ {
+- std::string headerFilename = _file->name();
++ std::string headerFilename(_file->name());
+ boost::replace_last(headerFilename, ".proto", ".pb.h");
+
+- std::string sourceFilename = _file->name();
++ std::string sourceFilename(_file->name());
+ boost::replace_last(sourceFilename, ".proto", ".pb.cc");
+
+ // Suppress expected warnings
+@@ -80,12 +80,12 @@ bool GazeboGenerator::Generate(const Fil
+ _generator_context->OpenForInsert(headerFilename, "namespace_scope"));
+ io::Printer printer(output.get(), '$');
+
+- std::string package = _file->package();
++ std::string package(_file->package());
+ boost::replace_all(package, ".", "::");
+
+ std::string ptrType = "typedef boost::shared_ptr<" + package
+- + "::" + _file->message_type(0)->name() + "> "
+- + _file->message_type(0)->name() + "Ptr;\n";
++ + "::" + std::string(_file->message_type(0)->name()) + "> "
++ + std::string(_file->message_type(0)->name()) + "Ptr;\n";
+
+ printer.Print(ptrType.c_str(), "name", "namespace_scope");
+ }
+@@ -96,12 +96,12 @@ bool GazeboGenerator::Generate(const Fil
+ _generator_context->OpenForInsert(headerFilename, "global_scope"));
+ io::Printer printer(output.get(), '$');
+
+- std::string package = _file->package();
++ std::string package(_file->package());
+ boost::replace_all(package, ".", "::");
+
+ std::string constType = "typedef const boost::shared_ptr<" + package
+- + "::" + _file->message_type(0)->name() + " const> Const"
+- + _file->message_type(0)->name() + "Ptr;";
++ + "::" + std::string(_file->message_type(0)->name()) + " const> Const"
++ + std::string(_file->message_type(0)->name()) + "Ptr;";
+
+ printer.Print(constType.c_str(), "name", "global_scope");
+ }
+@@ -112,12 +112,12 @@ bool GazeboGenerator::Generate(const Fil
+ _generator_context->OpenForInsert(sourceFilename, "global_scope"));
+ io::Printer printer(output.get(), '$');
+
+- std::string package = _file->package();
++ std::string package(_file->package());
+ boost::replace_all(package, ".", "::");
+
+- std::string name = _file->message_type(0)->name();
++ std::string name(_file->message_type(0)->name());
+
+- std::string constType = "GZ_REGISTER_STATIC_MSG(\"" + _file->package() +
++ std::string constType = "GZ_REGISTER_STATIC_MSG(\"" +
std::string(_file->package()) +
+ "." + name + "\", " + name + ")\n";
+ printer.Print(constType.c_str(), "name", "namespace_scope");
+ }
+Index: gazebo-11.15.1/gazebo/msgs/msgs.cc
+===================================================================
+--- gazebo-11.15.1.orig/gazebo/msgs/msgs.cc
++++ gazebo-11.15.1/gazebo/msgs/msgs.cc
+@@ -118,7 +118,7 @@ namespace gazebo
+
+ std::string *serialized_data = pkg.mutable_serialized_data();
+ if (!message.IsInitialized())
+- gzthrow("Can't serialize message of type[" + message.GetTypeName() +
++ gzthrow("Can't serialize message of type[" +
std::string(message.GetTypeName()) +
+ "] because it is missing required fields");
+
+ if (!message.SerializeToString(serialized_data))
+Index: gazebo-11.15.1/gazebo/transport/CallbackHelper.hh
+===================================================================
+--- gazebo-11.15.1.orig/gazebo/transport/CallbackHelper.hh
++++ gazebo-11.15.1/gazebo/transport/CallbackHelper.hh
+@@ -136,7 +136,7 @@ namespace gazebo
+ if ((m = dynamic_cast<google::protobuf::Message*>(&test))
+ == NULL)
+ gzthrow("Message type must be a google::protobuf type\n");
+- return m->GetTypeName();
++ return std::string(m->GetTypeName());
+ }
+
+ // documentation inherited
+Index: gazebo-11.15.1/gazebo/transport/Node.hh
+===================================================================
+--- gazebo-11.15.1.orig/gazebo/transport/Node.hh
++++ gazebo-11.15.1/gazebo/transport/Node.hh
+@@ -228,7 +228,7 @@ namespace gazebo
+ const google::protobuf::Message &_message)
+ {
+ transport::PublisherPtr pub = this->Advertise(_topic,
+- _message.GetTypeName());
++ std::string(_message.GetTypeName()));
+ pub->WaitForConnection();
+
+ pub->Publish(_message, true);
+Index: gazebo-11.15.1/gazebo/transport/TopicManager.hh
+===================================================================
+--- gazebo-11.15.1.orig/gazebo/transport/TopicManager.hh
++++ gazebo-11.15.1/gazebo/transport/TopicManager.hh
+@@ -160,7 +160,7 @@ namespace gazebo
+ if (!msg)
+ gzthrow("Advertise requires a google protobuf type");
+
+- return this->Advertise(_topic, msg->GetTypeName(),
_queueLimit,
++ return this->Advertise(_topic,
std::string(msg->GetTypeName()), _queueLimit,
+ _hzRate);
+ }
+
diff --git a/sci-electronics/gazebo/gazebo-11.15.1.ebuild
b/sci-electronics/gazebo/gazebo-11.15.1.ebuild
index d5dea1bebd8b..7978541e7761 100644
--- a/sci-electronics/gazebo/gazebo-11.15.1.ebuild
+++ b/sci-electronics/gazebo/gazebo-11.15.1.ebuild
@@ -66,6 +66,7 @@ PATCHES=(
"${FILESDIR}/qwt2.patch"
"${FILESDIR}/cmake.patch"
"${FILESDIR}/boost187.patch"
+ "${FILESDIR}/protobuf30.patch"
)
src_configure() {