git: 1ac3ac5740b4 - 2022Q3 - www/firefox: fix build on i386

From: Christoph Moench-Tegeder <cmt_at_FreeBSD.org>
Date: Sat, 20 Aug 2022 21:24:06 UTC
The branch 2022Q3 has been updated by cmt:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1ac3ac5740b49896301d1272993c766cd896a3f6

commit 1ac3ac5740b49896301d1272993c766cd896a3f6
Author:     Christoph Moench-Tegeder <cmt@FreeBSD.org>
AuthorDate: 2022-08-20 21:20:00 +0000
Commit:     Christoph Moench-Tegeder <cmt@FreeBSD.org>
CommitDate: 2022-08-20 21:23:55 +0000

    www/firefox: fix build on i386
    
    The included protobuf tries to figure out optimal memory alignment
    for some variables, but on i386 our library is not really helpful
    with that. Adjust the alignment for the problematic case, and disable
    one static_assert() checking for alignment values (borrowed from
    devel/protobuf port).
    
    (cherry picked from commit 0e5839c5f4464fbce310362b973101753f73e4be)
---
 www/firefox/files/patch-i386-protobuf-alignment | 29 +++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/www/firefox/files/patch-i386-protobuf-alignment b/www/firefox/files/patch-i386-protobuf-alignment
new file mode 100644
index 000000000000..de5cdb723ce2
--- /dev/null
+++ b/www/firefox/files/patch-i386-protobuf-alignment
@@ -0,0 +1,29 @@
+# On FreeBSD/i386's LLVM, actual alignment for atomic types requires
+# stricter alignment rules, mostly on 8 byte boundaries instead of 4 byte
+# as indicated by max_align_t.
+# Patch for arenastring.cc borrowed from devel/protobuf/files/patch-i386
+
+--- toolkit/components/protobuf/src/google/protobuf/arenastring.cc.orig	2022-08-20 22:07:01.600662000 +0200
++++ toolkit/components/protobuf/src/google/protobuf/arenastring.cc	2022-08-20 22:07:55.969192000 +0200
+@@ -64,7 +64,8 @@
+ #endif
+ constexpr size_t kStringAlign = alignof(std::string);
+ 
+-static_assert((kStringAlign > kNewAlign ? kStringAlign : kNewAlign) >= 8, "");
++// this does not hold with llvm on FreeBSD/i386
++// static_assert((kStringAlign > kNewAlign ? kStringAlign : kNewAlign) >= 8, "");
+ static_assert(alignof(ExplicitlyConstructedArenaString) >= 8, "");
+ 
+ }  // namespace
+
+--- ./toolkit/components/protobuf/src/google/protobuf/arena_impl.h.orig	2022-08-20 20:07:57.096818000 +0200
++++ ./toolkit/components/protobuf/src/google/protobuf/arena_impl.h	2022-08-20 21:40:47.821690000 +0200
+@@ -640,7 +640,7 @@
+ #ifdef _MSC_VER
+ #pragma warning(disable : 4324)
+ #endif
+-  struct alignas(kCacheAlignment) CacheAlignedLifecycleIdGenerator {
++  struct alignas(alignof(std::atomic<LifecycleIdAtomic>)) CacheAlignedLifecycleIdGenerator {
+     std::atomic<LifecycleIdAtomic> id;
+   };
+   static CacheAlignedLifecycleIdGenerator lifecycle_id_generator_;