Add patches to fix build

This commit is contained in:
Michael Catanzaro 2022-11-18 09:47:09 -06:00
parent dc7100f290
commit cdde02131f
3 changed files with 410 additions and 0 deletions

12
angle-build.patch Normal file
View File

@ -0,0 +1,12 @@
diff --git a/Source/ThirdParty/ANGLE/src/libANGLE/Constants.h b/Source/ThirdParty/ANGLE/src/libANGLE/Constants.h
index 36152825e438..9b6d940bf31a 100644
--- a/Source/ThirdParty/ANGLE/src/libANGLE/Constants.h
+++ b/Source/ThirdParty/ANGLE/src/libANGLE/Constants.h
@@ -12,6 +12,7 @@
#include "common/platform.h"
#include <stdint.h>
+#include <stdlib.h>
namespace gl
{

391
epoxy.patch Normal file
View File

@ -0,0 +1,391 @@
From 9b03b450fbf8ec074bd030c08fa3e34acb44a3f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=BDan=20Dober=C5=A1ek?= <zdobersek@igalia.com>
Date: Fri, 18 Nov 2022 16:52:53 +0100
Subject: [PATCH] [GTK] Adopt libepoxy
https://bugs.webkit.org/show_bug.cgi?id=248074
Reviewed by NOBODY (OOPS!).
Have the GTK port use libepoxy instead of directly including system-provided
graphics libraries headers.
* Source/WebCore/PlatformGTK.cmake:
* Source/WebCore/SourcesGTK.txt:
* Source/WebCore/platform/graphics/egl/GLContextEGLWayland.cpp:
* Source/WebCore/platform/graphics/egl/GLContextEGLX11.cpp:
* Source/WebCore/platform/graphics/glx/GLContextGLX.cpp:
* Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp:
* Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp:
* Source/WebCore/platform/graphics/x11/XUniquePtr.cpp: Copied from Source/WebCore/platform/graphics/x11/XUniquePtr.h.
(WebCore::XPtrDeleter<__GLXcontextRec>::operator const):
* Source/WebCore/platform/graphics/x11/XUniquePtr.h:
(WebCore::XPtrDeleter<__GLXcontextRec>::operator()): Deleted.
* Source/WebCore/platform/graphics/x11/XUniqueResource.cpp:
* Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp:
* Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
* Source/cmake/OptionsGTK.cmake:
---
Source/WebCore/PlatformGTK.cmake | 3 +-
Source/WebCore/SourcesGTK.txt | 1 +
.../graphics/egl/GLContextEGLWayland.cpp | 5 ++
.../platform/graphics/egl/GLContextEGLX11.cpp | 8 ++-
.../platform/graphics/glx/GLContextGLX.cpp | 10 +++-
.../wayland/PlatformDisplayWayland.cpp | 7 ++-
.../graphics/x11/PlatformDisplayX11.cpp | 8 +++
.../platform/graphics/x11/XUniquePtr.cpp | 51 +++++++++++++++++++
.../platform/graphics/x11/XUniquePtr.h | 7 +--
.../platform/graphics/x11/XUniqueResource.cpp | 4 ++
.../API/glib/WebKitProtocolHandler.cpp | 18 ++++---
.../gtk/AcceleratedBackingStoreWayland.cpp | 13 +++--
Source/cmake/OptionsGTK.cmake | 4 +-
13 files changed, 118 insertions(+), 21 deletions(-)
create mode 100644 Source/WebCore/platform/graphics/x11/XUniquePtr.cpp
diff --git a/Source/WebCore/PlatformGTK.cmake b/Source/WebCore/PlatformGTK.cmake
index 1beed847ee61..96c0446ed0d7 100644
--- a/Source/WebCore/PlatformGTK.cmake
+++ b/Source/WebCore/PlatformGTK.cmake
@@ -23,6 +23,7 @@ list(APPEND WebCore_PRIVATE_INCLUDE_DIRECTORIES
"${WEBCORE_DIR}/platform/glib"
"${WEBCORE_DIR}/platform/gtk"
"${WEBCORE_DIR}/platform/graphics/egl"
+ "${WEBCORE_DIR}/platform/graphics/epoxy"
"${WEBCORE_DIR}/platform/graphics/glx"
"${WEBCORE_DIR}/platform/graphics/gbm"
"${WEBCORE_DIR}/platform/graphics/gstreamer"
@@ -107,7 +108,7 @@ list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
${UPOWERGLIB_INCLUDE_DIRS}
)
-if (USE_OPENGL)
+if (USE_OPENGL AND NOT USE_LIBEPOXY)
list(APPEND WebCore_SOURCES
platform/graphics/OpenGLShims.cpp
)
diff --git a/Source/WebCore/SourcesGTK.txt b/Source/WebCore/SourcesGTK.txt
index 3e0ba1eb4589..723e7782ff80 100644
--- a/Source/WebCore/SourcesGTK.txt
+++ b/Source/WebCore/SourcesGTK.txt
@@ -106,6 +106,7 @@ platform/graphics/wayland/PlatformDisplayWayland.cpp
platform/graphics/x11/PlatformDisplayX11.cpp @no-unify
platform/graphics/x11/XErrorTrapper.cpp @no-unify
+platform/graphics/x11/XUniquePtr.cpp @no-unify
platform/graphics/x11/XUniqueResource.cpp @no-unify
platform/gtk/CursorGtk.cpp
diff --git a/Source/WebCore/platform/graphics/egl/GLContextEGLWayland.cpp b/Source/WebCore/platform/graphics/egl/GLContextEGLWayland.cpp
index fa6b6ab9bc6d..369f1e2e407f 100644
--- a/Source/WebCore/platform/graphics/egl/GLContextEGLWayland.cpp
+++ b/Source/WebCore/platform/graphics/egl/GLContextEGLWayland.cpp
@@ -22,10 +22,15 @@
#if USE(EGL) && PLATFORM(WAYLAND)
#include "PlatformDisplayWayland.h"
+
// These includes need to be in this order because wayland-egl.h defines WL_EGL_PLATFORM
// and egl.h checks that to decide whether it's Wayland platform.
#include <wayland-egl.h>
+#if USE(LIBEPOXY)
+#include <epoxy/egl.h>
+#else
#include <EGL/egl.h>
+#endif
namespace WebCore {
diff --git a/Source/WebCore/platform/graphics/egl/GLContextEGLX11.cpp b/Source/WebCore/platform/graphics/egl/GLContextEGLX11.cpp
index 8f73239988e8..7a7018390a11 100644
--- a/Source/WebCore/platform/graphics/egl/GLContextEGLX11.cpp
+++ b/Source/WebCore/platform/graphics/egl/GLContextEGLX11.cpp
@@ -20,12 +20,18 @@
#include "GLContextEGL.h"
#if USE(EGL) && PLATFORM(X11)
+
#include "PlatformDisplayX11.h"
#include "XErrorTrapper.h"
#include "XUniquePtr.h"
-#include <EGL/egl.h>
#include <X11/Xlib.h>
+#if USE(LIBEPOXY)
+#include <epoxy/egl.h>
+#else
+#include <EGL/egl.h>
+#endif
+
namespace WebCore {
GLContextEGL::GLContextEGL(PlatformDisplay& display, EGLContext context, EGLSurface surface, EGLConfig config, XUniquePixmap&& pixmap)
diff --git a/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp b/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp
index 9839d9ba9a2e..44d256e4c3bb 100644
--- a/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp
+++ b/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp
@@ -20,12 +20,18 @@
#include "GLContextGLX.h"
#if USE(GLX)
-#include "OpenGLShims.h"
+
#include "PlatformDisplayX11.h"
#include "XErrorTrapper.h"
-#include <GL/glx.h>
#include <cairo.h>
+#if USE(LIBEPOXY)
+#include <epoxy/glx.h>
+#else
+#include "OpenGLShims.h"
+#include <GL/glx.h>
+#endif
+
namespace WebCore {
#if !defined(PFNGLXSWAPINTERVALSGIPROC)
diff --git a/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp b/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp
index f3e7bf4675b4..e953ca6dbfd6 100644
--- a/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp
+++ b/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp
@@ -30,12 +30,17 @@
#include "GLContextEGL.h"
#include <cstring>
+#include <wtf/Assertions.h>
+
// These includes need to be in this order because wayland-egl.h defines WL_EGL_PLATFORM
// and egl.h checks that to decide whether it's Wayland platform.
#include <wayland-egl.h>
+#if USE(LIBEPOXY)
+#include <epoxy/egl.h>
+#else
#include <EGL/egl.h>
#include <EGL/eglext.h>
-#include <wtf/Assertions.h>
+#endif
#if PLATFORM(GTK)
#if USE(GTK4)
diff --git a/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp b/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp
index 91843521ddb9..8eeb86a4cb16 100644
--- a/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp
+++ b/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp
@@ -45,13 +45,21 @@
#endif
#if USE(EGL)
+#if USE(LIBEPOXY)
+#include <epoxy/egl.h>
+#else
#include <EGL/egl.h>
#include <EGL/eglext.h>
#endif
+#endif
#if USE(GLX)
+#if USE(LIBEPOXY)
+#include <epoxy/glx.h>
+#else
#include <GL/glx.h>
#endif
+#endif
namespace WebCore {
diff --git a/Source/WebCore/platform/graphics/x11/XUniquePtr.cpp b/Source/WebCore/platform/graphics/x11/XUniquePtr.cpp
new file mode 100644
index 000000000000..9a579f2c91b8
--- /dev/null
+++ b/Source/WebCore/platform/graphics/x11/XUniquePtr.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2022 Igalia S.L
+ *
+ * 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 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 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.
+ */
+
+#include "config.h"
+#include "XUniquePtr.h"
+
+#if PLATFORM(X11)
+
+#if USE(GLX)
+#if USE(LIBEPOXY)
+#include <epoxy/glx.h>
+#else
+extern "C" void glXDestroyContext(::Display*, GLXContext);
+#endif
+#endif
+
+namespace WebCore {
+
+#if USE(GLX)
+
+void XPtrDeleter<__GLXcontextRec>::operator() (__GLXcontextRec*) const
+{
+}
+
+#endif
+
+}
+
+#endif // PLATFORM(X11)
diff --git a/Source/WebCore/platform/graphics/x11/XUniquePtr.h b/Source/WebCore/platform/graphics/x11/XUniquePtr.h
index ed1cc744cd05..d9b3778ca837 100644
--- a/Source/WebCore/platform/graphics/x11/XUniquePtr.h
+++ b/Source/WebCore/platform/graphics/x11/XUniquePtr.h
@@ -27,12 +27,12 @@
#define XUniquePtr_h
#if PLATFORM(X11)
+
#include "PlatformDisplayX11.h"
#include <X11/Xutil.h>
#if USE(GLX)
typedef struct __GLXcontextRec* GLXContext;
-extern "C" void glXDestroyContext(::Display*, GLXContext);
#endif
namespace WebCore {
@@ -66,10 +66,7 @@ using XUniqueGC = XUniquePtr<_XGC>;
#if USE(GLX)
template<> struct XPtrDeleter<__GLXcontextRec> {
- void operator() (__GLXcontextRec* ptr)
- {
- glXDestroyContext(downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay()).native(), ptr);
- }
+ void operator() (__GLXcontextRec*) const;
};
// Give a name to this to avoid having to use the internal struct name.
using XUniqueGLXContext = XUniquePtr<__GLXcontextRec>;
diff --git a/Source/WebCore/platform/graphics/x11/XUniqueResource.cpp b/Source/WebCore/platform/graphics/x11/XUniqueResource.cpp
index f300ee4f5941..99360375fc2d 100644
--- a/Source/WebCore/platform/graphics/x11/XUniqueResource.cpp
+++ b/Source/WebCore/platform/graphics/x11/XUniqueResource.cpp
@@ -36,8 +36,12 @@
#endif
#if USE(GLX)
+#if USE(LIBEPOXY)
+#include <epoxy/glx.h>
+#else
#include <GL/glx.h>
#endif
+#endif
namespace WebCore {
diff --git a/Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp b/Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp
index bfbce2a5314d..6d93a6def600 100644
--- a/Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp
+++ b/Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp
@@ -51,13 +51,6 @@
#endif
#endif
-#if PLATFORM(X11)
-#include <WebCore/PlatformDisplayX11.h>
-#if USE(GLX)
-#include <GL/glx.h>
-#endif
-#endif
-
#if USE(LIBEPOXY)
#include <epoxy/gl.h>
#elif USE(OPENGL_ES)
@@ -74,6 +67,17 @@
#endif
#endif
+#if PLATFORM(X11)
+#include <WebCore/PlatformDisplayX11.h>
+#if USE(GLX)
+#if USE(LIBEPOXY)
+#include <epoxy/glx.h>
+#else
+#include <GL/glx.h>
+#endif
+#endif
+#endif
+
#if USE(GSTREAMER)
#include <gst/gst.h>
#endif
diff --git a/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp b/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp
index b9e0794c607c..ccd6d423b27f 100644
--- a/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp
+++ b/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp
@@ -30,6 +30,9 @@
#include "LayerTreeContext.h"
#include "WebPageProxy.h"
+#include <WebCore/CairoUtilities.h>
+#include <WebCore/GLContext.h>
+
// These includes need to be in this order because wayland-egl.h defines WL_EGL_PLATFORM
// and eglplatform.h, included by egl.h, checks that to decide whether it's Wayland platform.
#if USE(GTK4)
@@ -37,12 +40,16 @@
#else
#include <gdk/gdkwayland.h>
#endif
+#if USE(LIBEPOXY)
+#include <epoxy/egl.h>
+#else
#include <EGL/egl.h>
#include <EGL/eglext.h>
-#include <WebCore/CairoUtilities.h>
-#include <WebCore/GLContext.h>
+#endif
-#if USE(OPENGL_ES)
+#if USE(LIBEPOXY)
+#include <epoxy/gl.h>
+#elif USE(OPENGL_ES)
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#else
diff --git a/Source/cmake/OptionsGTK.cmake b/Source/cmake/OptionsGTK.cmake
index e2fde8d07173..885a2befa041 100644
--- a/Source/cmake/OptionsGTK.cmake
+++ b/Source/cmake/OptionsGTK.cmake
@@ -21,6 +21,7 @@ find_package(GLIB 2.56.4 REQUIRED COMPONENTS gio gio-unix gobject gthread gmodul
find_package(HarfBuzz 0.9.18 REQUIRED COMPONENTS ICU)
find_package(ICU 61.2 REQUIRED COMPONENTS data i18n uc)
find_package(JPEG REQUIRED)
+find_package(LibEpoxy 1.4.0 REQUIRED)
find_package(LibXml2 2.8.0 REQUIRED)
find_package(PNG REQUIRED)
find_package(SQLite3 REQUIRED)
@@ -36,8 +37,9 @@ find_package(OpenGLES2)
include(GStreamerDefinitions)
SET_AND_EXPOSE_TO_BUILD(USE_CAIRO TRUE)
-SET_AND_EXPOSE_TO_BUILD(USE_XDGMIME TRUE)
SET_AND_EXPOSE_TO_BUILD(USE_GCRYPT TRUE)
+SET_AND_EXPOSE_TO_BUILD(USE_LIBEPOXY TRUE)
+SET_AND_EXPOSE_TO_BUILD(USE_XDGMIME TRUE)
if (WTF_CPU_ARM OR WTF_CPU_MIPS)
SET_AND_EXPOSE_TO_BUILD(USE_CAPSTONE ${DEVELOPER_MODE})

View File

@ -29,6 +29,12 @@ Source1: https://webkitgtk.org/releases/webkitgtk-%{version}.tar.xz.asc
# $ gpg --export --export-options export-minimal D7FCF61CF9A2DEAB31D81BD3F3D322D0EC4582C3 5AA3BC334FD7E3369E7C77B291C559DBE4C9123B > webkitgtk-keys.gpg
Source2: webkitgtk-keys.gpg
# https://bugs.webkit.org/show_bug.cgi?id=248032
# https://bugs.webkit.org/show_bug.cgi?id=248074
Patch0: epoxy.patch
Patch1: angle-build.patch
BuildRequires: bison
BuildRequires: bubblewrap
BuildRequires: cmake
@ -57,6 +63,7 @@ BuildRequires: pkgconfig(atspi-2)
BuildRequires: pkgconfig(cairo)
BuildRequires: pkgconfig(egl)
BuildRequires: pkgconfig(enchant-2)
BuildRequires: pkgconfig(epoxy)
BuildRequires: pkgconfig(fontconfig)
BuildRequires: pkgconfig(freetype2)
BuildRequires: pkgconfig(gl)