diff --git a/0001-c-Try-loading-OpenGL-through-EGL-if-GLX-isn-t-availa.patch b/0001-c-Try-loading-OpenGL-through-EGL-if-GLX-isn-t-availa.patch new file mode 100644 index 000000000..0d72ae3a2 --- /dev/null +++ b/0001-c-Try-loading-OpenGL-through-EGL-if-GLX-isn-t-availa.patch @@ -0,0 +1,51 @@ +From d36f1aa88eade4f578df88d47ff677ba8630a9fc Mon Sep 17 00:00:00 2001 +From: Yao Zi +Date: Mon, 23 Mar 2026 10:05:30 +0000 +Subject: [PATCH] c: Try loading OpenGL through EGL if GLX isn't available + +On a UNIX system without X11 libraries, it's impossible to have libGL.so +and glXGetProcAddressARB(). Currently GLAD would fail to load GL symbols +in this case. + +Try also loading libEGL.so/libEGL.so.1 in OpenGL loader and fallback to +eglGetProcAddress() to query GL symbols if glXGetProcAddressARB() isn't +available. + +Since EGL version 1.5 released in 2014, it's required for +eglGetProcAddress() to be able to query all client API functions instead +of only extensions, which is quite early for a Wayland-only display +stack, thus no function check or another fallback logic is added. + +Signed-off-by: Yao Zi +--- + glad/generator/c/templates/loader/gl.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/glad/generator/c/templates/loader/gl.c b/glad/generator/c/templates/loader/gl.c +index 5d0b9cb96f53..dfc97d43942e 100644 +--- a/glad/generator/c/templates/loader/gl.c ++++ b/glad/generator/c/templates/loader/gl.c +@@ -44,7 +44,9 @@ static void* glad_gl_dlopen_handle({{ template_utils.context_arg(def='void') }}) + "libGL-1.so", + #endif + "libGL.so.1", +- "libGL.so" ++ "libGL.so", ++ "libEGL.so.1", ++ "libEGL.so" + }; + #endif + +@@ -67,6 +69,9 @@ static struct _glad_gl_userptr glad_gl_build_userptr(void *handle) { + #else + userptr.gl_get_proc_address_ptr = + (GLADglprocaddrfunc) glad_dlsym_handle(handle, "glXGetProcAddressARB"); ++ if (!userptr.gl_get_proc_address_ptr) ++ userptr.gl_get_proc_address_ptr = ++ (GLADglprocaddrfunc) glad_dlsym_handle(handle, "eglGetProcAddress"); + #endif + + return userptr; +-- +2.53.0 + diff --git a/PKGBUILD b/PKGBUILD index 28381e77a..2443461a8 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -2,15 +2,25 @@ pkgname=glad pkgver=2.0.8 -pkgrel=2 +pkgrel=3 pkgdesc='Multi-Language Vulkan/GL/GLES/EGL/GLX/WGL Loader-Generator based on the official specs' url='https://github.com/Dav1dde/glad' arch=('any') license=('MIT') depends=('python' 'python-jinja' 'python-lxml' 'python-setuptools') makedepends=('python-build' 'python-installer' 'python-wheel') -source=(${url}/archive/refs/tags/v${pkgver}/${pkgname}-${pkgver}.tar.gz) -sha512sums=('ec964d0080c9714803f0464492b237039d2bede805d21aa9e487f3bf910447fd6440eeca59f3795dc4d5dd3b3df35101714fa21ea19eb29f6a021864a2310acd') +# 0001: Under review, try to obtain GL symbols through EGL (eglGetProcAddress) +# when libGL.so isn't available, allowing GLAD to successfully load GL +# on Wayland-only systems like eweOS. +# https://github.com/Dav1dde/glad/pull/536 +source=(${url}/archive/refs/tags/v${pkgver}/${pkgname}-${pkgver}.tar.gz + 0001-c-Try-loading-OpenGL-through-EGL-if-GLX-isn-t-availa.patch) +sha512sums=('ec964d0080c9714803f0464492b237039d2bede805d21aa9e487f3bf910447fd6440eeca59f3795dc4d5dd3b3df35101714fa21ea19eb29f6a021864a2310acd' + '3aadad3df98fd8274578fa0f47fcf7323aeb742b7b797da2fdf0685ce922df3d16caa0c8a5e7c67e9169a15baa5923c6d94b2b5d3c04de3cfd8a6b21f220bcac') + +prepare() { + _patch_ ${pkgname}-${pkgver} +} build() { cd ${pkgname}-${pkgver}