--- /dev/null
+diff -urN webkitgtk-2.34.6.orig/Source/JavaScriptCore/jsc.cpp webkitgtk-2.34.6/Source/JavaScriptCore/jsc.cpp
+--- webkitgtk-2.34.6.orig/Source/JavaScriptCore/jsc.cpp 2022-02-04 00:04:27.000000000 +0300
++++ webkitgtk-2.34.6/Source/JavaScriptCore/jsc.cpp 2024-06-21 17:19:48.817173000 +0300
+@@ -100,6 +100,9 @@
+ #else
+ #include <unistd.h>
+ #endif
++#if PLATFORM(GTK)
++#include <locale.h>
++#endif
+
+ #if PLATFORM(COCOA)
+ #include <crt_externs.h>
+diff -urN webkitgtk-2.34.6.orig/Source/JavaScriptCore/offlineasm/config.rb webkitgtk-2.34.6/Source/JavaScriptCore/offlineasm/config.rb
+--- webkitgtk-2.34.6.orig/Source/JavaScriptCore/offlineasm/config.rb 2021-05-17 16:22:35.000000000 +0300
++++ webkitgtk-2.34.6/Source/JavaScriptCore/offlineasm/config.rb 2024-06-21 17:20:32.153460000 +0300
+@@ -22,11 +22,11 @@
+ # THE POSSIBILITY OF SUCH DAMAGE.
+
+ buildProductsDirectory = ENV['BUILT_PRODUCTS_DIR'];
+-if buildProductsDirectory and File.exists?(buildProductsDirectory)
++if buildProductsDirectory and File.exist?(buildProductsDirectory)
+ $: << "#{buildProductsDirectory}/usr/local/include/WebKitAdditions/Scripts"
+ end
+ sdkRootDirectory = ENV['SDKROOT'];
+-if sdkRootDirectory and File.exists?(sdkRootDirectory)
++if sdkRootDirectory and File.exist?(sdkRootDirectory)
+ $: << "#{sdkRootDirectory}/usr/local/include/WebKitAdditions/Scripts"
+ end
+
+diff -urN webkitgtk-2.34.6.orig/Source/JavaScriptCore/offlineasm/parser.rb webkitgtk-2.34.6/Source/JavaScriptCore/offlineasm/parser.rb
+--- webkitgtk-2.34.6.orig/Source/JavaScriptCore/offlineasm/parser.rb 2021-10-21 11:52:07.000000000 +0300
++++ webkitgtk-2.34.6/Source/JavaScriptCore/offlineasm/parser.rb 2024-06-21 17:07:30.146305000 +0300
+@@ -832,10 +832,10 @@
+ @idx += 1
+ additionsDirectoryName = "#{@buildProductsDirectory}/usr/local/include/WebKitAdditions/"
+ fileName = IncludeFile.new(moduleName, additionsDirectoryName).fileName
+- if not File.exists?(fileName)
++ if not File.exist?(fileName)
+ fileName = IncludeFile.new(moduleName, @tokens[@idx].codeOrigin.fileName.dirname).fileName
+ end
+- fileExists = File.exists?(fileName)
++ fileExists = File.exist?(fileName)
+ raise "File not found: #{fileName}" if not fileExists and not isOptional
+ list << parse(fileName) if fileExists
+ else
+@@ -864,10 +864,10 @@
+ @idx += 1
+ additionsDirectoryName = "#{@buildProductsDirectory}/usr/local/include/WebKitAdditions/"
+ fileName = IncludeFile.new(moduleName, additionsDirectoryName).fileName
+- if not File.exists?(fileName)
++ if not File.exist?(fileName)
+ fileName = IncludeFile.new(moduleName, @tokens[@idx].codeOrigin.fileName.dirname).fileName
+ end
+- fileExists = File.exists?(fileName)
++ fileExists = File.exist?(fileName)
+ raise "File not found: #{fileName}" if not fileExists and not isOptional
+ fileList << fileName if fileExists
+ else
+diff -urN webkitgtk-2.34.6.orig/Source/JavaScriptCore/runtime/NativeExecutable.cpp webkitgtk-2.34.6/Source/JavaScriptCore/runtime/NativeExecutable.cpp
+--- webkitgtk-2.34.6.orig/Source/JavaScriptCore/runtime/NativeExecutable.cpp 2021-10-21 11:52:07.000000000 +0300
++++ webkitgtk-2.34.6/Source/JavaScriptCore/runtime/NativeExecutable.cpp 2024-06-21 17:20:50.174796000 +0300
+@@ -24,6 +24,7 @@
+ */
+
+ #include "config.h"
++#include "ExecutableBaseInlines.h"
+ #include "NativeExecutable.h"
+
+ #include "ExecutableBaseInlines.h"
+diff -urN webkitgtk-2.34.6.orig/Source/WTF/wtf/RAMSize.cpp webkitgtk-2.34.6/Source/WTF/wtf/RAMSize.cpp
+--- webkitgtk-2.34.6.orig/Source/WTF/wtf/RAMSize.cpp 2021-05-17 16:22:40.000000000 +0300
++++ webkitgtk-2.34.6/Source/WTF/wtf/RAMSize.cpp 2024-06-21 17:05:43.552906000 +0300
+@@ -35,6 +35,8 @@
+ #include <sys/sysinfo.h>
+ #elif OS(UNIX)
+ #include <unistd.h>
++#include <sys/types.h>
++#include <sys/sysctl.h>
+ #endif // OS(LINUX) || OS(UNIX)
+ #else
+ #include <bmalloc/bmalloc.h>
+@@ -56,14 +58,18 @@
+ return ramSizeGuess;
+ return status.ullTotalPhys;
+ #elif USE(SYSTEM_MALLOC)
+-#if OS(LINUX) || OS(FREEBSD)
++#if OS(LINUX)
+ struct sysinfo si;
+ sysinfo(&si);
+ return si.totalram * si.mem_unit;
+ #elif OS(UNIX)
+- long pages = sysconf(_SC_PHYS_PAGES);
+- long pageSize = sysconf(_SC_PAGE_SIZE);
+- return pages * pageSize;
++ size_t physmem, len;
++ int mib[2] = { CTL_HW, HW_PHYSMEM };
++ if (sysctl(mib, 2, &physmem, &len, NULL, 0) == 0
++ && len == sizeof(physmem))
++ return physmem;
++ else
++ return 512 * MB; // guess
+ #else
+ #error "Missing a platform specific way of determining the available RAM"
+ #endif // OS(LINUX) || OS(FREEBSD) || OS(UNIX)
+diff -urN webkitgtk-2.34.6.orig/Source/WTF/wtf/unix/MemoryPressureHandlerUnix.cpp webkitgtk-2.34.6/Source/WTF/wtf/unix/MemoryPressureHandlerUnix.cpp
+--- webkitgtk-2.34.6.orig/Source/WTF/wtf/unix/MemoryPressureHandlerUnix.cpp 2021-10-21 11:52:08.000000000 +0300
++++ webkitgtk-2.34.6/Source/WTF/wtf/unix/MemoryPressureHandlerUnix.cpp 2024-06-21 17:22:23.951381000 +0300
+@@ -28,7 +28,7 @@
+ #include "config.h"
+ #include <wtf/MemoryPressureHandler.h>
+
+-#include <malloc.h>
++#include <stdlib.h>
+ #include <unistd.h>
+ #include <wtf/Logging.h>
+ #include <wtf/MainThread.h>
+diff -urN webkitgtk-2.34.6.orig/Source/WebCore/platform/PlatformScreen.h webkitgtk-2.34.6/Source/WebCore/platform/PlatformScreen.h
+--- webkitgtk-2.34.6.orig/Source/WebCore/platform/PlatformScreen.h 2021-10-21 11:52:09.000000000 +0300
++++ webkitgtk-2.34.6/Source/WebCore/platform/PlatformScreen.h 2024-06-21 17:21:24.777609000 +0300
+@@ -48,6 +48,12 @@
+ typedef struct CGColorSpace *CGColorSpaceRef;
+ #endif
+
++// X11 headers define a bunch of macros with common terms, interfering with WebCore and WTF enum values.
++// As a workaround, we explicitly undef them here.
++#if defined(None)
++#undef None
++#endif
++
+ namespace WebCore {
+
+ class DestinationColorSpace;
+diff -urN webkitgtk-2.34.6.orig/Source/WebCore/platform/network/DNS.h webkitgtk-2.34.6/Source/WebCore/platform/network/DNS.h
+--- webkitgtk-2.34.6.orig/Source/WebCore/platform/network/DNS.h 2021-10-21 11:52:09.000000000 +0300
++++ webkitgtk-2.34.6/Source/WebCore/platform/network/DNS.h 2024-06-21 17:21:10.656663000 +0300
+@@ -33,6 +33,7 @@
+ #include <winsock2.h>
+ #include <ws2tcpip.h>
+ #else
++#include <sys/socket.h>
+ #include <netinet/in.h>
+ #endif
+
+diff -urN webkitgtk-2.34.6.orig/Source/WebCore/platform/text/TextCodec.cpp webkitgtk-2.34.6/Source/WebCore/platform/text/TextCodec.cpp
+--- webkitgtk-2.34.6.orig/Source/WebCore/platform/text/TextCodec.cpp 2021-05-17 16:22:42.000000000 +0300
++++ webkitgtk-2.34.6/Source/WebCore/platform/text/TextCodec.cpp 2024-06-21 17:21:36.058482000 +0300
+@@ -24,6 +24,8 @@
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
++#include <stdio.h>
++
+ #include "config.h"
+ #include "TextCodec.h"
+
+diff -urN webkitgtk-2.34.6.orig/Source/WebDriver/PlatformGTK.cmake webkitgtk-2.34.6/Source/WebDriver/PlatformGTK.cmake
+--- webkitgtk-2.34.6.orig/Source/WebDriver/PlatformGTK.cmake 2021-09-16 15:43:07.000000000 +0300
++++ webkitgtk-2.34.6/Source/WebDriver/PlatformGTK.cmake 2024-06-21 17:21:47.027374000 +0300
+@@ -5,6 +5,7 @@
+ list(APPEND WebDriver_SYSTEM_INCLUDE_DIRECTORIES
+ "${GLIB_INCLUDE_DIRS}"
+ "${LIBSOUP_INCLUDE_DIRS}"
++ "${ICU_INCLUDE_DIRS}"
+ )
+
+ list(APPEND WebDriver_SOURCES
+@@ -18,4 +19,5 @@
+
+ list(APPEND WebDriver_LIBRARIES
+ ${LIBSOUP_LIBRARIES}
++ ${ICU_LIBRARIES}
+ )
+diff -urN webkitgtk-2.34.6.orig/Source/WebInspectorUI/Scripts/update-LegacyInspectorBackendCommands.rb webkitgtk-2.34.6/Source/WebInspectorUI/Scripts/update-LegacyInspectorBackendCommands.rb
+--- webkitgtk-2.34.6.orig/Source/WebInspectorUI/Scripts/update-LegacyInspectorBackendCommands.rb 2021-05-17 16:22:42.000000000 +0300
++++ webkitgtk-2.34.6/Source/WebInspectorUI/Scripts/update-LegacyInspectorBackendCommands.rb 2024-06-21 17:22:09.359781000 +0300
+@@ -36,7 +36,7 @@
+ end
+
+ generated_path = File.join tmpdir, output_filename
+- if !File.exists?(generated_path)
++ if !File.exist?(generated_path)
+ puts "ERROR: Generated file does not exist at expected path."
+ exit 1
+ end