From 8709f67ebcc26dd6da61373162b8b96cd54b6896 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 8 Sep 2020 08:42:30 -0700 Subject: [PATCH] Fixed bug 5215 - Fixing filenames passed to dlopen for OpenBSD Brad Smith Attached is a patch to use the proper filenames when trying to dlopen the respective shared libraries on OpenBSD. --- src/video/SDL_egl.c | 7 +++++++ src/video/wayland/SDL_waylandvulkan.c | 8 +++++++- src/video/x11/SDL_x11vulkan.c | 9 ++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c index 1a2e838c8..ba5a758ed 100644 --- a/src/video/SDL_egl.c +++ b/src/video/SDL_egl.c @@ -72,6 +72,13 @@ #define DEFAULT_OGL_ES_PVR "libGLES_CM.dylib" //??? #define DEFAULT_OGL_ES "libGLESv1_CM.dylib" //??? +#elif defined(__OpenBSD__) +#define DEFAULT_OGL "libGL.so" +#define DEFAULT_EGL "libEGL.so" +#define DEFAULT_OGL_ES2 "libGLESv2.so" +#define DEFAULT_OGL_ES_PVR "libGLES_CM.so" +#define DEFAULT_OGL_ES "libGLESv1_CM.so" + #else /* Desktop Linux */ #define DEFAULT_OGL "libGL.so.1" diff --git a/src/video/wayland/SDL_waylandvulkan.c b/src/video/wayland/SDL_waylandvulkan.c index aa5e23f6b..26c11045d 100644 --- a/src/video/wayland/SDL_waylandvulkan.c +++ b/src/video/wayland/SDL_waylandvulkan.c @@ -36,6 +36,12 @@ #include "SDL_waylandvulkan.h" #include "SDL_syswm.h" +#if defined(__OpenBSD__) +#define DEFAULT_VULKAN "libvulkan.so" +#else +#define DEFAULT_VULKAN "libvulkan.so.1" +#endif + int Wayland_Vulkan_LoadLibrary(_THIS, const char *path) { VkExtensionProperties *extensions = NULL; @@ -50,7 +56,7 @@ int Wayland_Vulkan_LoadLibrary(_THIS, const char *path) if(!path) path = SDL_getenv("SDL_VULKAN_LIBRARY"); if(!path) - path = "libvulkan.so.1"; + path = DEFAULT_VULKAN; _this->vulkan_config.loader_handle = SDL_LoadObject(path); if(!_this->vulkan_config.loader_handle) return -1; diff --git a/src/video/x11/SDL_x11vulkan.c b/src/video/x11/SDL_x11vulkan.c index 24819cc43..2ca8ce85f 100644 --- a/src/video/x11/SDL_x11vulkan.c +++ b/src/video/x11/SDL_x11vulkan.c @@ -30,6 +30,13 @@ #include /*#include */ + +#if defined(__OpenBSD__) +#define DEFAULT_VULKAN "libvulkan.so" +#else +#define DEFAULT_VULKAN "libvulkan.so.1" +#endif + /* typedef uint32_t xcb_window_t; typedef uint32_t xcb_visualid_t; @@ -52,7 +59,7 @@ int X11_Vulkan_LoadLibrary(_THIS, const char *path) if(!path) path = SDL_getenv("SDL_VULKAN_LIBRARY"); if(!path) - path = "libvulkan.so.1"; + path = DEFAULT_VULKAN; _this->vulkan_config.loader_handle = SDL_LoadObject(path); if(!_this->vulkan_config.loader_handle) return -1;