diff -urp webkitgtk-2.39.90.ruby/Source/cmake/OptionsGTK.cmake webkitgtk-2.39.90/Source/cmake/OptionsGTK.cmake
--- webkitgtk-2.39.90.ruby/Source/cmake/OptionsGTK.cmake	2023-02-24 15:30:43.481538198 -0600
+++ webkitgtk-2.39.90/Source/cmake/OptionsGTK.cmake	2023-02-27 19:19:03.269709820 -0600
@@ -20,7 +20,6 @@ find_package(LibGcrypt 1.6.0 REQUIRED)
 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)
@@ -37,8 +36,8 @@ 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_THEME_ADWAITA TRUE)
 SET_AND_EXPOSE_TO_BUILD(USE_XDGMIME TRUE)
 
diff -urp webkitgtk-2.39.90.ruby/Source/WebCore/platform/graphics/egl/GLContextEGLWayland.cpp webkitgtk-2.39.90/Source/WebCore/platform/graphics/egl/GLContextEGLWayland.cpp
--- webkitgtk-2.39.90.ruby/Source/WebCore/platform/graphics/egl/GLContextEGLWayland.cpp	2023-02-20 03:22:18.869743300 -0600
+++ webkitgtk-2.39.90/Source/WebCore/platform/graphics/egl/GLContextEGLWayland.cpp	2023-02-24 16:22:26.333919652 -0600
@@ -22,15 +22,10 @@
 #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 -urp webkitgtk-2.39.90.ruby/Source/WebCore/platform/graphics/egl/GLContextEGLX11.cpp webkitgtk-2.39.90/Source/WebCore/platform/graphics/egl/GLContextEGLX11.cpp
--- webkitgtk-2.39.90.ruby/Source/WebCore/platform/graphics/egl/GLContextEGLX11.cpp	2023-02-20 03:22:18.869743300 -0600
+++ webkitgtk-2.39.90/Source/WebCore/platform/graphics/egl/GLContextEGLX11.cpp	2023-02-24 16:22:26.333919652 -0600
@@ -20,17 +20,11 @@
 #include "GLContextEGL.h"
 
 #if USE(EGL) && PLATFORM(X11)
-
 #include "PlatformDisplayX11.h"
 #include "XErrorTrapper.h"
 #include "XUniquePtr.h"
-#include <X11/Xlib.h>
-
-#if USE(LIBEPOXY)
-#include <epoxy/egl.h>
-#else
 #include <EGL/egl.h>
-#endif
+#include <X11/Xlib.h>
 
 namespace WebCore {
 
diff -urp webkitgtk-2.39.90.ruby/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp webkitgtk-2.39.90/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp
--- webkitgtk-2.39.90.ruby/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp	2023-02-20 03:22:18.885743600 -0600
+++ webkitgtk-2.39.90/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp	2023-02-24 16:22:26.333919652 -0600
@@ -20,17 +20,11 @@
 #include "GLContextGLX.h"
 
 #if USE(GLX)
-
+#include "OpenGLShims.h"
 #include "PlatformDisplayX11.h"
 #include "XErrorTrapper.h"
-#include <cairo.h>
-
-#if USE(LIBEPOXY)
-#include <epoxy/glx.h>
-#else
-#include "OpenGLShims.h"
 #include <GL/glx.h>
-#endif
+#include <cairo.h>
 
 namespace WebCore {
 
diff -urp webkitgtk-2.39.90.ruby/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp webkitgtk-2.39.90/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp
--- webkitgtk-2.39.90.ruby/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp	2023-02-20 03:22:19.005744000 -0600
+++ webkitgtk-2.39.90/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp	2023-02-24 16:22:26.333919652 -0600
@@ -30,17 +30,12 @@
 
 #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>
-#endif
+#include <wtf/Assertions.h>
 
 #if PLATFORM(GTK)
 #if USE(GTK4)
diff -urp webkitgtk-2.39.90.ruby/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp webkitgtk-2.39.90/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp
--- webkitgtk-2.39.90.ruby/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp	2023-02-24 15:34:45.246814657 -0600
+++ webkitgtk-2.39.90/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp	2023-02-24 16:22:26.333919652 -0600
@@ -45,21 +45,13 @@
 #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 -urp webkitgtk-2.39.90.ruby/Source/WebCore/platform/graphics/x11/XUniquePtr.h webkitgtk-2.39.90/Source/WebCore/platform/graphics/x11/XUniquePtr.h
--- webkitgtk-2.39.90.ruby/Source/WebCore/platform/graphics/x11/XUniquePtr.h	2023-02-20 03:22:19.017744000 -0600
+++ webkitgtk-2.39.90/Source/WebCore/platform/graphics/x11/XUniquePtr.h	2023-02-24 16:22:26.333919652 -0600
@@ -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,7 +66,10 @@ using XUniqueGC = XUniquePtr<_XGC>;
 
 #if USE(GLX)
 template<> struct XPtrDeleter<__GLXcontextRec> {
-    void operator() (__GLXcontextRec*) const;
+    void operator() (__GLXcontextRec* ptr)
+    {
+        glXDestroyContext(downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay()).native(), ptr);
+    }
 };
 // Give a name to this to avoid having to use the internal struct name.
 using XUniqueGLXContext = XUniquePtr<__GLXcontextRec>;
diff -urp webkitgtk-2.39.90.ruby/Source/WebCore/platform/graphics/x11/XUniqueResource.cpp webkitgtk-2.39.90/Source/WebCore/platform/graphics/x11/XUniqueResource.cpp
--- webkitgtk-2.39.90.ruby/Source/WebCore/platform/graphics/x11/XUniqueResource.cpp	2023-02-20 03:22:19.017744000 -0600
+++ webkitgtk-2.39.90/Source/WebCore/platform/graphics/x11/XUniqueResource.cpp	2023-02-24 16:22:26.333919652 -0600
@@ -36,12 +36,8 @@
 #endif
 
 #if USE(GLX)
-#if USE(LIBEPOXY)
-#include <epoxy/glx.h>
-#else
 #include <GL/glx.h>
 #endif
-#endif
 
 namespace WebCore {
 
diff -urp webkitgtk-2.39.90.ruby/Source/WebCore/PlatformGTK.cmake webkitgtk-2.39.90/Source/WebCore/PlatformGTK.cmake
--- webkitgtk-2.39.90.ruby/Source/WebCore/PlatformGTK.cmake	2023-02-24 15:37:27.283670174 -0600
+++ webkitgtk-2.39.90/Source/WebCore/PlatformGTK.cmake	2023-02-24 16:22:26.329919630 -0600
@@ -24,7 +24,6 @@ list(APPEND WebCore_PRIVATE_INCLUDE_DIRE
     "${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"
@@ -98,7 +97,7 @@ list(APPEND WebCore_SYSTEM_INCLUDE_DIREC
     ${UPOWERGLIB_INCLUDE_DIRS}
 )
 
-if (USE_OPENGL AND NOT USE_LIBEPOXY)
+if (USE_OPENGL)
     list(APPEND WebCore_SOURCES
         platform/graphics/OpenGLShims.cpp
     )
diff -urp webkitgtk-2.39.90.ruby/Source/WebCore/SourcesGTK.txt webkitgtk-2.39.90/Source/WebCore/SourcesGTK.txt
--- webkitgtk-2.39.90.ruby/Source/WebCore/SourcesGTK.txt	2023-02-24 15:30:43.497538281 -0600
+++ webkitgtk-2.39.90/Source/WebCore/SourcesGTK.txt	2023-02-24 16:22:26.333919652 -0600
@@ -123,7 +123,6 @@ platform/graphics/wayland/PlatformDispla
 
 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 -urp webkitgtk-2.39.90.ruby/Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp webkitgtk-2.39.90/Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp
--- webkitgtk-2.39.90.ruby/Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp	2023-02-20 03:22:21.473753700 -0600
+++ webkitgtk-2.39.90/Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp	2023-02-24 16:22:26.333919652 -0600
@@ -51,6 +51,13 @@
 #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)
@@ -67,17 +74,6 @@
 #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 -urp webkitgtk-2.39.90.ruby/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp webkitgtk-2.39.90/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp
--- webkitgtk-2.39.90.ruby/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp	2023-02-20 03:22:21.793755000 -0600
+++ webkitgtk-2.39.90/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp	2023-02-24 16:22:26.333919652 -0600
@@ -30,9 +30,6 @@
 
 #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)
@@ -40,16 +37,12 @@
 #else
 #include <gdk/gdkwayland.h>
 #endif
-#if USE(LIBEPOXY)
-#include <epoxy/egl.h>
-#else
 #include <EGL/egl.h>
 #include <EGL/eglext.h>
-#endif
+#include <WebCore/CairoUtilities.h>
+#include <WebCore/GLContext.h>
 
-#if USE(LIBEPOXY)
-#include <epoxy/gl.h>
-#elif USE(OPENGL_ES)
+#if USE(OPENGL_ES)
 #include <GLES2/gl2.h>
 #include <GLES2/gl2ext.h>
 #else
