protobuf_{21,25,27,29,30,31}: fix 32-bit build

(cherry picked from commit 412579fa0c)
This commit is contained in:
Ryan Hendrickson
2026-07-17 01:06:07 -04:00
committed by github-actions[bot]
parent c5e4db0e30
commit df5bbfcf4e

View File

@@ -89,6 +89,14 @@ stdenv.mkDerivation (finalAttrs: {
substituteInPlace src/google/protobuf/testing/googletest.cc \
--replace-fail 'tmpnam(b)' '"'$TMPDIR'/foo"'
''
# Adapt https://github.com/protocolbuffers/protobuf/pull/22412 for various
# older versions. sed -z spans newlines, so this can capture and replace
# the full multiline #if macro.
+ lib.optionalString (lib.versionOlder version "32") ''
sed -zi 's/\(#if \w*(clang::musttail)\)[^\n]*\(\\\n[^\n]*\)*/'\
'\1 \&\& (defined(__aarch64__) || defined(__x86_64__) || defined(_M_X64))/' \
src/google/protobuf/port_def.inc
''
# Keep the sentinel macro non-retained for GCC 15+ to match generated
# extension objects in linker arrays and avoid section type conflicts.
+ lib.optionalString (lib.versionAtLeast version "34") ''