Load libwayland-egl at runtime
diff --git a/src/wl_init.c b/src/wl_init.c
index 80a2820..8e49f38 100644
--- a/src/wl_init.c
+++ b/src/wl_init.c
@@ -683,6 +683,21 @@
 
 int _glfwPlatformInit(void)
 {
+    _glfw.wl.egl.handle = _glfw_dlopen("libwayland-egl.so.1");
+    if (!_glfw.wl.egl.handle)
+    {
+        _glfwInputError(GLFW_PLATFORM_ERROR,
+                        "Wayland: Failed to open libwayland-egl.");
+        return GLFW_FALSE;
+    }
+
+    _glfw.wl.egl.window_create = (PFN_wl_egl_window_create)
+        _glfw_dlsym(_glfw.wl.egl.handle, "wl_egl_window_create");
+    _glfw.wl.egl.window_destroy = (PFN_wl_egl_window_destroy)
+        _glfw_dlsym(_glfw.wl.egl.handle, "wl_egl_window_destroy");
+    _glfw.wl.egl.window_resize = (PFN_wl_egl_window_resize)
+        _glfw_dlsym(_glfw.wl.egl.handle, "wl_egl_window_resize");
+
     _glfw.wl.xkb.handle = _glfw_dlopen("libxkbcommon.so.0");
     if (!_glfw.wl.xkb.handle)
     {
@@ -799,6 +814,11 @@
         _glfw_dlclose(_glfw.wl.xkb.handle);
         _glfw.wl.xkb.handle = NULL;
     }
+    if (_glfw.wl.egl.handle)
+    {
+        _glfw_dlclose(_glfw.wl.egl.handle);
+        _glfw.wl.egl.handle = NULL;
+    }
 
     if (_glfw.wl.cursorTheme)
         wl_cursor_theme_destroy(_glfw.wl.cursorTheme);
diff --git a/src/wl_platform.h b/src/wl_platform.h
index 5349981..87ffc56 100644
--- a/src/wl_platform.h
+++ b/src/wl_platform.h
@@ -71,6 +71,13 @@
 #define _GLFW_PLATFORM_CONTEXT_STATE
 #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE
 
+typedef struct wl_egl_window* (* PFN_wl_egl_window_create)(struct wl_surface*, int, int);
+typedef void (* PFN_wl_egl_window_destroy)(struct wl_egl_window*);
+typedef void (* PFN_wl_egl_window_resize)(struct wl_egl_window*, int, int, int, int);
+#define wl_egl_window_create _glfw.wl.egl.window_create
+#define wl_egl_window_destroy _glfw.wl.egl.window_destroy
+#define wl_egl_window_resize _glfw.wl.egl.window_resize
+
 typedef struct xkb_context* (* PFN_xkb_context_new)(enum xkb_context_flags);
 typedef void (* PFN_xkb_context_unref)(struct xkb_context*);
 typedef struct xkb_keymap* (* PFN_xkb_keymap_new_from_string)(struct xkb_context*, const char*, enum xkb_keymap_format, enum xkb_keymap_compile_flags);
@@ -213,6 +220,14 @@
     _GLFWwindow*                pointerFocus;
     _GLFWwindow*                keyboardFocus;
 
+    struct {
+        void*                   handle;
+
+        PFN_wl_egl_window_create window_create;
+        PFN_wl_egl_window_destroy window_destroy;
+        PFN_wl_egl_window_resize window_resize;
+    } egl;
+
 } _GLFWlibraryWayland;
 
 // Wayland-specific per-monitor data
diff --git a/src/wl_window.c b/src/wl_window.c
index 476b1b0..a6af02c 100644
--- a/src/wl_window.c
+++ b/src/wl_window.c
@@ -37,7 +37,6 @@
 #include <sys/mman.h>
 #include <poll.h>
 
-#include <wayland-egl.h>
 #include <wayland-cursor.h>