git: b5673e0619b5 - main - devel/rubygem-google-protobuf*: fix segfaults caused by public symbols

From: Matthias Fechner <mfechner_at_FreeBSD.org>
Date: Sat, 19 Nov 2022 05:12:51 UTC
The branch main has been updated by mfechner:

URL: https://cgit.FreeBSD.org/ports/commit/?id=b5673e0619b56126e2117ac98cbcbe2be24b959a

commit b5673e0619b56126e2117ac98cbcbe2be24b959a
Author:     Dan McGregor <dan.mcgregor@usask.ca>
AuthorDate: 2022-11-19 05:03:31 +0000
Commit:     Matthias Fechner <mfechner@FreeBSD.org>
CommitDate: 2022-11-19 05:12:24 +0000

    devel/rubygem-google-protobuf*: fix segfaults caused by public symbols
    
    If more than one version of this gem is installed it causes segfaults.
    The problem is reported also here:
    https://gitlab.com/gitlab-org/gitlab/-/issues/345693
    
    I created a merge request upstream for this patch:
    https://github.com/protocolbuffers/protobuf/pull/10832
    https://github.com/protocolbuffers/protobuf/pull/11029
    
    PR:             266925
    Approved by:    sunpoet (maintainer timeout)
    Differential Revision:  https://reviews.freebsd.org/D37140
---
 devel/rubygem-google-protobuf/Makefile                        |  1 +
 .../files/patch-ext_google_protobuf__c_extconf.rb             | 11 +++++++++++
 devel/rubygem-google-protobuf319/Makefile                     |  1 +
 .../files/patch-ext_google_protobuf__c_extconf.rb             | 11 +++++++++++
 4 files changed, 24 insertions(+)

diff --git a/devel/rubygem-google-protobuf/Makefile b/devel/rubygem-google-protobuf/Makefile
index 2bc5c88becc4..815922782ef1 100644
--- a/devel/rubygem-google-protobuf/Makefile
+++ b/devel/rubygem-google-protobuf/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	google-protobuf
 PORTVERSION=	3.21.7
+PORTREVISION=	1
 CATEGORIES=	devel rubygems
 MASTER_SITES=	RG
 
diff --git a/devel/rubygem-google-protobuf/files/patch-ext_google_protobuf__c_extconf.rb b/devel/rubygem-google-protobuf/files/patch-ext_google_protobuf__c_extconf.rb
new file mode 100644
index 000000000000..4e85cdbb04e7
--- /dev/null
+++ b/devel/rubygem-google-protobuf/files/patch-ext_google_protobuf__c_extconf.rb
@@ -0,0 +1,11 @@
+--- ext/google/protobuf_c/extconf.rb.orig	2022-10-28 07:09:57 UTC
++++ ext/google/protobuf_c/extconf.rb
+@@ -6,7 +6,7 @@ ext_name = "google/protobuf_c"
+ 
+ dir_config(ext_name)
+ 
+-if RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /linux/
++if RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /linux/ || RUBY_PLATFORM =~ /freebsd/
+   $CFLAGS += " -std=gnu99 -O3 -DNDEBUG -fvisibility=hidden -Wall -Wsign-compare -Wno-declaration-after-statement"
+ else
+   $CFLAGS += " -std=gnu99 -O3 -DNDEBUG"
diff --git a/devel/rubygem-google-protobuf319/Makefile b/devel/rubygem-google-protobuf319/Makefile
index 9c155cbf549f..c947f890e510 100644
--- a/devel/rubygem-google-protobuf319/Makefile
+++ b/devel/rubygem-google-protobuf319/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	google-protobuf
 PORTVERSION=	3.19.6
+PORTREVISION=	1
 CATEGORIES=	devel rubygems
 MASTER_SITES=	RG
 PKGNAMESUFFIX=	319
diff --git a/devel/rubygem-google-protobuf319/files/patch-ext_google_protobuf__c_extconf.rb b/devel/rubygem-google-protobuf319/files/patch-ext_google_protobuf__c_extconf.rb
new file mode 100644
index 000000000000..aa8b00f64150
--- /dev/null
+++ b/devel/rubygem-google-protobuf319/files/patch-ext_google_protobuf__c_extconf.rb
@@ -0,0 +1,11 @@
+--- ext/google/protobuf_c/extconf.rb.orig	2022-10-28 07:07:50 UTC
++++ ext/google/protobuf_c/extconf.rb
+@@ -2,7 +2,7 @@
+ 
+ require 'mkmf'
+ 
+-if RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /linux/
++if RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /linux/ || RUBY_PLATFORM =~ /freebsd/
+   $CFLAGS += " -std=gnu99 -O3 -DNDEBUG -fvisibility=hidden -Wall -Wsign-compare -Wno-declaration-after-statement"
+ else
+   $CFLAGS += " -std=gnu99 -O3 -DNDEBUG"