Skip to content

Commit

Permalink
webkit2-gtk-devel: reconcile with webkit2-gtk
Browse files Browse the repository at this point in the history
  • Loading branch information
mascguy committed Aug 30, 2022
1 parent 0fe71d2 commit a54af3f
Show file tree
Hide file tree
Showing 15 changed files with 223 additions and 127 deletions.
52 changes: 33 additions & 19 deletions www/webkit2-gtk-devel/Portfile
Expand Up @@ -7,14 +7,17 @@
PortSystem 1.0
PortGroup active_variants 1.1
PortGroup cmake 1.1
PortGroup legacysupport 1.1

compiler.cxx_standard 2017
cmake.generator Ninja
# Fix compilation for Angle subproject: platform.h: error: 'TARGET_OS_OSX' is not defined
legacysupport.newest_darwin_requires_legacy 15

name webkit2-gtk-devel
conflicts webkit2-gtk
version 2.27.3
revision 3
version 2.28.2
revision 0

description Apple's WebKit2 HTML rendering library for GTK+3
long_description ${description}
Expand All @@ -30,13 +33,14 @@ distname webkitgtk-${version}

dist_subdir webkit-gtk

checksums rmd160 b297a1aaae881d702d4b95f15fffc261c2608087 \
sha256 5390d0b41957834202893887f1ac04e3264b6a3d98160d4166e3c8c16bdb7492 \
size 20912420
checksums rmd160 a626f58cf30b6dd1ef8a63c165ce85770c4da675 \
sha256 b9d23525cfd8d22c37b5d964a9fe9a8ce7583042a2f8d3922e71e6bbc68c30bd \
size 21427772

depends_build-append \
port:gperf \
port:gtk-doc \
port:perl5.34 \
port:pkgconfig \
port:python27 \
port:py27-simplejson
Expand All @@ -60,6 +64,7 @@ depends_lib-append port:atk \
path:lib/pkgconfig/harfbuzz-icu.pc:harfbuzz-icu \
port:hyphen \
port:icu \
path:include/turbojpeg.h:libjpeg-turbo \
port:libnotify \
port:libpng \
port:libsecret \
Expand All @@ -82,6 +87,12 @@ patchfiles-append patch-webkit2gtk-macports.diff
# and a few more for webkit2-gtk-2.27.2
patchfiles-append patch-webkit2gtk-272-macports.diff

# and a few more for 282
patchfiles-append patch-webkit2gtk-2282-unprotected-egl-changes.diff

# os log is only available on newer systems.
patchfiles-append patch-webkit2gtk-2282-os-log-availability.diff

# enable Netscape plugin architecture on macOS
# or can be explicitly disabled with the following addition if preferred
# configure.args-append -DENABLE_NETSCAPE_PLUGIN_API=OFF
Expand All @@ -91,15 +102,17 @@ patchfiles-append patch-enable-plugin-architecture-unix.diff
# runs without this patch.
patchfiles-append patch-bundle-link-webcore.diff

# allow the webkit executables typically located in libexec to be
# dynamically located, this is useful for app bundling
patchfiles-append process-executable-path.diff
# Fix incompatibility with XCode 12:
# https://bugs.webkit.org/show_bug.cgi?id=207871
patchfiles-append patch-WTF-wtf-getVTablePointer.diff

# add new sources for NSApplicationActivationPolicy.mm
patchfiles-append patch-sources-gtk.diff
# Fix build errors due to -WWc++11-narrowing
# https://bugs.webkit.org/show_bug.cgi?id=211193
patchfiles-append patch-bool_narrowed.diff

# patch web process to add call to SetActivationPolicyProhibited
patchfiles-append patch-web-process-main.diff
# Explicitly specify installed dylib paths to g-ir-compile
# Fixes dlopen errors in apps using webkit2gtk introspection
patchfiles-append patch-webkit2gtk-specify-installed-dylibs.diff

# it is preferred to use the WebKit built in bmalloc if it builds on a given os.
# it has improved security features, but not all systems can build it at present.
Expand All @@ -109,19 +122,15 @@ configure.args-append \
-DENABLE_INTROSPECTION=ON \
-DENABLE_MINIBROWSER=OFF \
-DENABLE_VIDEO=ON \
-DUSE_SYSTEM_MALLOC=OFF
-DUSE_SYSTEM_MALLOC=OFF \
-DPERL_EXECUTABLE=${prefix}/bin/perl5.34

pre-configure {
if {![variant_isset quartz] && ![variant_isset x11]} {
error "Either +x11 or +quartz is required"
}
}

post-patch {
file copy ${filespath}/NSApplicationActivationPolicy.h ${worksrcpath}/Source/WebKit/WebProcess/gtk/NSApplicationActivationPolicy.h
file copy ${filespath}/NSApplicationActivationPolicy.mm ${worksrcpath}/Source/WebKit/WebProcess/gtk/NSApplicationActivationPolicy.mm
}

if {![variant_isset quartz]} {
default_variants-append +x11
}
Expand Down Expand Up @@ -170,6 +179,11 @@ variant minibrowser description {Build and install MiniBrowser (for testing)} {
# help wanted, if suitably motivated
universal_variant no

# Fix builds if ccache happens to be installed when configure.ccache=no
if {![option configure.ccache]} {
build.env-append CCACHE_DIR=${workpath}/.ccache
}

# the above code presently builds as-in on 10.13 and up
if {${os.platform} eq "darwin" && ${os.major} <= 16} {

Expand All @@ -178,7 +192,7 @@ if {${os.platform} eq "darwin" && ${os.major} <= 16} {
patchfiles-append patch-ramsize.diff

# Source/WTF/wtf/unix/CPUTimeUnix.cpp : add back a previous Darwin compat version
patchfiles-append patch-source-wtf-wtf-unix-cputimeunix-cpp-darwin-version-restore.diff
patchfiles-append patch-source-wtf-wtf-unix-cputimeunix-cpp-darwin-version-restore.diff

# some Darwin versions don't have MAP_JIT; only use it if available
patchfiles-append patch-source-wtf-wtf-osallocatorposix-cpp-map-jit.diff
Expand Down
4 changes: 0 additions & 4 deletions www/webkit2-gtk-devel/files/NSApplicationActivationPolicy.h

This file was deleted.

10 changes: 0 additions & 10 deletions www/webkit2-gtk-devel/files/NSApplicationActivationPolicy.mm

This file was deleted.

37 changes: 37 additions & 0 deletions www/webkit2-gtk-devel/files/patch-WTF-wtf-getVTablePointer.diff
@@ -0,0 +1,37 @@
diff --git Source/WTF/wtf/PointerPreparations.h Source/WTF/wtf/PointerPreparations.h
index ef20a5e48512..ef9495169ff4 100644
--- Source/WTF/wtf/PointerPreparations.h
+++ Source/WTF/wtf/PointerPreparations.h
@@ -34,16 +34,16 @@ namespace WTF {
#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)

#if CPU(ARM64E)
template<typename T>
-ALWAYS_INLINE void* getVTablePointer(T* o) { return __builtin_ptrauth_auth(*(reinterpret_cast<void**>(o)), ptrauth_key_cxx_vtable_pointer, 0); }
+ALWAYS_INLINE const void* getVTablePointer(T* o) { return __builtin_ptrauth_auth(*(reinterpret_cast<void**>(o)), ptrauth_key_cxx_vtable_pointer, 0); }
#else // not CPU(ARM64E)
template<typename T>
-ALWAYS_INLINE void* getVTablePointer(T* o) { return (*(reinterpret_cast<void**>(o))); }
+ALWAYS_INLINE const void* getVTablePointer(T* o) { return (*(reinterpret_cast<void**>(o))); }
#endif // not CPU(ARM64E)

#endif // not COMPILER_HAS_CLANG_BUILTIN(__builtin_get_vtable_pointer)
diff --git Source/WebCore/bindings/scripts/CodeGeneratorJS.pm Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
index 35db4d28ccd6..03dd9c161a83 100644
--- Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -4881,7 +4881,7 @@ END
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
11 changes: 11 additions & 0 deletions www/webkit2-gtk-devel/files/patch-bool_narrowed.diff
@@ -0,0 +1,11 @@
--- Source/WebCore/style/StyleResolver.cpp
+++ Source/WebCore/style/StyleResolver.cpp
@@ -107,7 +107,7 @@ Resolver::Resolver(Document& document)
if (view)
m_mediaQueryEvaluator = MediaQueryEvaluator { view->mediaType() };
else
- m_mediaQueryEvaluator = MediaQueryEvaluator { "all" };
+ m_mediaQueryEvaluator = MediaQueryEvaluator { "all", false };

if (root) {
m_rootDefaultStyle = styleForElement(*root, m_document.renderStyle(), nullptr, RuleMatchingBehavior::MatchOnlyUserAgentRules).renderStyle;
8 changes: 4 additions & 4 deletions www/webkit2-gtk-devel/files/patch-bundle-link-webcore.diff
@@ -1,7 +1,7 @@
--- 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 @@

--- Source/WebKit/PlatformGTK.cmake.orig 2020-02-04 02:24:08.000000000 -0800
+++ Source/WebKit/PlatformGTK.cmake 2022-08-23 16:17:18.000000000 -0700
@@ -576,7 +576,7 @@
# Commands for building the built-in injected bundle.
add_library(webkit2gtkinjectedbundle MODULE "${WEBKIT_DIR}/WebProcess/InjectedBundle/API/glib/WebKitInjectedBundleMain.cpp")
ADD_WEBKIT_PREFIX_HEADER(webkit2gtkinjectedbundle)
-target_link_libraries(webkit2gtkinjectedbundle WebKit)
Expand Down
@@ -1,6 +1,6 @@
--- Source/WebKit/config.h.orig 2018-06-13 23:57:05.000000000 +0800
+++ Source/WebKit/config.h 2018-06-13 23:59:35.000000000 +0800
@@ -55,10 +55,10 @@
@@ -49,10 +49,10 @@
#endif

#ifndef PLUGIN_ARCHITECTURE_UNSUPPORTED
Expand Down
13 changes: 0 additions & 13 deletions www/webkit2-gtk-devel/files/patch-sources-gtk.diff

This file was deleted.

18 changes: 0 additions & 18 deletions www/webkit2-gtk-devel/files/patch-web-process-main.diff

This file was deleted.

@@ -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;
@@ -0,0 +1,68 @@
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.


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
17 changes: 4 additions & 13 deletions www/webkit2-gtk-devel/files/patch-webkit2gtk-272-macports.diff
Expand Up @@ -44,16 +44,7 @@ diff --git Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp Source/Web
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
@@ -273,7 +273,7 @@
" <td><div class=\"titlename\">Type</div></td>"
" <td>%s</td>"
" </tbody></tr>",
- PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::Wayland ? "Wayland" : "X11");
+ "X11");
#endif

auto rect = IntRect(screenRect(nullptr));
@@ -333,9 +333,10 @@
@@ -354,9 +354,10 @@
" </tbody></tr>",
webGLEnabled(request) ? "Yes" : "No");

Expand All @@ -65,7 +56,7 @@ index 57e8a557..45df4cf6 100644
g_string_append_printf(html,
" <tbody><tr>"
" <td><div class=\"titlename\">API</div></td>"
@@ -349,7 +350,7 @@
@@ -370,7 +371,7 @@
" <td>%s</td>"
" </tbody></tr>",
nativeInterface());
Expand All @@ -74,15 +65,15 @@ index 57e8a557..45df4cf6 100644
g_string_append_printf(html,
" <tbody><tr>"
" <td><div class=\"titlename\">GL_RENDERER</div></td>"
@@ -377,7 +378,6 @@
@@ -398,7 +399,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 @@
@@ -423,6 +423,7 @@
extensions->str);
g_string_free(extensions, TRUE);
#endif
Expand Down

0 comments on commit a54af3f

Please sign in to comment.