[packages/gtk-webkit4] - patch to split GeneratedSerializers.cpp (3MB cpp file is impossible to compile on 32-bit host)
qboosh
qboosh at pld-linux.org
Sat Jun 13 18:58:40 CEST 2026
commit 65dfe5696a66d36a88411b980acf40002f8c589e
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Sat Jun 13 18:58:54 2026 +0200
- patch to split GeneratedSerializers.cpp (3MB cpp file is impossible to compile on 32-bit host)
gtk-webkit4.spec | 12 ++-
webkitgtk-serializers.patch | 237 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 244 insertions(+), 5 deletions(-)
---
diff --git a/gtk-webkit4.spec b/gtk-webkit4.spec
index c991d87..ae32d80 100644
--- a/gtk-webkit4.spec
+++ b/gtk-webkit4.spec
@@ -37,6 +37,7 @@ Patch1: %{name}-icu59.patch
Patch2: parallel-gir.patch
Patch3: %{name}-driver-version-suffix.patch
Patch4: max-bundle-size.patch
+Patch5: webkitgtk-serializers.patch
URL: https://webkitgtk.org/
BuildRequires: /usr/bin/ld.gold
BuildRequires: EGL-devel
@@ -193,11 +194,12 @@ Dokumentacja API portu WebKitu do GTK+ 3.
%prep
%setup -q -n webkitgtk-%{version}
-%patch -P 0 -p1
-%patch -P 1 -p1
-%patch -P 2 -p1
-%patch -P 3 -p1
-%patch -P 4 -p1
+%patch -P0 -p1
+%patch -P1 -p1
+%patch -P2 -p1
+%patch -P3 -p1
+%patch -P4 -p1
+%patch -P5 -p1
%build
CXXFLAGS="%{rpmcxxflags} -DNDEBUG %{?with_lowmem:--param ggc-min-expand=20 --param ggc-min-heapsize=65536}"
diff --git a/webkitgtk-serializers.patch b/webkitgtk-serializers.patch
new file mode 100644
index 0000000..4d73b90
--- /dev/null
+++ b/webkitgtk-serializers.patch
@@ -0,0 +1,237 @@
+Based on commit https://github.com/WebKit/WebKit/commit/9823057a18307774342fa90acf9c0e1c189e30a8
+but with "Shared" part split additionally in 4 files to let compilation fit in 3GB address space
+plus one change backported from 2.52.x to allow build with split serializers
+
+--- webkitgtk-2.50.6/Source/WebKit/CMakeLists.txt.orig 2026-03-04 01:15:18.085550300 +0100
++++ webkitgtk-2.50.6/Source/WebKit/CMakeLists.txt 2026-06-11 14:27:41.935946400 +0200
+@@ -918,7 +918,17 @@ list(APPEND WebKit_SERIALIZATION_DEPENDE
+
+ list(APPEND WebKit_DERIVED_SOURCES
+ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializers.h
+- ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializers.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
++ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializersShared.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
++ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializersSharedRemoteLayerTree.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
++ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializersSharedWebCoreArgumentCoders.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
++ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializersSharedWebGPU.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
++ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializersWebProcess.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
++ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializersGPUProcess.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
++ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializersNetworkProcess.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
++ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializersPlatform.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
++ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializersModelProcess.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
++ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializersUIProcess.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
++ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializersCommon.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
+ ${WebKit_DERIVED_SOURCES_DIR}/SerializedTypeInfo.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
+ ${WebKit_DERIVED_SOURCES_DIR}/WebKitPlatformGeneratedSerializers.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
+ )
+@@ -926,7 +936,17 @@ list(APPEND WebKit_DERIVED_SOURCES
+ add_custom_command(
+ OUTPUT
+ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializers.h
+- ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializers.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
++ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializersShared.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
++ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializersSharedRemoteLayerTree.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
++ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializersSharedWebCoreArgumentCoders.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
++ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializersSharedWebGPU.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
++ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializersWebProcess.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
++ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializersGPUProcess.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
++ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializersNetworkProcess.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
++ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializersPlatform.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
++ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializersModelProcess.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
++ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializersUIProcess.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
++ ${WebKit_DERIVED_SOURCES_DIR}/GeneratedSerializersCommon.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
+ ${WebKit_DERIVED_SOURCES_DIR}/SerializedTypeInfo.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
+ ${WebKit_DERIVED_SOURCES_DIR}/WebKitPlatformGeneratedSerializers.${WebKit_GENERATED_SERIALIZERS_SUFFIX}
+ MAIN_DEPENDENCY ${WEBKIT_DIR}/Scripts/generate-serializers.py
+--- webkitgtk-2.50.6/Source/WebKit/Scripts/generate-serializers.py.orig 2026-02-19 22:54:23.696450500 +0100
++++ webkitgtk-2.50.6/Source/WebKit/Scripts/generate-serializers.py 2026-06-11 14:29:10.438800272 +0200
+@@ -28,6 +28,40 @@ import os
+ import re
+ import sys
+
++# Directories under Source/WebKit/ that get their own per-domain
++# GeneratedSerializers<Domain>.{mm,cpp} translation unit when invoked with
++# --split-by-directory. Anything not matching one of these falls into
++# GeneratedSerializersCommon.{mm,cpp} (the residual bucket).
++KNOWN_DOMAINS = ['Shared', 'SharedRemoteLayerTree', 'SharedWebGPU', 'SharedWebCoreArgumentCoders', 'WebProcess', 'GPUProcess', 'NetworkProcess', 'Platform', 'ModelProcess', 'UIProcess']
++RESIDUAL_DOMAIN = '__residual__'
++
++
++def derive_source_directory(input_file_path):
++ """Return the top-level subdirectory under Source/WebKit/ for a .serialization.in path,
++ or None if the file doesn't live under Source/WebKit/<DIR>/...
++ """
++ parts = os.path.normpath(input_file_path).split(os.sep)
++ for i in range(len(parts) - 2):
++ if parts[i] == 'Source' and parts[i + 1] == 'WebKit':
++ if parts[i + 2] == "Shared":
++ if parts[i + 3] in {"WebGPU", "RemoteLayerTree"}:
++ return f"Shared{parts[i+3]}"
++ elif parts[i + 3].startswith("WebCoreArgumentCoders") or parts[i + 3].startswith("WTFArgumentCoders"):
++ return "SharedWebCoreArgumentCoders"
++ return "Shared"
++ return parts[i + 2]
++ return None
++
++
++def matches_domain(item, domain_filter):
++ """Filter helper used by argument_coder_declarations and generate_impl."""
++ if domain_filter is None:
++ return True
++ source_directory = getattr(item, 'source_directory', None)
++ if domain_filter == RESIDUAL_DOMAIN:
++ return source_directory not in KNOWN_DOMAINS
++ return source_directory == domain_filter
++
+ # Supported type attributes:
+ #
+ # AdditionalEncoder - generate serializers for StreamConnectionEncoder in addition to IPC::Encoder.
+@@ -104,6 +138,7 @@ class SerializedType(object):
+ self.disableMissingMemberCheck = False
+ self.debug_decoding_failure = False
+ self.generic_wrapper = None
++ self.source_directory = None
+ if attributes is not None:
+ for attribute in attributes.split(', '):
+ if '=' in attribute:
+@@ -258,6 +293,7 @@ class SerializedEnum(object):
+ self.valid_values = valid_values
+ self.condition = condition
+ self.attributes = attributes
++ self.source_directory = None
+
+ def namespace_and_name(self):
+ if self.namespace is None:
+@@ -545,13 +581,15 @@ def one_argument_coder_declaration(type,
+ return result
+
+
+-def argument_coder_declarations(serialized_types, skip_nested, webkit_platform):
++def argument_coder_declarations(serialized_types, skip_nested, webkit_platform, domain_filter=None):
+ result = []
+ for type in serialized_types:
+ if type.nested == skip_nested:
+ continue
+ if (webkit_platform is not None and type.webkit_platform != webkit_platform):
+ continue
++ if not matches_domain(type, domain_filter):
++ continue
+ if type.templates:
+ for template in type.templates:
+ result.extend(one_argument_coder_declaration(type, template))
+@@ -1107,7 +1145,7 @@ def generate_one_impl(type, template_arg
+ return result
+
+
+-def generate_impl(serialized_types, serialized_enums, headers, generating_webkit_platform_impl, objc_wrapped_types):
++def generate_impl(serialized_types, serialized_enums, headers, generating_webkit_platform_impl, objc_wrapped_types, domain_filter=None):
+ result = []
+ result.append(_license_header)
+ result.append('#include "config.h"')
+@@ -1175,12 +1213,14 @@ def generate_impl(serialized_types, seri
+ result.append(f'#endif // {type.condition}')
+ result.append('')
+
+- result = result + argument_coder_declarations(serialized_types, False, generating_webkit_platform_impl)
++ result = result + argument_coder_declarations(serialized_types, False, generating_webkit_platform_impl, domain_filter=domain_filter)
+ result.append('')
+
+ for type in serialized_types:
+ if type.webkit_platform != generating_webkit_platform_impl:
+ continue
++ if not matches_domain(type, domain_filter):
++ continue
+ if type.templates:
+ for template in type.templates:
+ result.extend(generate_one_impl(type, template, serialized_types))
+@@ -1194,6 +1234,8 @@ def generate_impl(serialized_types, seri
+ continue
+ if not type.members_are_subclasses:
+ continue
++ if not matches_domain(type, domain_filter):
++ continue
+ result.append('')
+ if type.condition is not None:
+ result.append(f'#if {type.condition}')
+@@ -1218,6 +1260,8 @@ def generate_impl(serialized_types, seri
+ for enum in serialized_enums:
+ if enum.is_webkit_platform() != generating_webkit_platform_impl:
+ continue
++ if not matches_domain(enum, domain_filter):
++ continue
+ result.append('')
+ if enum.condition is not None:
+ result.append(f'#if {enum.condition}')
+@@ -1979,6 +2023,7 @@ def generate_webkit_secure_coding_header
+
+
+ def main(argv):
++ split_by_directory = True
+ serialized_types = []
+ serialized_enums = []
+ using_statements = []
+@@ -1989,11 +2034,14 @@ def main(argv):
+ additional_forward_declarations_list = []
+ file_extension = argv[1]
+ for i in range(2, len(argv)):
++ source_directory = derive_source_directory(argv[i])
+ with open(argv[i]) as file:
+ new_types, new_enums, new_headers, new_using_statements, new_additional_forward_declarations, new_objc_wrapped_types = parse_serialized_types(file)
+ for type in new_types:
++ type.source_directory = source_directory
+ serialized_types.append(type)
+ for enum in new_enums:
++ enum.source_directory = source_directory
+ serialized_enums.append(enum)
+ for using_statement in new_using_statements:
+ using_statements.append(using_statement)
+@@ -2009,8 +2057,20 @@ def main(argv):
+
+ with open('GeneratedSerializers.h', "w+") as output:
+ output.write(generate_header(serialized_types, serialized_enums, additional_forward_declarations_list))
+- with open('GeneratedSerializers.%s' % file_extension, "w+") as output:
+- output.write(generate_impl(serialized_types, serialized_enums, headers, False, []))
++ if split_by_directory:
++ for domain in KNOWN_DOMAINS:
++ with open(f'GeneratedSerializers{domain}.{file_extension}', "w+") as output:
++ output.write(generate_impl(serialized_types, serialized_enums, headers, False, [], domain_filter=domain))
++ with open(f'GeneratedSerializersCommon.{file_extension}', "w+") as output:
++ output.write(generate_impl(serialized_types, serialized_enums, headers, False, [], domain_filter=RESIDUAL_DOMAIN))
++
++ residual_types = [t.namespace_and_name() for t in serialized_types
++ if not t.webkit_platform and t.source_directory not in KNOWN_DOMAINS]
++ if residual_types:
++ sys.stderr.write(f'generate-serializers.py: {len(residual_types)} type(s) fell into GeneratedSerializersCommon.{file_extension} (residual bucket): {", ".join(sorted(set(residual_types))[:10])}{"..." if len(residual_types) > 10 else ""}\n')
++ else:
++ with open('GeneratedSerializers.%s' % file_extension, "w+") as output:
++ output.write(generate_impl(serialized_types, serialized_enums, headers, False, []))
+ with open('WebKitPlatformGeneratedSerializers.%s' % file_extension, "w+") as output:
+ output.write(generate_impl(serialized_types, serialized_enums, headers, True, objc_wrapped_types))
+ with open('SerializedTypeInfo.%s' % file_extension, "w+") as output:
+--- webkitgtk-2.50.6/Source/WebKit/Platform/IPC/ArgumentCoders.h.orig 2026-06-13 10:16:54.657993197 +0200
++++ webkitgtk-2.50.6/Source/WebKit/Platform/IPC/ArgumentCoders.h 2026-06-13 10:17:09.207914374 +0200
+@@ -847,6 +847,12 @@ template<> struct ArgumentCoder<std::nul
+ static std::optional<std::nullptr_t> decode(Decoder&) { return nullptr; }
+ };
+
++template<> struct ArgumentCoder<std::monostate> {
++ template<typename Encoder>
++ static void encode(Encoder&, const std::monostate&) { }
++ static std::optional<std::monostate> decode(Decoder&) { return std::monostate { }; }
++};
++
+ template<typename T, typename Traits> struct ArgumentCoder<WTF::Markable<T, Traits>> {
+ template<typename Encoder, typename U>
+ static void encode(Encoder& encoder, U&& markable)
+--- webkitgtk-2.50.6/Source/WebKit/Shared/WTFArgumentCoders.serialization.in.orig 2026-06-13 10:19:14.607235027 +0200
++++ webkitgtk-2.50.6/Source/WebKit/Shared/WTFArgumentCoders.serialization.in 2026-06-13 10:19:38.143774186 +0200
+@@ -243,10 +243,6 @@ header: <wtf/MemoryPressureHandler.h>
+ Critical,
+ }
+
+-header: <wtf/Variant.h>
+-[AdditionalEncoder=StreamConnectionEncoder, Nested] struct std::monostate {
+-}
+-
+ enum class WTFLogLevel : uint8_t {
+ Always,
+ Error,
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/gtk-webkit4.git/commitdiff/65dfe5696a66d36a88411b980acf40002f8c589e
More information about the pld-cvs-commit
mailing list