[gtk-osx] Update build of webkit2gtk3 to a recent version.



commit 10960dbcc24c5027709c1bb03de948340b789d3e
Author: John Ralls <jralls ceridwen us>
Date:   Tue Oct 27 13:28:43 2020 -0700

    Update build of webkit2gtk3 to a recent version.
    
    Thanks to the MacPorts projects for most of the patches.

 jhbuildrc-gtk-osx                                  |   2 +-
 modulesets-stable/gtk-osx-network.modules          |  17 +-
 modulesets-unstable/gtk-osx-network.modules        |  48 +++--
 modulesets/gtk-osx-network.modules                 |  16 +-
 patches/patch-bundle-link-webcore.diff             |  11 ++
 .../patch-webkit2gtk-2282-os-log-availability.diff |  22 +++
 ...ch-webkit2gtk-2282-unprotected-egl-changes.diff |  71 ++++++++
 patches/patch-webkit2gtk-272-macports.diff         |  83 +++++++++
 patches/patch-webkit2gtk-macports.diff             | 201 +++++++++++++++++++++
 patches/webkit-clang-fixes.patch                   |  33 ++++
 patches/webkit-disable-apple-icu.patch             |  12 ++
 11 files changed, 484 insertions(+), 32 deletions(-)
---
diff --git a/jhbuildrc-gtk-osx b/jhbuildrc-gtk-osx
index ef85b49..9d1980a 100644
--- a/jhbuildrc-gtk-osx
+++ b/jhbuildrc-gtk-osx
@@ -492,7 +492,7 @@ alwaysautogen = True
 
 module_cmakeargs["freetype"] = '-DCMAKE_INSTALL_NAME_DIR="' + os.path.join(prefix, 'lib') + '"'
 module_cmakeargs["freetype-no-harfbuzz"] = '-DCMAKE_INSTALL_NAME_DIR="' + os.path.join(prefix, 'lib') + '"'
-
+module_cmakeargs["webkit2gtk3"] = '-DCMAKE_INSTALL_NAME_DIR="' + os.path.join(prefix, 'lib') + '"'
 
 # Check and warn if jhbuild is started from within jhbuild, since that
 # will mess up environment variables, especially if different build
diff --git a/modulesets-stable/gtk-osx-network.modules b/modulesets-stable/gtk-osx-network.modules
index 84d9159..61412ee 100644
--- a/modulesets-stable/gtk-osx-network.modules
+++ b/modulesets-stable/gtk-osx-network.modules
@@ -203,18 +203,19 @@
       patches, this is untested.
     ENABLE_CREDENTIAL_STORAGE: Requires libsecret. No module for this yet.
     ENABLE_GEOLOCATION: Requires geoclue. No module for this yet.
-    ENABLE_OPENGL: Untested.
+    ENABLE_OPENGL: Known to not work with Quartz.
     USE_LIBNOTIFY: Requires libnotify. No module for this yet.
     USE_LIBHYPHEN: Requires libhyphen. No module for this yet.
   -->
   <cmake id="webkit2gtk3"
-         cmakeargs='-DPORT=GTK -DENABLE_X11_TARGET=OFF -DENABLE_QUARTZ_TARGET=ON -DENABLE_INTROSPECTION=OFF  
-DENABLE_OPENGL=OFF -DENABLE_PLUGIN_PROCESS_GTK2=OFF -DENABLE_VIDEO=OFF -DENABLE_WEB_AUDIO=OFF 
-DENABLE_GEOLOCATION=OFF -DUSE_LIBNOTIFY=OFF -DUSE_LIBHYPHEN=OFF -DUSE_LIBSECRET=OFF 
-DENABLE_TOUCH_EVENTS=OFF -DCMAKE_CXX_FLAGS="-stdlib=libc++"'>
-    <branch repo="webkit.org" module="webkitgtk-2.16.6.tar.xz" version="2.16.6">
-      <patch 
file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/Webkit-2.16-build-without-OpenGL.patch"; 
strip="1"/>
-      <patch 
file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/Webkit-2.16-Fix-some-includes.patch"; 
strip="1"/>
-      <patch 
file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/webkit-2.16-No-stringview-lifetime.patch"; 
strip="1"/>
-      <patch file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/webkit-2.16-main-thread.patch"; 
strip="1"/>
-
+         cmakeargs='-DPORT=GTK -DENABLE_X11_TARGET=OFF -DENABLE_QUARTZ_TARGET=ON -DENABLE_INTROSPECTION=OFF  
-DENABLE_OPENGL=OFF -DENABLE_VIDEO=OFF -DENABLE_WEB_AUDIO=OFF -DENABLE_GEOLOCATION=OFF -DUSE_LIBNOTIFY=OFF 
-DUSE_LIBHYPHEN=OFF -DUSE_LIBSECRET=OFF -DENABLE_TOUCH_EVENTS=OFF  -DUSE_OPENJPEG=OFF -DUSE_WOFF2=OFF 
-DUSE_WPE_RENDERER=OFF -DENABLE_GRAPHICS_CONTEXT_GL=OFF -DCMAKE_CXX_FLAGS="-stdlib=libc++" 
-DCMAKE_MACOSX_RPATH=OFF'>
+    <branch repo="webkit.org" module="webkitgtk-2.28.2.tar.xz" version="2.28.2">
+      <patch file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/patch-webkit2gtk-macports.diff"; 
strip="0"/>
+      <patch 
file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/patch-webkit2gtk-272-macports.diff"; 
strip="0"/>
+      <patch 
file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/patch-webkit2gtk-2282-unprotected-egl-changes.diff";
 strip="0"/>
+      <patch 
file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/patch-webkit2gtk-2282-os-log-availability.diff";
 strip="0"/>
+      <patch file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/patch-bundle-link-webcore.diff"; 
strip="0"/>
+      <patch file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/webkit-clang-fixes.patch"; 
strip="0"/>
     </branch>
     <dependencies>
       <dep package="libwebp"/>
diff --git a/modulesets-unstable/gtk-osx-network.modules b/modulesets-unstable/gtk-osx-network.modules
index 316e800..e7f7ada 100644
--- a/modulesets-unstable/gtk-osx-network.modules
+++ b/modulesets-unstable/gtk-osx-network.modules
@@ -109,7 +109,7 @@
   </autotools>
 
   <meson id="libsoup" mesonargs="-Dvapi=disabled">
-    <branch/>
+    <branch />
     <dependencies>
       <dep package="libpsl"/>
       <dep package="python3"/>
@@ -200,26 +200,40 @@
       patches, this is untested.
     ENABLE_CREDENTIAL_STORAGE: Requires libsecret. No module for this yet.
     ENABLE_GEOLOCATION: Requires geoclue. No module for this yet.
-    ENABLE_OPENGL: Untested.
+    ENABLE_OPENGL: Known to not work with Quartz.
     USE_LIBNOTIFY: Requires libnotify. No module for this yet.
     USE_LIBHYPHEN: Requires libhyphen. No module for this yet.
   -->
-  <!--cmake id="webkit2gtk3"
-         cmakeargs="-DPORT=GTK -DENABLE_X11_TARGET=OFF -DENABLE_QUARTZ_TARGET=ON -DENABLE_TOOLS=ON 
-DENABLE_MINIBROWSER=ON -DENABLE_PLUGIN_PROCESS_GTK2=OFF -DENABLE_VIDEO=OFF -DENABLE_WEB_AUDIO=OFF 
-DENABLE_CREDENTIAL_STORAGE=OFF -DENABLE_GEOLOCATION=OFF -DENABLE_OPENGL=OFF -DUSE_LIBNOTIFY=OFF 
-DUSE_LIBHYPHEN=OFF -DCMAKE_CXX_FLAGS='-stdlib=libc++'"-->
-  <!--branch repo="webkit.org" module="webkitgtk-2.10.2.tar.xz" version="2.10.2">
-      <patch 
file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/webkit-144561-quartz-backend.patch";
-             strip="1"/>
-      <patch 
file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/webkit-144560-platform-fixes.patch";
-             strip="1"/>
-      <patch 
file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/webkit-144785-link-injected-bundle.patch";
-             strip="1"/>
-      <patch 
file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/webkit-148606-build-texture-mapper-gl-separately.patch";
-             strip="1"/>
-      <patch 
file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/webkit-148607-include-stub-for-plugin-permission-request.patch";
-             strip="1"/>
-             </branch-->
   <cmake id="webkit2gtk3"
-         cmakeargs='-DPORT=GTK -DENABLE_X11_TARGET=OFF -DENABLE_QUARTZ_TARGET=ON -DENABLE_INTROSPECTION=OFF  
-DENABLE_OPENGL=OFF -DENABLE_PLUGIN_PROCESS_GTK2=OFF -DENABLE_VIDEO=OFF -DENABLE_WEB_AUDIO=OFF 
-DENABLE_GEOLOCATION=OFF -DUSE_LIBNOTIFY=OFF -DUSE_LIBHYPHEN=OFF -DUSE_LIBSECRET=OFF 
-DENABLE_TOUCH_EVENTS=OFF -DCMAKE_CXX_FLAGS="$CXX_FLAGS -stdlib=libc++"'>
+         cmakeargs='-DPORT=GTK -DENABLE_X11_TARGET=OFF -DENABLE_QUARTZ_TARGET=ON -DENABLE_INTROSPECTION=OFF  
-DENABLE_OPENGL=OFF -DENABLE_VIDEO=OFF -DENABLE_WEB_AUDIO=OFF -DENABLE_GEOLOCATION=OFF -DUSE_LIBNOTIFY=OFF 
-DUSE_LIBHYPHEN=OFF -DUSE_LIBSECRET=OFF -DENABLE_TOUCH_EVENTS=OFF  -DUSE_OPENJPEG=OFF -DUSE_WOFF2=OFF 
-DUSE_WPE_RENDERER=OFF -DENABLE_GRAPHICS_CONTEXT_GL=OFF -DCMAKE_CXX_FLAGS="-stdlib=libc++" 
-DCMAKE_MACOSX_RPATH=OFF'>
+    <branch repo="webkit.org" module="webkitgtk-2.28.2.tar.xz" version="2.28.2">
+      <patch file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/patch-webkit2gtk-macports.diff"; 
strip="0"/>
+      <patch 
file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/patch-webkit2gtk-272-macports.diff"; 
strip="0"/>
+      <patch 
file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/patch-webkit2gtk-2282-unprotected-egl-changes.diff";
 strip="0"/>
+      <patch 
file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/patch-webkit2gtk-2282-os-log-availability.diff";
 strip="0"/>
+      <patch file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/patch-bundle-link-webcore.diff"; 
strip="0"/>
+      <patch file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/webkit-clang-fixes.patch"; 
strip="0"/>
+    </branch>
+    <dependencies>
+      <dep package="libwebp"/>
+      <dep package="enchant"/>
+      <dep package="icu"/>
+      <dep package="libsoup"/>
+      <dep package="libgcrypt"/>
+    </dependencies>
+    <after>
+      <dep package="meta-gtk-osx-gtk3"/>
+      <dep package="meta-gtk-osx-gtk3.14"/>
+      <dep package="meta-gstreamer"/>
+    </after>
+  </cmake>
+
+  <!-- For updating to a new version start here. It won't build. Apply
+       the patches from the webkit2gtk3 module as a starting point and
+       then start playing whack-a-mole until it builds and works.
+  -->
+  <cmake id="webkit2gtk3-git"
+         cmakeargs='-DPORT=GTK -DENABLE_X11_TARGET=OFF -DENABLE_QUARTZ_TARGET=ON -DENABLE_INTROSPECTION=OFF  
-DENABLE_OPENGL=OFF -DENABLE_VIDEO=OFF -DENABLE_WEB_AUDIO=OFF -DENABLE_GEOLOCATION=OFF -DUSE_LIBNOTIFY=OFF 
-DUSE_LIBHYPHEN=OFF -DUSE_LIBSECRET=OFF -DENABLE_TOUCH_EVENTS=OFF  -DUSE_OPENJPEG=OFF -DUSE_WOFF2=OFF 
-DUSE_WPE_RENDERER=OFF -DENABLE_GRAPHICS_CONTEXT_GL=OFF -DCMAKE_CXX_FLAGS="-stdlib=libc++" 
-DCMAKE_MACOSX_RPATH=OFF'>
     <branch repo="webkit-git" module= "WebKit.git" />
     <dependencies>
       <dep package="libwebp"/>
diff --git a/modulesets/gtk-osx-network.modules b/modulesets/gtk-osx-network.modules
index 9d04515..4030bf9 100644
--- a/modulesets/gtk-osx-network.modules
+++ b/modulesets/gtk-osx-network.modules
@@ -205,22 +205,26 @@
       patches, this is untested.
     ENABLE_CREDENTIAL_STORAGE: Requires libsecret. No module for this yet.
     ENABLE_GEOLOCATION: Requires geoclue. No module for this yet.
-    ENABLE_OPENGL: Untested.
+    ENABLE_OPENGL: Known to not work with quartz.
     USE_LIBNOTIFY: Requires libnotify. No module for this yet.
     USE_LIBHYPHEN: Requires libhyphen. No module for this yet.
   -->
   <cmake id="webkit2gtk3"
-         cmakeargs="-DPORT=GTK -DENABLE_X11_TARGET=OFF -DENABLE_QUARTZ_TARGET=ON -DENABLE_TOOLS=ON 
-DENABLE_MINIBROWSER=ON -DENABLE_PLUGIN_PROCESS_GTK2=OFF -DENABLE_VIDEO=OFF -DENABLE_WEB_AUDIO=OFF 
-DENABLE_CREDENTIAL_STORAGE=OFF -DENABLE_GEOLOCATION=OFF -DENABLE_OPENGL=OFF -DUSE_LIBNOTIFY=OFF 
-DUSE_LIBHYPHEN=OFF -DCMAKE_CXX_FLAGS='-stdlib=libc++'">
-    <branch repo="webkit.org" module="webkitgtk-2.16.1.tar.xz" version="2.16.1">
-      <patch 
file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/WebKit-2.16.1-Bug-167343-wtf-unicode-UTF8.h.patch";
 strip="1"/>
-      <patch 
file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/Webkit-2.16-build-without-OpenGL.patch"; 
strip="1"/>
-<patch file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/Webkit-2.16-Fix-some-includes.patch"; 
strip="1"/>
+         cmakeargs='-DPORT=GTK -DENABLE_X11_TARGET=OFF -DENABLE_QUARTZ_TARGET=ON -DENABLE_INTROSPECTION=OFF  
-DENABLE_OPENGL=OFF -DENABLE_VIDEO=OFF -DENABLE_WEB_AUDIO=OFF -DENABLE_GEOLOCATION=OFF -DUSE_LIBNOTIFY=OFF 
-DUSE_LIBHYPHEN=OFF -DUSE_LIBSECRET=OFF -DENABLE_TOUCH_EVENTS=OFF  -DUSE_OPENJPEG=OFF -DUSE_WOFF2=OFF 
-DUSE_WPE_RENDERER=OFF -DENABLE_GRAPHICS_CONTEXT_GL=OFF -DCMAKE_CXX_FLAGS="-stdlib=libc++" 
-DCMAKE_MACOSX_RPATH=OFF'>
+    <branch repo="webkit.org" module="webkitgtk-2.28.2.tar.xz" version="2.28.2">
+      <patch file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/patch-webkit2gtk-macports.diff"; 
strip="0"/>
+      <patch 
file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/patch-webkit2gtk-272-macports.diff"; 
strip="0"/>
+      <patch 
file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/patch-webkit2gtk-2282-unprotected-egl-changes.diff";
 strip="0"/>
+      <patch 
file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/patch-webkit2gtk-2282-os-log-availability.diff";
 strip="0"/>
+      <patch file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/patch-bundle-link-webcore.diff"; 
strip="0"/>
+      <patch file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/webkit-clang-fixes.patch"; 
strip="0"/>
     </branch>
     <dependencies>
       <dep package="libwebp"/>
       <dep package="enchant"/>
       <dep package="icu"/>
       <dep package="libsoup"/>
+      <dep package="libgcrypt"/>
     </dependencies>
     <after>
       <dep package="meta-gtk-osx-gtk3"/>
diff --git a/patches/patch-bundle-link-webcore.diff b/patches/patch-bundle-link-webcore.diff
new file mode 100644
index 0000000..39c2fb3
--- /dev/null
+++ b/patches/patch-bundle-link-webcore.diff
@@ -0,0 +1,11 @@
+--- Source/WebKit/PlatformGTK.cmake.orig       2017-09-29 02:02:31.000000000 +0800
++++ Source/WebKit/PlatformGTK.cmake    2017-09-29 02:02:53.000000000 +0800
+@@ -1092,7 +1092,7 @@
+ 
+ add_library(webkit2gtkinjectedbundle MODULE 
"${WEBKIT_DIR}/WebProcess/InjectedBundle/API/glib/WebKitInjectedBundleMain.cpp")
+ ADD_WEBKIT_PREFIX_HEADER(webkit2gtkinjectedbundle)
+-target_link_libraries(webkit2gtkinjectedbundle WebKit)
++target_link_libraries(webkit2gtkinjectedbundle WebKit WebCore)
+ 
+ target_include_directories(webkit2gtkinjectedbundle PRIVATE
+     ${WebKit_INCLUDE_DIRECTORIES}
diff --git a/patches/patch-webkit2gtk-2282-os-log-availability.diff 
b/patches/patch-webkit2gtk-2282-os-log-availability.diff
new file mode 100644
index 0000000..9c12d69
--- /dev/null
+++ b/patches/patch-webkit2gtk-2282-os-log-availability.diff
@@ -0,0 +1,22 @@
+diff --git Source/ThirdParty/ANGLE/src/common/debug.cpp Source/ThirdParty/ANGLE/src/common/debug.cpp
+index c26815d3..b07914be 100644
+--- Source/ThirdParty/ANGLE/src/common/debug.cpp
++++ Source/ThirdParty/ANGLE/src/common/debug.cpp
+@@ -21,7 +21,7 @@
+ #    include <android/log.h>
+ #endif
+ 
+-#if defined(ANGLE_PLATFORM_APPLE)
++#if defined(ANGLE_PLATFORM_APPLE) && MAC_OS_X_VERSION_MAX_ALLOWED > 101200
+ #    include <os/log.h>
+ #endif
+ 
+@@ -232,7 +232,7 @@ void Trace(LogSeverity severity, const char *message)
+         }
+         __android_log_print(android_priority, "ANGLE", "%s: %s\n", LogSeverityName(severity),
+                             str.c_str());
+-#elif defined(ANGLE_PLATFORM_APPLE)
++#elif defined(ANGLE_PLATFORM_APPLE) && MAC_OS_X_VERSION_MAX_ALLOWED > 101200
+         if (__builtin_available(macOS 10.12, iOS 10.0, *))
+         {
+             os_log_type_t apple_log_type = OS_LOG_TYPE_DEFAULT;
diff --git a/patches/patch-webkit2gtk-2282-unprotected-egl-changes.diff 
b/patches/patch-webkit2gtk-2282-unprotected-egl-changes.diff
new file mode 100644
index 0000000..dad9f0f
--- /dev/null
+++ b/patches/patch-webkit2gtk-2282-unprotected-egl-changes.diff
@@ -0,0 +1,71 @@
+These changes were added in 
+<https://github.com/WebKit/webkit/commit/c7d6af038dcbfac95d0af4f43fbb945d73f6b1bb>
+
+they don't compile, as they use EGL unprotected, but even when some of them were protected by USE(EGL) there 
were
+ errors when trying to play videos in the MiniBrowser. So I added protection to all the addition bits in
+ the commit that were not initially protected. 
+ 
+kencu macports org
+
+
+
+diff --git Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp 
Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp
+index ad632205..29a9eace 100644
+--- Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp
++++ Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp
+@@ -23,7 +23,7 @@
+ #if USE(GSTREAMER)
+ #include <gst/gst.h>
+ 
+-#if USE(GSTREAMER_GL)
++#if USE(WPE_VIDEO_PLANE_DISPLAY_DMABUF)
+ #include <gst/gl/egl/gsteglimage.h>
+ #endif
+ 
+@@ -508,6 +508,7 @@ template<> void derefGPtr<GstGLContext>(GstGLContext* ptr)
+         gst_object_unref(GST_OBJECT(ptr));
+ }
+ 
++#if USE(WPE_VIDEO_PLANE_DISPLAY_DMABUF)
+ template <> GRefPtr<GstEGLImage> adoptGRef(GstEGLImage* ptr)
+ {
+     return GRefPtr<GstEGLImage>(ptr, GRefPtrAdopt);
+@@ -525,6 +526,7 @@ template <> void derefGPtr<GstEGLImage>(GstEGLImage* ptr)
+     if (ptr)
+         gst_egl_image_unref(ptr);
+ }
++#endif //USE(WPE_VIDEO_PLANE_DISPLAY_DMABUF)
+ 
+ #endif // USE(GSTREAMER_GL)
+ 
+diff --git Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h 
Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h
+index d940f8ca..bda2f024 100644
+--- Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h
++++ Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h
+@@ -30,9 +30,13 @@ typedef struct _WebKitWebSrc WebKitWebSrc;
+ #if USE(GSTREAMER_GL)
+ typedef struct _GstGLDisplay GstGLDisplay;
+ typedef struct _GstGLContext GstGLContext;
++
++#if USE(WPE_VIDEO_PLANE_DISPLAY_DMABUF)
+ typedef struct _GstEGLImage GstEGLImage;
+ #endif
+ 
++#endif
++
+ namespace WTF {
+ 
+ template<> GRefPtr<GstPlugin> adoptGRef(GstPlugin* ptr);
+@@ -133,9 +137,12 @@ template<> GRefPtr<GstGLContext> adoptGRef(GstGLContext* ptr);
+ template<> GstGLContext* refGPtr<GstGLContext>(GstGLContext* ptr);
+ template<> void derefGPtr<GstGLContext>(GstGLContext* ptr);
+ 
++#if USE(WPE_VIDEO_PLANE_DISPLAY_DMABUF)
+ template<> GRefPtr<GstEGLImage> adoptGRef(GstEGLImage* ptr);
+ template<> GstEGLImage* refGPtr<GstEGLImage>(GstEGLImage* ptr);
+ template<> void derefGPtr<GstEGLImage>(GstEGLImage* ptr);
++#endif // USE(WPE_VIDEO_PLANE_DISPLAY_DMABUF)
++
+ #endif
+ 
+ } // namespace WTF
diff --git a/patches/patch-webkit2gtk-272-macports.diff b/patches/patch-webkit2gtk-272-macports.diff
new file mode 100644
index 0000000..e76deff
--- /dev/null
+++ b/patches/patch-webkit2gtk-272-macports.diff
@@ -0,0 +1,83 @@
+diff --git Source/WebKit/NetworkProcess/NetworkLoadParameters.h 
Source/WebKit/NetworkProcess/NetworkLoadParameters.h
+index de74d33a..fb021faa 100644
+--- Source/WebKit/NetworkProcess/NetworkLoadParameters.h
++++ Source/WebKit/NetworkProcess/NetworkLoadParameters.h
+@@ -35,6 +35,9 @@
+ #include <WebCore/SecurityOrigin.h>
+ #include <wtf/ProcessID.h>
+ 
++/* audit_token_t */
++#include <mach/message.h>
++
+ namespace WebKit {
+ 
+ enum class PreconnectOnly { No, Yes };
+diff --git Source/WebKit/Platform/IPC/ArgumentCoders.h Source/WebKit/Platform/IPC/ArgumentCoders.h
+index f1ea1ecb..12ceec79 100644
+--- Source/WebKit/Platform/IPC/ArgumentCoders.h
++++ Source/WebKit/Platform/IPC/ArgumentCoders.h
+@@ -34,6 +34,9 @@
+ #include <wtf/Unexpected.h>
+ #include <wtf/WallTime.h>
+ 
++/* audit_token_t */
++#include <mach/message.h>
++
+ namespace IPC {
+ 
+ // An argument coder works on POD types
+diff --git Source/WebKit/Shared/SandboxExtension.h Source/WebKit/Shared/SandboxExtension.h
+index 5839d3fc..6f110183 100644
+--- Source/WebKit/Shared/SandboxExtension.h
++++ Source/WebKit/Shared/SandboxExtension.h
+@@ -33,6 +33,9 @@
+ #include <wtf/Vector.h>
+ #include <wtf/text/WTFString.h>
+ 
++/* audit_token_t */
++#include <mach/message.h>
++
+ namespace IPC {
+ class Encoder;
+ class Decoder;
+diff --git Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp 
Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp
+index 57e8a557..45df4cf6 100644
+--- ./Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp.orig  2019-11-22 04:57:54.000000000 -0800
++++ ./Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp       2019-11-27 05:52:39.000000000 -0800
+@@ -333,9 +333,10 @@
+         " </tbody></tr>",
+         webGLEnabled(request) ? "Yes" : "No");
+ 
++#if USE(GLX)
+     auto glContext = GLContext::createOffscreenContext();
+     glContext->makeContextCurrent();
+-
++#endif
+     g_string_append_printf(html,
+         " <tbody><tr>"
+         "  <td><div class=\"titlename\">API</div></td>"
+@@ -349,7 +350,7 @@
+         "  <td>%s</td>"
+         " </tbody></tr>",
+         nativeInterface());
+-
++#if USE(GLX)
+     g_string_append_printf(html,
+         " <tbody><tr>"
+         "  <td><div class=\"titlename\">GL_RENDERER</div></td>"
+@@ -377,7 +378,6 @@
+         "  <td>%s</td>"
+         " </tbody></tr>",
+         reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION)));
+-
+ #if USE(OPENGL_ES)
+     g_string_append_printf(html,
+         " <tbody><tr>"
+@@ -402,6 +402,7 @@
+         extensions->str);
+     g_string_free(extensions, TRUE);
+ #endif
++#endif
+ 
+     bool isGLX = false;
+ #if USE(GLX)
diff --git a/patches/patch-webkit2gtk-macports.diff b/patches/patch-webkit2gtk-macports.diff
new file mode 100644
index 0000000..8ed52bf
--- /dev/null
+++ b/patches/patch-webkit2gtk-macports.diff
@@ -0,0 +1,201 @@
+commit 504d7c6714f59b27028a43949f0088f9c19b39d7
+Author: ken-cunningham-webuse <ken cunningham webuse gmail com>
+Date:   Sun Oct 13 16:03:12 2019 -0700
+
+    webkit2-gtk: patchset to enable build on MacPorts
+    
+    presently Mojave against 10.14 SDK, building X11
+
+diff --git Source/JavaScriptCore/shell/PlatformGTK.cmake Source/JavaScriptCore/shell/PlatformGTK.cmake
+index c4ac7c9a..cf2fc2d6 100644
+--- Source/JavaScriptCore/shell/PlatformGTK.cmake
++++ Source/JavaScriptCore/shell/PlatformGTK.cmake
+@@ -1,3 +1,7 @@
+ list(APPEND jsc_LIBRARIES
+     ${GLIB_LIBRARIES}
+ )
++
++list(APPEND jsc_PRIVATE_INCLUDE_DIRECTORIES
++      ${WTF_DIR}
++)
+diff --git Source/WTF/CMakeLists.txt Source/WTF/CMakeLists.txt
+index 7c615c55..dd221b1a 100644
+--- Source/WTF/CMakeLists.txt
++++ Source/WTF/CMakeLists.txt
+@@ -6,6 +6,6 @@ add_subdirectory(wtf)
+ 
+ # Apple builds have the ICU headers checked into ${WTF_DIR}/icu
+ # Copy them into ${ICU_INCLUDE_DIRS} so the build behaves like find_package was used
+-if (APPLE)
++if (DISABLEAPPLE)
+     file(COPY ${WTF_DIR}/icu/unicode DESTINATION ${ICU_INCLUDE_DIRS})
+ endif ()
+diff --git Source/WebCore/CMakeLists.txt Source/WebCore/CMakeLists.txt
+index a5b62f40..440ef671 100644
+--- Source/WebCore/CMakeLists.txt
++++ Source/WebCore/CMakeLists.txt
+@@ -173,6 +173,10 @@ set(WebCore_SYSTEM_INCLUDE_DIRECTORIES
+     ${ZLIB_INCLUDE_DIRS}
+ )
+ 
++list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
++      ${PAL_DIR}
++)
++
+ set(WebCore_IDL_INCLUDES
+     css
+     dom
+diff --git Source/WebCore/PAL/pal/spi/cocoa/CommonCryptoSPI.h 
Source/WebCore/PAL/pal/spi/cocoa/CommonCryptoSPI.h
+new file mode 100644
+index 00000000..cf113819
+--- /dev/null
++++ Source/WebCore/PAL/pal/spi/cocoa/CommonCryptoSPI.h
+@@ -0,0 +1,117 @@
++/*
++ * Copyright (C) 2013-2019 Apple Inc. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ *    notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ *    notice, this list of conditions and the following disclaimer in the
++ *    documentation and/or other materials provided with the distribution.
++ *
++ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
++ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
++ * THE POSSIBILITY OF SUCH DAMAGE.
++ */
++
++#pragma once
++
++#if USE(APPLE_INTERNAL_SDK)
++
++#include <CommonCrypto/CommonCryptorSPI.h>
++#include <CommonCrypto/CommonDigestSPI.h>
++#include <CommonCrypto/CommonECCryptor.h>
++#include <CommonCrypto/CommonKeyDerivationSPI.h>
++#include <CommonCrypto/CommonRSACryptor.h>
++#include <CommonCrypto/CommonRSACryptorSPI.h>
++
++#else
++
++#ifndef _CC_RSACRYPTOR_H_
++enum {
++    kCCDigestNone = 0,
++    kCCDigestSHA1 = 8,
++    kCCDigestSHA224 = 9,
++    kCCDigestSHA256 = 10,
++    kCCDigestSHA384 = 11,
++    kCCDigestSHA512 = 12,
++};
++typedef uint32_t CCDigestAlgorithm;
++
++enum {
++    ccRSAKeyPublic = 0,
++    ccRSAKeyPrivate = 1
++};
++typedef uint32_t CCRSAKeyType;
++
++enum {
++    ccPKCS1Padding = 1001,
++    ccOAEPPadding = 1002,
++    ccRSAPSSPadding = 1005
++};
++typedef uint32_t CCAsymmetricPadding;
++#endif
++
++typedef struct _CCRSACryptor *CCRSACryptorRef;
++extern "C" CCCryptorStatus CCRSACryptorEncrypt(CCRSACryptorRef publicKey, CCAsymmetricPadding padding, 
const void *plainText, size_t plainTextLen, void *cipherText, size_t *cipherTextLen, const void *tagData, 
size_t tagDataLen, CCDigestAlgorithm digestType);
++extern "C" CCCryptorStatus CCRSACryptorDecrypt(CCRSACryptorRef privateKey, CCAsymmetricPadding padding, 
const void *cipherText, size_t cipherTextLen, void *plainText, size_t *plainTextLen, const void *tagData, 
size_t tagDataLen, CCDigestAlgorithm digestType);
++extern "C" CCCryptorStatus CCRSACryptorSign(CCRSACryptorRef privateKey, CCAsymmetricPadding padding, const 
void *hashToSign, size_t hashSignLen, CCDigestAlgorithm digestType, size_t saltLen, void *signedData, size_t 
*signedDataLen);
++extern "C" CCCryptorStatus CCRSACryptorVerify(CCRSACryptorRef publicKey, CCAsymmetricPadding padding, const 
void *hash, size_t hashLen, CCDigestAlgorithm digestType, size_t saltLen, const void *signedData, size_t 
signedDataLen);
++extern "C" CCCryptorStatus CCRSACryptorGeneratePair(size_t keysize, uint32_t e, CCRSACryptorRef *publicKey, 
CCRSACryptorRef *privateKey);
++extern "C" CCRSACryptorRef CCRSACryptorGetPublicKeyFromPrivateKey(CCRSACryptorRef privkey);
++extern "C" void CCRSACryptorRelease(CCRSACryptorRef key);
++extern "C" CCCryptorStatus CCRSAGetKeyComponents(CCRSACryptorRef rsaKey, uint8_t *modulus, size_t 
*modulusLength, uint8_t *exponent, size_t *exponentLength, uint8_t *p, size_t *pLength, uint8_t *q, size_t 
*qLength);
++extern "C" CCRSAKeyType CCRSAGetKeyType(CCRSACryptorRef key);
++extern "C" CCCryptorStatus CCRSACryptorImport(const void *keyPackage, size_t keyPackageLen, CCRSACryptorRef 
*key);
++extern "C" CCCryptorStatus CCRSACryptorExport(CCRSACryptorRef key, void *out, size_t *outLen);
++
++extern "C" CCCryptorStatus CCRSAGetCRTComponentsSizes(CCRSACryptorRef rsaKey, size_t *dpSize, size_t 
*dqSize, size_t *qinvSize);
++extern "C" CCCryptorStatus CCRSAGetCRTComponents(CCRSACryptorRef rsaKey, void *dp, size_t dpSize, void *dq, 
size_t dqSize, void *qinv, size_t qinvSize);
++
++#ifndef _CC_ECCRYPTOR_H_
++enum {
++    ccECKeyPublic = 0,
++    ccECKeyPrivate = 1,
++};
++typedef uint32_t CCECKeyType;
++
++enum {
++    kCCImportKeyBinary = 0,
++};
++typedef uint32_t CCECKeyExternalFormat;
++#endif
++
++typedef struct _CCECCryptor *CCECCryptorRef;
++extern "C" CCCryptorStatus CCECCryptorGeneratePair(size_t keysize, CCECCryptorRef *publicKey, 
CCECCryptorRef *privateKey);
++extern "C" void CCECCryptorRelease(CCECCryptorRef key);
++extern "C" CCCryptorStatus CCECCryptorImportKey(CCECKeyExternalFormat format, const void *keyPackage, 
size_t keyPackageLen, CCECKeyType keyType, CCECCryptorRef *key);
++extern "C" CCCryptorStatus CCECCryptorExportKey(CCECKeyExternalFormat format, void *keyPackage, size_t 
*keyPackageLen, CCECKeyType keyType, CCECCryptorRef key);
++extern "C" int CCECGetKeySize(CCECCryptorRef key);
++extern "C" CCCryptorStatus CCECCryptorCreateFromData(size_t keySize, uint8_t *qX, size_t qXLength, uint8_t 
*qY, size_t qYLength, CCECCryptorRef *ref);
++extern "C" CCCryptorStatus CCECCryptorGetKeyComponents(CCECCryptorRef ecKey, size_t *keySize, uint8_t *qX, 
size_t *qXLength, uint8_t *qY, size_t *qYLength, uint8_t *d, size_t *dLength);
++extern "C" CCCryptorStatus CCECCryptorComputeSharedSecret(CCECCryptorRef privateKey, CCECCryptorRef 
publicKey, void *out, size_t *outLen);
++extern "C" CCCryptorStatus CCECCryptorSignHash(CCECCryptorRef privateKey, const void *hashToSign, size_t 
hashSignLen, void *signedData, size_t *signedDataLen);
++extern "C" CCCryptorStatus CCECCryptorVerifyHash(CCECCryptorRef publicKey, const void *hash, size_t 
hashLen, const void *signedData, size_t signedDataLen, uint32_t *valid);
++
++#ifndef CommonCrypto_CommonNistKeyDerivation_h
++enum {
++    kCCKDFAlgorithmHKDF = 6
++};
++typedef uint32_t CCKDFAlgorithm;
++#endif
++
++extern "C" CCStatus CCKeyDerivationHMac(CCKDFAlgorithm algorithm, CCDigestAlgorithm digest, unsigned 
rounds, const void *keyDerivationKey, size_t keyDerivationKeyLen, const void *label, size_t labelLen, const 
void *context, size_t contextLen, const void *iv, size_t ivLen, const void *salt, size_t saltLen, void 
*derivedKey, size_t derivedKeyLen);
++
++extern "C" CCCryptorStatus CCCryptorGCM(CCOperation op, CCAlgorithm alg, const void* key, size_t keyLength, 
const void* iv, size_t ivLen, const void* aData, size_t aDataLen, const void* dataIn, size_t dataInLength, 
void* dataOut, void* tag, size_t* tagLength);
++extern "C" CCCryptorStatus CCRSACryptorCreateFromData(CCRSAKeyType keyType, const uint8_t *modulus, size_t 
modulusLength, const uint8_t *exponent, size_t exponentLength, const uint8_t *p, size_t pLength, const 
uint8_t *q, size_t qLength, CCRSACryptorRef *ref);
++
++#endif // !USE(APPLE_INTERNAL_SDK)
+--- Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp.orig    2019-11-26 
03:02:20.000000000 -0800
++++ Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2019-11-26 14:56:04.000000000 
-0800
+@@ -795,7 +795,7 @@
+     if (GST_STATE(m_pipeline.get()) < GST_STATE_PAUSED)
+         return MediaTime::invalidTime();
+ 
+-    int64_t duration = 0;
++    gint64 duration = 0;
+     if (!gst_element_query_duration(m_pipeline.get(), GST_FORMAT_TIME, &duration) || 
!GST_CLOCK_TIME_IS_VALID(duration)) {
+         GST_DEBUG_OBJECT(pipeline(), "Time duration query failed for %s", m_url.string().utf8().data());
+         return MediaTime::positiveInfiniteTime();
+@@ -2332,7 +2332,7 @@
+             GUniqueOutPtr<GstStructure> responseHeaders;
+             if (gst_structure_get(structure, "response-headers", GST_TYPE_STRUCTURE, 
&responseHeaders.outPtr(), nullptr)) {
+                 CString contentLengthHeaderName = 
httpHeaderNameString(HTTPHeaderName::ContentLength).utf8();
+-                uint64_t contentLength = 0;
++                guint64 contentLength = 0;
+                 if (!gst_structure_get_uint64(responseHeaders.get(), contentLengthHeaderName.data(), 
&contentLength)) {
+                     // souphttpsrc sets a string for Content-Length, so
+                     // handle it here, until we remove the webkit+ protocol
+@@ -3707,8 +3707,8 @@ Optional<VideoPlaybackQualityMetrics> MediaPlayerPrivateGStreamer::videoPlayback
+     if (!webkitGstCheckVersion(1, 17, 0) && !m_fpsSink)
+         return WTF::nullopt;
+ 
+-    uint64_t totalVideoFrames = 0;
+-    uint64_t droppedVideoFrames = 0;
++    guint64 totalVideoFrames = 0;
++    guint64 droppedVideoFrames = 0;
+     if (webkitGstCheckVersion(1, 17, 0)) {
+         GUniqueOutPtr<GstStructure> stats;
+         g_object_get(m_videoSink.get(), "stats", &stats.outPtr(), nullptr);
diff --git a/patches/webkit-clang-fixes.patch b/patches/webkit-clang-fixes.patch
new file mode 100644
index 0000000..c6206a1
--- /dev/null
+++ b/patches/webkit-clang-fixes.patch
@@ -0,0 +1,33 @@
+--- Source/WTF/wtf/PointerPreparations.h~      2020-02-04 02:24:07.000000000 -0800
++++ Source/WTF/wtf/PointerPreparations.h       2020-10-20 12:36:53.000000000 -0700
+@@ -34,7 +34,7 @@
+ #if COMPILER_HAS_CLANG_BUILTIN(__builtin_get_vtable_pointer)
+ 
+ template<typename T>
+-ALWAYS_INLINE void* getVTablePointer(T* o) { return __builtin_get_vtable_pointer(o); }
++ALWAYS_INLINE const void* getVTablePointer(T* o) { return __builtin_get_vtable_pointer(o); }
+ 
+ #else // not COMPILER_HAS_CLANG_BUILTIN(__builtin_get_vtable_pointer)
+ 
+--- Source/WebCore/bindings/scripts/CodeGeneratorJS.pm~        2020-02-04 02:24:07.000000000 -0800
++++ Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2020-10-20 14:09:05.000000000 -0700
+@@ -4881,7 +4881,7 @@
+         push(@implContent, <<END) if $vtableNameGnu;
+ 
+ #if ENABLE(BINDING_INTEGRITY)
+-    void* actualVTablePointer = getVTablePointer(impl.ptr());
++    const void* actualVTablePointer = getVTablePointer(impl.ptr());
+ #if PLATFORM(WIN)
+     void* expectedVTablePointer = ${vtableRefWin};
+ #else
+--- Source/WebKit/UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp~ 2020-02-04 02:24:08.000000000 -0800
++++ Source/WebKit/UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp  2020-10-20 14:55:56.000000000 -0700
+@@ -33,7 +33,7 @@
+ #include <WebCore/GtkUtilities.h>
+ #include <WebCore/IntPoint.h>
+ #include <wtf/glib/GRefPtr.h>
+-#include <wtf/glib/GUniquePtr.h>
++#include <WebCore/GUniquePtrGtk.h>
+ 
+ namespace WebKit {
+ 
diff --git a/patches/webkit-disable-apple-icu.patch b/patches/webkit-disable-apple-icu.patch
new file mode 100644
index 0000000..d8c301f
--- /dev/null
+++ b/patches/webkit-disable-apple-icu.patch
@@ -0,0 +1,12 @@
+--- Source/cmake/WebKitFindPackage.cmake~      2020-08-12 02:17:57.000000000 -0700
++++ Source/cmake/WebKitFindPackage.cmake       2020-10-20 11:26:45.000000000 -0700
+@@ -86,7 +86,8 @@
+     endif ()
+ 
+     # Apple builds have a unique location for ICU
+-    if (APPLE AND "${package}" STREQUAL "ICU")
++    if (NOT "${PORT}" STREQUAL "GTK" AND APPLE AND "${package}" STREQUAL "ICU")
++      message(FATAL_ERROR "Attempting to use Apple ICU with Port=${PORT}")
+         set(_found_package ON)
+ 
+         set(ICU_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/ICU/Headers)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]