Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
Date: 2021-11-26
Initial Package Version: From git 5.15 branch.
Upstream Status: Anything for gcc-11 and glibc-2.34 not used upstream.
Origin: upstream via gentoo, Douglas, fedora, self.
Description: Allows this to build and work on BLFS-10.1
Updated on 2021-05-04: add gentoo patch for gcc-11.
Updated on 2021-06-18: remove fix for graphcycles.cc which is now upstream
Updated on 2021-08-13: add fixes to compile and let browsers using it work on glibc-2.34
(apply the upstream_fixes-2 patch BEFORE applying this).
Updated on 2021-11-22: fixes for qtwebengine-5.15.7.

First, a patch from gentoo to avoid the build from a git version requiring
git, although the .git directories are still required.

generate_gni.sh: update_readme() runs git at the end of process, prevent it.

Thanks-to: Georgy Yakovlev <gyakovlev@gentoo.org>

--- a/src/3rdparty/chromium/third_party/libvpx/generate_gni.sh	2021-02-07 12:51:49.438514897 +0100
+++ b/src/3rdparty/chromium/third_party/libvpx/generate_gni.sh	2021-02-21 16:23:38.375724515 +0100
@@ -519,8 +519,3 @@
 
 gn format --in-place $BASE_DIR/BUILD.gn
 gn format --in-place $BASE_DIR/libvpx_srcs.gni
-
-cd $BASE_DIR/$LIBVPX_SRC_DIR
-update_readme
-
-cd $BASE_DIR

Second used to be a patch from fedora, via Arch, to make some web pages
render when glibc-2.33 is used.  That was chromium bug 1164975 which has
been fixed differently and backported to qtwebengine-5.15.6.


Third, a patch from Douglas R. Reno (renodr at linuxfromscratch dot org):

When building qtwebengine where libxml2 has been built before ICU has been 
installed, a build failure will occur because QtWebEngine will attempt to use
it's internal version of libxml2, which *was not* patched against API changes
in ICU-68.1+. These changes involved removing the TRUE and FALSE macros, and
the official documentation states that developers should use 'true' and 'false'
instead, of course making sure that 'stdbool.h' is included so that the compiler
can actually find those boolean values. Since Chromium's internal version of ICU
is older than ours, it's not a problem when building with the internal version 
of ICU. Users who have installed ICU before libxml2 are exempt from running into
this issue. 

diff -Naurp qtwebengine-everywhere-src-5.15.2.orig/src/3rdparty/chromium/third_party/libxml/src/encoding.c qtwebengine-everywhere-src-5.15.2/src/3rdparty/chromium/third_party/libxml/src/encoding.c
--- qtwebengine-everywhere-src-5.15.2.orig/src/3rdparty/chromium/third_party/libxml/src/encoding.c 2020-11-06 19:22:36.000000000 -0600
+++ qtwebengine-everywhere-src-5.15.2/src/3rdparty/chromium/third_party/libxml/src/encoding.c 2020-12-08 19:39:00.607894718 -0600
@@ -44,7 +44,7 @@
 #endif
 #include <libxml/globals.h>
 #include <libxml/xmlerror.h>
-
+#include <stdbool.h>
 #include "buf.h"
 #include "enc.h"

@@ -1893,7 +1893,7 @@ xmlUconvWrapper(uconv_t *cd, int toUnico
     *inlen = ucv_in - (const char*) in;
     *outlen = ucv_out - (char *) out;
     if (U_SUCCESS(err)) {
-        /* reset pivot buf if this is the last call for input (flush==TRUE) */
+        /* reset pivot buf if this is the last call for input (flush==true) */
         if (flush)
             cd->pivot_source = cd->pivot_target = cd->pivot_buf;
         return 0;
@@ -1958,7 +1958,7 @@ xmlEncOutputChunk(xmlCharEncodingHandler
 #ifdef LIBXML_ICU_ENABLED
     else if (handler->uconv_out != NULL) {
         ret = xmlUconvWrapper(handler->uconv_out, 0, out, outlen, in, inlen,
-                              TRUE);
+                              true);
     }
 #endif /* LIBXML_ICU_ENABLED */
     else { 

Fourth, patch from gentoo to allow it to build with gcc-11 where some
less-used headers such as <limits> have been removed from the C++
standard library headers which used to include them, and must now be
included where needed. [https://gcc.gnu.org/gcc-11/porting_to.html]

diff --git a/src/3rdparty/chromium/third_party/angle/src/libANGLE/HandleAllocator.cpp b/src/3rdparty/chromium/third_party/angle/src/libANGLE/HandleAllocator.cpp
index 013f1dfb2..3ce63c192 100644
--- a/src/3rdparty/chromium/third_party/angle/src/libANGLE/HandleAllocator.cpp
+++ b/src/3rdparty/chromium/third_party/angle/src/libANGLE/HandleAllocator.cpp
@@ -9,6 +9,7 @@
 
 #include "libANGLE/HandleAllocator.h"
 
+#include <limits>
 #include <algorithm>
 #include <functional>
 
diff --git a/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/containers/string_pool.cc b/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/containers/string_pool.cc
index fd651958f..1e8d0606c 100644
--- a/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/containers/string_pool.cc
+++ b/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/containers/string_pool.cc
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
+#include <limits>
 #include "src/trace_processor/containers/string_pool.h"
 
-#include <limits>
 
 #include "perfetto/base/logging.h"
 #include "perfetto/ext/base/utils.h"
diff --git a/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/db/column.cc b/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/db/column.cc
index 00496b335..0dccfeb8a 100644
--- a/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/db/column.cc
+++ b/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/db/column.cc
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+#include <limits>
 #include "src/trace_processor/db/column.h"
 
 #include "src/trace_processor/db/compare.h"
diff --git a/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/types/variadic.cc b/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/types/variadic.cc
index 837bfeba9..cdd56817d 100644
--- a/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/types/variadic.cc
+++ b/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/types/variadic.cc
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+#include <limits>
 #include "src/trace_processor/types/variadic.h"
 
 namespace perfetto {
diff --git a/src/3rdparty/chromium/ui/accessibility/platform/ax_platform_atk_hyperlink.cc b/src/3rdparty/chromium/ui/accessibility/platform/ax_platform_atk_hyperlink.cc
index be91def6b..73f202356 100644
--- a/src/3rdparty/chromium/ui/accessibility/platform/ax_platform_atk_hyperlink.cc
+++ b/src/3rdparty/chromium/ui/accessibility/platform/ax_platform_atk_hyperlink.cc
@@ -245,7 +245,7 @@ static void AXPlatformAtkHyperlinkInit(AXPlatformAtkHyperlink* self, gpointer) {
 }
 
 GType ax_platform_atk_hyperlink_get_type() {
-  static volatile gsize type_volatile = 0;
+  static gsize type_volatile = 0;
 
   AXPlatformNodeAuraLinux::EnsureGTypeInit();
 
diff --git a/src/3rdparty/chromium/ui/accessibility/platform/ax_platform_node_auralinux.cc b/src/3rdparty/chromium/ui/accessibility/platform/ax_platform_node_auralinux.cc
index 04125c6fd..6c64e5d8e 100644
--- a/src/3rdparty/chromium/ui/accessibility/platform/ax_platform_node_auralinux.cc
+++ b/src/3rdparty/chromium/ui/accessibility/platform/ax_platform_node_auralinux.cc
@@ -2274,7 +2274,7 @@ void ClassInit(gpointer class_pointer, gpointer /* class_data */) {
 GType GetType() {
   AXPlatformNodeAuraLinux::EnsureGTypeInit();
 
-  static volatile gsize type_volatile = 0;
+  static gsize type_volatile = 0;
   if (g_once_init_enter(&type_volatile)) {
     static const GTypeInfo type_info = {
         sizeof(AXPlatformNodeAuraLinuxClass),  // class_size
diff --git a/src/3rdparty/chromium/ui/gtk/gtk_key_bindings_handler.cc b/src/3rdparty/chromium/ui/gtk/gtk_key_bindings_handler.cc
index c663a2074..38a342484 100644
--- a/src/3rdparty/chromium/ui/gtk/gtk_key_bindings_handler.cc
+++ b/src/3rdparty/chromium/ui/gtk/gtk_key_bindings_handler.cc
@@ -141,7 +141,7 @@ void GtkKeyBindingsHandler::HandlerClassInit(HandlerClass* klass) {
 }
 
 GType GtkKeyBindingsHandler::HandlerGetType() {
-  static volatile gsize type_id_volatile = 0;
+  static gsize type_id_volatile = 0;
   if (g_once_init_enter(&type_id_volatile)) {
     GType type_id = g_type_register_static_simple(
         GTK_TYPE_TEXT_VIEW, g_intern_static_string("GtkKeyBindingsHandler"),
--- a/src/3rdparty/chromium/components/bookmarks/browser/bookmark_expanded_state_tracker.cc
+++ b/src/3rdparty/chromium/components/bookmarks/browser/bookmark_expanded_state_tracker.cc
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <cstddef>
 #include "components/bookmarks/browser/bookmark_expanded_state_tracker.h"
 
 #include <stdint.h>
diff --git a/src/3rdparty/chromium/components/bookmarks/browser/base_bookmark_model_observer.cc b/src/3rdparty/chromium/components/bookmarks/browser/base_bookmark_model_observer.cc
index 657a3c96b..ad641a082 100644
--- a/src/3rdparty/chromium/components/bookmarks/browser/base_bookmark_model_observer.cc
+++ b/src/3rdparty/chromium/components/bookmarks/browser/base_bookmark_model_observer.cc
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <cstddef>
+
 #include "components/bookmarks/browser/base_bookmark_model_observer.h"
 
 namespace bookmarks {
 

Fifth, upstream abseil fixes

https://github.com/abseil/abseil-cpp/commit/a9831f1cbf93fb18dd951453635f488037454ce9.diff

Upstream abseil fix for glibc-2.34, ignoring the change to CMake/AbseilHelpers.cmake
which alters code creating a pkgconfig file - that is absent from the chromium copy
of abseil.

Rediffed to apply to top level with -p1.


diff -Naur a/src/3rdparty/chromium/third_party/abseil-cpp/absl/debugging/failure_signal_handler.cc b/src/3rdparty/chromium/third_party/abseil-cpp/absl/debugging/failure_signal_handler.cc
--- a/src/3rdparty/chromium/third_party/abseil-cpp/absl/debugging/failure_signal_handler.cc	2021-04-01 12:19:23.000000000 +0100
+++ b/src/3rdparty/chromium/third_party/abseil-cpp/absl/debugging/failure_signal_handler.cc	2021-08-11 19:26:02.264520116 +0100
@@ -135,7 +135,8 @@
 #else
   const size_t page_mask = sysconf(_SC_PAGESIZE) - 1;
 #endif
-  size_t stack_size = (std::max(SIGSTKSZ, 65536) + page_mask) & ~page_mask;
+  size_t stack_size =
+      (std::max<size_t>(SIGSTKSZ, 65536) + page_mask) & ~page_mask;
 #if defined(ABSL_HAVE_ADDRESS_SANITIZER) || \
     defined(ABSL_HAVE_MEMORY_SANITIZER) || defined(ABSL_HAVE_THREAD_SANITIZER)
   // Account for sanitizer instrumentation requiring additional stack space.
diff -Naur a/src/3rdparty/chromium/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h b/src/3rdparty/chromium/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h
--- a/src/3rdparty/chromium/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h	2021-04-01 12:19:23.000000000 +0100
+++ b/src/3rdparty/chromium/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h	2021-08-11 19:26:02.264520116 +0100
@@ -108,6 +108,14 @@
 StringConvertResult FormatConvertImpl(string_view v,
                                       FormatConversionSpecImpl conv,
                                       FormatSinkImpl* sink);
+#if defined(ABSL_HAVE_STD_STRING_VIEW) && !defined(ABSL_USES_STD_STRING_VIEW)
+inline StringConvertResult FormatConvertImpl(std::string_view v,
+                                             FormatConversionSpecImpl conv,
+                                             FormatSinkImpl* sink) {
+  return FormatConvertImpl(absl::string_view(v.data(), v.size()), conv, sink);
+}
+#endif  // ABSL_HAVE_STD_STRING_VIEW && !ABSL_USES_STD_STRING_VIEW
+
 ArgConvertResult<FormatConversionCharSetUnion(
     FormatConversionCharSetInternal::s, FormatConversionCharSetInternal::p)>
 FormatConvertImpl(const char* v, const FormatConversionSpecImpl conv,
diff -Naur a/src/3rdparty/chromium/third_party/abseil-cpp/absl/strings/internal/str_format/convert_test.cc b/src/3rdparty/chromium/third_party/abseil-cpp/absl/strings/internal/str_format/convert_test.cc
--- a/src/3rdparty/chromium/third_party/abseil-cpp/absl/strings/internal/str_format/convert_test.cc	2021-04-01 12:19:23.000000000 +0100
+++ b/src/3rdparty/chromium/third_party/abseil-cpp/absl/strings/internal/str_format/convert_test.cc	2021-08-11 19:26:02.264520116 +0100
@@ -215,6 +215,9 @@
   TestStringConvert(static_cast<const char*>("hello"));
   TestStringConvert(std::string("hello"));
   TestStringConvert(string_view("hello"));
+#if defined(ABSL_HAVE_STD_STRING_VIEW)
+  TestStringConvert(std::string_view("hello"));
+#endif  // ABSL_HAVE_STD_STRING_VIEW
 }
 
 TEST_F(FormatConvertTest, NullString) {

Sixth: a patch to compile breakpad on glibc-2.34, found at fedora

The breakpad part of
https://src.fedoraproject.org/rpms/qt5-qtwebengine/raw/rawhide/f/qtwebengine-everywhere-src-5.15.5-SIGSTKSZ.patch
(abseil already fixed)

diff -Naur a/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc b/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
--- a/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc	2021-04-01 12:19:23.000000000 +0100
+++ b/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc	2021-08-12 00:43:40.100863695 +0100
@@ -138,7 +138,7 @@
   // SIGSTKSZ may be too small to prevent the signal handlers from overrunning
   // the alternative stack. Ensure that the size of the alternative stack is
   // large enough.
-  static const unsigned kSigStackSize = std::max(16384, SIGSTKSZ);
+  static const unsigned kSigStackSize = std::max<unsigned>(16384, SIGSTKSZ);
 
   // Only set an alternative stack if there isn't already one, or if the current
   // one is too small.

Seventh: a patch from fedora to handle time64 syscalls
Fixed up to apply to 5.15.7 (parts were upstream but in a slightly different
order).  For the first hunk I commented the replaced line instead of deleting
it, as a reminder to myself that I was not at all sure this was a correct fix.
But it seems to work in my initial test build, so I'm not going to rediff.

diff -ur a/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc b/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
--- a/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc	2021-11-21 05:26:12.779893741 +0000
+++ b/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc	2021-11-21 05:48:06.855720781 +0000
@@ -158,7 +158,16 @@
     return Allow();
 #endif
 
-  if (SyscallSets::IsClockApi(sysno)) {
+//  if (SyscallSets::IsClockApi(sysno)) {
+  if (sysno == __NR_clock_gettime || sysno == __NR_clock_nanosleep
+#if defined(__NR_clock_gettime64)
+                                  || sysno == __NR_clock_gettime64
+#endif
+#if defined(__NR_clock_nanosleep_time64)
+                                  || sysno == __NR_clock_nanosleep_time64
+#endif
+  ) {
+
     return RestrictClockID();
   }
 
diff -up qtwebengine-everywhere-src-5.15.5/src/3rdparty/chromium/sandbox/linux/system_headers/arm_linux_syscalls.h.sandbox-time64-syscalls qtwebengine-everywhere-src-5.15.5/src/3rdparty/chromium/sandbox/linux/system_headers/arm_linux_syscalls.h
--- qtwebengine-everywhere-src-5.15.5/src/3rdparty/chromium/sandbox/linux/system_headers/arm_linux_syscalls.h.sandbox-time64-syscalls	2021-06-24 10:36:45.694826524 -0500
+++ qtwebengine-everywhere-src-5.15.5/src/3rdparty/chromium/sandbox/linux/system_headers/arm_linux_syscalls.h	2021-06-24 10:37:50.383852263 -0500
@@ -1441,6 +1441,14 @@
 #define __NR_io_pgetevents (__NR_SYSCALL_BASE+399)
 #endif
 
+#if !defined(__NR_clock_gettime64)
+#define __NR_clock_gettime64 (__NR_SYSCALL_BASE+403)
+#endif
+
+#if !defined(__NR_clock_nanosleep_time64)
+#define __NR_clock_nanosleep_time64 (__NR_SYSCALL_BASE+407)
+#endif
+
 // ARM private syscalls.
 #if !defined(__ARM_NR_BASE)
 #define __ARM_NR_BASE (__NR_SYSCALL_BASE + 0xF0000)
diff -up qtwebengine-everywhere-src-5.15.5/src/3rdparty/chromium/sandbox/linux/system_headers/mips_linux_syscalls.h.sandbox-time64-syscalls qtwebengine-everywhere-src-5.15.5/src/3rdparty/chromium/sandbox/linux/system_headers/mips_linux_syscalls.h
--- qtwebengine-everywhere-src-5.15.5/src/3rdparty/chromium/sandbox/linux/system_headers/mips_linux_syscalls.h.sandbox-time64-syscalls	2021-05-28 07:05:45.000000000 -0500
+++ qtwebengine-everywhere-src-5.15.5/src/3rdparty/chromium/sandbox/linux/system_headers/mips_linux_syscalls.h	2021-06-24 10:36:45.695826525 -0500
@@ -1433,4 +1433,12 @@
 #define __NR_memfd_create (__NR_Linux + 354)
 #endif
 
+#if !defined(__NR_clock_gettime64)
+#define __NR_clock_gettime64 (__NR_Linux + 403)
+#endif
+
+#if !defined(__NR_clock_nanosleep_time64)
+#define __NR_clock_nanosleep_time64 (__NR_Linux + 407)
+#endif
+
 #endif  // SANDBOX_LINUX_SYSTEM_HEADERS_MIPS_LINUX_SYSCALLS_H_

