git: e47ce3c78b7b - 2025Q3 - devel/protobuf-c: fix symbol versioning support detection

From: Don Lewis <truckman_at_FreeBSD.org>
Date: Wed, 09 Jul 2025 10:51:14 UTC
The branch 2025Q3 has been updated by truckman:

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

commit e47ce3c78b7bb9a68aff3a32b52ecdc46ee17ca7
Author:     John Hein <jcfyecrayz@liamekaens.com>
AuthorDate: 2025-07-09 06:23:14 +0000
Commit:     Don Lewis <truckman@FreeBSD.org>
CommitDate: 2025-07-09 10:50:07 +0000

    devel/protobuf-c: fix symbol versioning support detection
    
    This is a real bug and it stems from protobuf-c ABI changes that
    removed symbol versioning incorrectly and unexpectedly when packages
    started getting built with more recent llvm (specifically lld).  So
    older packages of protobuf-c with the same PKGNAME are different
    than packages built with newer llvm.  This explains run-time linker
    problems like the one reported in this bug - even when users
    innocently just install some package updates.  This can cause project
    package builders to generate packages that are different without
    changing PKGNAME.
    
    The root cause for this issue with protobuf-c is that the configure
    test for symbol versioning support broke after recent lld changes
    that are stricter about undefined symbols.
    
    It used to be the case that devel/protobuf-c would properly detect
    symbol versioning support, but now after the lld changes, you see
    the following during 'make configure':
    
    checking if LD -Wl,--version-script works... no
    
    The attached patch fixes this and restores proper symbol versioning
    support detection.  It (or a similar change in configure.ac) can
    be fed upstream, but I have not opened any case upstream yet.
    
    It also sets HAS_SYMBOL_VERSION to help avoid such silent ABI
    breakage in the future.
    
    The patch also shuffles some lines based on 'portclippy' consistency
    ordering suggestions.
    
    PORTREVISION SHOULD also have been bumped after the recent update
    to devel/protobuf (early June 2025) changed the .so ver of libprotobuf.
    The patch will fix that oversight because it bumps PORTREVISION for
    other reasons.
    
    PR:             282060
    Reported by:    Niall.oReilly+freebsd@no8.be
    MFH:            2025Q3
    Sponsored by:   DomainTools LLC
    
    (cherry picked from commit bf457ffa65d42f93737290ab628245dc9b365414)
---
 devel/protobuf-c/Makefile              | 12 +++++++-----
 devel/protobuf-c/files/patch-configure | 10 ++++++++++
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/devel/protobuf-c/Makefile b/devel/protobuf-c/Makefile
index ebe7444e276b..2fd1ca29ef29 100644
--- a/devel/protobuf-c/Makefile
+++ b/devel/protobuf-c/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	protobuf-c
 DISTVERSION=	1.5.1
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	devel
 MASTER_SITES=	https://github.com/protobuf-c/protobuf-c/releases/download/v${DISTVERSION}/
 
@@ -15,16 +15,18 @@ LIB_DEPENDS=	libabsl_log_internal_check_op.so:devel/abseil \
 		libprotobuf.so:devel/protobuf
 
 USES=		compiler:c++17-lang gmake libtool pkgconfig
+USE_CXXSTD=	c++17
+USE_LDCONFIG=	yes
 
 GNU_CONFIGURE=	yes
-USE_LDCONFIG=	yes
+CONFIGURE_ARGS=	--disable-static
 
 INSTALL_TARGET=	install-strip
 TEST_TARGET=	check
-USE_CXXSTD=	c++17
-PORTDOCS=	*
 
-CONFIGURE_ARGS=	--disable-static
+HAS_SYMBOL_VERSION=	${PREFIX}/lib/libprotobuf-c.so.1.0.0
+
+PORTDOCS=	*
 
 OPTIONS_DEFINE=	DOXYGEN DOCS
 OPTIONS_DEFAULT=	DOXYGEN
diff --git a/devel/protobuf-c/files/patch-configure b/devel/protobuf-c/files/patch-configure
new file mode 100644
index 000000000000..00d4e0475605
--- /dev/null
+++ b/devel/protobuf-c/files/patch-configure
@@ -0,0 +1,10 @@
+--- configure.orig	2025-02-02 04:07:13 UTC
++++ configure
+@@ -20282,6 +20283,7 @@ EOF
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ 
++int sym;
+ int
+ main (void)
+ {