From 4c5ae6b55f3e3e39d291679f89822f496cf190ee Mon Sep 17 00:00:00 2001 From: Riccardo Ressi <104351458+rressi-at-globus@users.noreply.github.com> Date: Wed, 26 Nov 2025 04:47:40 +0100 Subject: [PATCH] [protobuf] Fix constinit with clang cl (#48425) --- ports/protobuf/fix-constinit-with-clang-cl.patch | 14 ++++++++++++++ ports/protobuf/portfile.cmake | 1 + ports/protobuf/vcpkg.json | 2 +- versions/baseline.json | 2 +- versions/p-/protobuf.json | 5 +++++ 5 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 ports/protobuf/fix-constinit-with-clang-cl.patch diff --git a/ports/protobuf/fix-constinit-with-clang-cl.patch b/ports/protobuf/fix-constinit-with-clang-cl.patch new file mode 100644 index 0000000000..cb15101300 --- /dev/null +++ b/ports/protobuf/fix-constinit-with-clang-cl.patch @@ -0,0 +1,14 @@ +diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc +index a512b4843..31f1f5a12 100644 +--- a/src/google/protobuf/port_def.inc ++++ b/src/google/protobuf/port_def.inc +@@ -678,6 +678,9 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), + # define PROTOBUF_CONSTINIT + # define PROTOBUF_CONSTEXPR constexpr + # endif ++#elif defined(_MSC_VER) && defined(__clang__) ++# define PROTOBUF_CONSTINIT ++# define PROTOBUF_CONSTEXPR constexpr + #else + # if defined(__cpp_constinit) && !defined(__CYGWIN__) + # define PROTOBUF_CONSTINIT constinit diff --git a/ports/protobuf/portfile.cmake b/ports/protobuf/portfile.cmake index a5ec253e81..5198e983e4 100644 --- a/ports/protobuf/portfile.cmake +++ b/ports/protobuf/portfile.cmake @@ -11,6 +11,7 @@ vcpkg_from_github( fix-install-dirs.patch fix-mingw-tail-call.patch fix-abseil.patch + fix-constinit-with-clang-cl.patch ) string(COMPARE EQUAL "${TARGET_TRIPLET}" "${HOST_TRIPLET}" protobuf_BUILD_PROTOC_BINARIES) diff --git a/ports/protobuf/vcpkg.json b/ports/protobuf/vcpkg.json index 4ceada9857..c7016a7f8d 100644 --- a/ports/protobuf/vcpkg.json +++ b/ports/protobuf/vcpkg.json @@ -1,7 +1,7 @@ { "name": "protobuf", "version": "5.29.5", - "port-version": 2, + "port-version": 3, "description": "Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data.", "homepage": "https://github.com/protocolbuffers/protobuf", "license": "BSD-3-Clause", diff --git a/versions/baseline.json b/versions/baseline.json index 95ae8bcb99..1ed9049789 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -7770,7 +7770,7 @@ }, "protobuf": { "baseline": "5.29.5", - "port-version": 2 + "port-version": 3 }, "protobuf-c": { "baseline": "1.5.2", diff --git a/versions/p-/protobuf.json b/versions/p-/protobuf.json index 156ffec9e0..da0aeca80c 100644 --- a/versions/p-/protobuf.json +++ b/versions/p-/protobuf.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "a8fdd2b1b4283409700152a6ac8639c005d1c103", + "version": "5.29.5", + "port-version": 3 + }, { "git-tree": "b71ee5bb425cd832ed1615601bd92573f07e9206", "version": "5.29.5",