[protobuf] Patch the pkg-config file to use the right flags for static libraries. (#25635)

* Patch the protobuf pkg-config file to work correctly with static libraries: the
PROTOBUF_USE_DLLS macro should only be set for dynamic libraries.

* Bump pkgrel

---------

Co-authored-by: Christoph Reiter <reiter.christoph@gmail.com>
This commit is contained in:
David Given 2025-09-22 19:16:47 +02:00 committed by GitHub
parent 5da24b8938
commit c9d1d57805
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 3 deletions

View File

@ -0,0 +1,20 @@
diff -u -r a/cmake/protobuf-lite.pc.cmake b/cmake/protobuf-lite.pc.cmake
--- a/cmake/protobuf-lite.pc.cmake 2025-05-28 18:52:59.000000000 +0200
+++ b/cmake/protobuf-lite.pc.cmake 2025-09-21 19:57:43.318803100 +0200
@@ -9,4 +9,5 @@
Requires: @_protobuf_PC_REQUIRES@
Libs: -L${libdir} -lprotobuf-lite @CMAKE_THREAD_LIBS_INIT@
Cflags: -I${includedir} @_protobuf_PC_CFLAGS@
+Cflags.private: -UPROTOBUF_USE_DLLS
Conflicts: protobuf
Only in b/cmake: protobuf-lite.pc.cmake~
diff -u -r a/cmake/protobuf.pc.cmake b/cmake/protobuf.pc.cmake
--- a/cmake/protobuf.pc.cmake 2025-05-28 18:52:59.000000000 +0200
+++ b/cmake/protobuf.pc.cmake 2025-09-21 19:57:28.771314100 +0200
@@ -9,4 +9,5 @@
Requires: @_protobuf_PC_REQUIRES@
Libs: -L${libdir} -lprotobuf@protobuf_LIBRARY_POSTFIX@ @CMAKE_THREAD_LIBS_INIT@
Cflags: -I${includedir} @_protobuf_PC_CFLAGS@
+Cflags.private: -UPROTOBUF_USE_DLLS
Conflicts: protobuf-lite
Only in b/cmake: protobuf.pc.cmake~

View File

@ -6,7 +6,7 @@ pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
# Note: make sure to update python-protobuf to match this version
pkgver=31.1
pkgrel=1
pkgrel=2
pkgdesc="Protocol Buffers - Google's data interchange format (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
@ -28,12 +28,14 @@ source=(https://github.com/protocolbuffers/${_realname}/releases/download/v${pkg
0001-fix-building-shared-libs-with-clang.patch
0002-windres-invocation.patch
0003-demote-error-about-buildtime-runtime-version-difference-to-warning.patch
0004-fix-build-with-gcc-15.patch)
0004-fix-build-with-gcc-15.patch
0005-pkgconfig-that-understands-static-libraries.patch)
sha256sums=('12bfd76d27b9ac3d65c00966901609e020481b9474ef75c7ff4601ac06fa0b82'
'0e8d4fcfad5bb0b635f1e1bbd2f4f85cb4d73b0a61fc33fae5136f062a40cfba'
'174f714b842d5153c79c5fda1ae775ee002aea11d53cb5d5f51cb5c4b9e63d29'
'2b680e1c642ccd5bb70b3dcf7217c27360bc0b74f63d8afb66dd668173d9b2dd'
'cb3594f1412422681768709c63139622b9f89c21f12b9bafa256ca44df8daa51')
'cb3594f1412422681768709c63139622b9f89c21f12b9bafa256ca44df8daa51'
'd118346d092caa8a3d6c02d88207d7cd9318fe3077b6b36cf32d1da79fe4128c')
apply_patch_with_msg() {
for _patch in "$@"
@ -55,6 +57,9 @@ prepare() {
apply_patch_with_msg \
0004-fix-build-with-gcc-15.patch
fi
apply_patch_with_msg \
0005-pkgconfig-that-understands-static-libraries.patch
}
build() {