Add default EGL/GL library paths for Cocoa-less macOS builds. Without SDL_VIDEO_DRIVER_COCOA the default-library chain falls through to the desktop-Linux branch (libEGL.so.1 etc.), which dlopen() can never find on macOS. Point the defaults at the MacPorts Mesa dylibs; @PREFIX@ is substituted in post-patch. The SDL_VIDEO_DRIVER_COCOA (ANGLE) branch above still takes precedence when Cocoa is enabled. Every branch must define DEFAULT_EGL and all three DEFAULT_OGL_ES* macros - their use sites are not ifdef-guarded; only DEFAULT_OGL/ALT_OGL are optional. The ES_PVR name is a second-chance fallback tried after DEFAULT_OGL_ES fails, so it simply repeats the GLESv1 path here. --- src/video/SDL_egl.c +++ src/video/SDL_egl.c @@ -95,6 +95,14 @@ #define DEFAULT_OGL_ES_PVR "libGLES_CM.dylib" //??? #define DEFAULT_OGL_ES "libGLESv1_CM.dylib" //??? +#elif defined(SDL_PLATFORM_MACOS) +// Mesa EGL and GL(ES) dylibs from MacPorts (Cocoa-less X11 + Wayland builds) +#define DEFAULT_OGL "@PREFIX@/lib/libGL.1.dylib" +#define DEFAULT_EGL "@PREFIX@/lib/libEGL.1.dylib" +#define DEFAULT_OGL_ES2 "@PREFIX@/lib/libGLESv2.2.dylib" +#define DEFAULT_OGL_ES_PVR "@PREFIX@/lib/libGLESv1_CM.1.dylib" +#define DEFAULT_OGL_ES "@PREFIX@/lib/libGLESv1_CM.1.dylib" + #elif defined(SDL_PLATFORM_OPENBSD) // OpenBSD #define DEFAULT_OGL "libGL.so"