Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/extra/protobuf
diff options
context:
space:
mode:
Diffstat (limited to 'extra/protobuf')
-rw-r--r--extra/protobuf/PKGBUILD30
-rw-r--r--extra/protobuf/fix_static_assert_fail_on_32bit.patch26
2 files changed, 49 insertions, 7 deletions
diff --git a/extra/protobuf/PKGBUILD b/extra/protobuf/PKGBUILD
index 2e13a8c5..aa67b1db 100644
--- a/extra/protobuf/PKGBUILD
+++ b/extra/protobuf/PKGBUILD
@@ -1,9 +1,25 @@
# ignore failing tests
+unset check
+
+# no LTO on i486
+if [ "$CARCH" = 'i486' ]; then
+ sed -i '
+ 1i options=(!lto)
+ ' PKGBUILD
+fi
+
+# We need Bazel to build the python package from the git tree
+# Instead, download the source package from pypi and use that
+# See https://github.com/protocolbuffers/protobuf/pull/15708
+source+=("https://files.pythonhosted.org/packages/source/p/protobuf/protobuf-5.${pkgver}.tar.gz")
+sha512sums+=("SKIP")
+makedepends=(${makedepends[@]//bazel/})
+
eval "$(
- declare -f check | \
- sed '
- s@make check@make check || true@
- s@python setup.py test@python setup.py test || true@
- '
-)
-"
+ declare -f build | sed '/bazel build/d' | sed '$ d' | sed '$ a cd "$srcdir/protobuf-5.${pkgver}"; python -m build --wheel --no-isolation ; }'
+ declare -f package_python-protobuf | sed 's@ \".*bazel-bin/python@ \"protobuf-5.${pkgver}\"@'
+)"
+
+if [[ $pkgver == "27.3" ]]; then
+ sha512sums[1]='18bc71031bbcbc3810a9985fa670465040f06a6c104ab8079b56bdfc499bb6cec40805a0cefd455031142490a576dc60aa8000523877ac0353b93558e9beabbd'
+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