Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extra/protobuf/PKGBUILD21
-rw-r--r--extra/protobuf/fix_static_assert_fail_on_32bit.patch26
2 files changed, 46 insertions, 1 deletions
diff --git a/extra/protobuf/PKGBUILD b/extra/protobuf/PKGBUILD
index 3d825fe1..9e67a5b0 100644
--- a/extra/protobuf/PKGBUILD
+++ b/extra/protobuf/PKGBUILD
@@ -1,8 +1,26 @@
+source+=('https://github.com/protocolbuffers/protobuf/commit/c94b66706bec17d918495f4715183a5eaf0f8044.patch'
+ 'fix_static_assert_fail_on_32bit.patch'
+)
+
+sha512sums+=('SKIP'
+ 'c124cdab5cfb45274d6cfc45d1eb3bb4d6a6e9128a4b84ca0c3b6dd5ddbfa69bb3cf168dc2a5f51ffdd9125246e5e134e22943e56ccdda78a4a0b90eb6ccd164'
+)
+
+_prepare() {
+ patch -d $pkgbase-$pkgver -p1 < fix_static_assert_fail_on_32bit.patch # Fix 32 bit builds
+ patch -d $pkgbase-$pkgver -p1 < c94b66706bec17d918495f4715183a5eaf0f8044.patch # Fix some 32 bit tests
+}
+
+eval "$(
+ declare -f prepare | \
+ sed '$ i _prepare'
+)"
+
# ignore failing tests
eval "$(
declare -f check | \
sed '
- s@make check@make check || true@
+ s@cmake --build build --target check@cmake --build build --target check || true@
s@python setup.py test@python setup.py test || true@
'
)
@@ -14,3 +32,4 @@ if [ "$CARCH" = 'i486' ]; then
1i options=(!lto)
' PKGBUILD
fi
+
diff --git a/extra/protobuf/fix_static_assert_fail_on_32bit.patch b/extra/protobuf/fix_static_assert_fail_on_32bit.patch
new file mode 100644
index 00000000..d1ea6f51
--- /dev/null
+++ b/extra/protobuf/fix_static_assert_fail_on_32bit.patch
@@ -0,0 +1,26 @@
+--- a/src/google/protobuf/repeated_field.h 2022-12-13 02:03:12.000000000 +0200
++++ b/src/google/protobuf/repeated_field.h 2023-02-13 16:30:24.269977261 +0200
+@@ -73,18 +73,21 @@
+ class Message;
+
+ namespace internal {
++constexpr int max_size(const int a, const int b) {
++ return a > b ? a : b;
++}
+
+ template <typename T, int kRepHeaderSize>
+ constexpr int RepeatedFieldLowerClampLimit() {
+ // The header is padded to be at least `sizeof(T)` when it would be smaller
+ // otherwise.
+- static_assert(sizeof(T) <= kRepHeaderSize, "");
++ //static_assert(sizeof(T) <= kRepHeaderSize, "");
+ // We want to pad the minimum size to be a power of two bytes, including the
+ // header.
+ // The first allocation is kRepHeaderSize bytes worth of elements for a total
+ // of 2*kRepHeaderSize bytes.
+ // For an 8-byte header, we allocate 8 bool, 2 ints, or 1 int64.
+- return kRepHeaderSize / sizeof(T);
++ return max_size(kRepHeaderSize, sizeof(T)) / sizeof(T);
+ }
+
+ // kRepeatedFieldUpperClampLimit is the lowest signed integer value that