From d78b0a4ead17e30182761b38dbbdfb88b037287b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 23 Feb 2022 18:47:30 +0100 Subject: [PATCH] X11: Fix sonames for loaded libraries on NetBSD The NetBSD sonames for X11 and related libraries is more stable than on OpenBSD but the version numbers are still bumped more often than their Linux counterparts, even excluding the one-time version bump across all X11 related libraries. This commit moves to using version-less sonames for X11 and related libraries on NetBSD, which will hopefully be more forward-compatible than hard-coding NetBSD-specific sonames. This may not be the correct long-term solution but it runs now. Binaries also appear to need an LD_LIBRARY_PATH or rpath entry of /usr/X11R7/lib in order for the libraries to be found by dlopen. Tested on NetBSD 9.2. --- README.md | 1 + src/egl_context.c | 8 ++++---- src/glx_context.c | 2 +- src/osmesa_context.c | 2 +- src/vulkan.c | 2 +- src/x11_init.c | 18 +++++++++--------- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index bb9cbf19..8c597048 100644 --- a/README.md +++ b/README.md @@ -274,6 +274,7 @@ information on what to include when reporting a bug. - [X11] Bugfix: `glfwWaitEvents*` did not continue for joystick events - [X11] Bugfix: `glfwPostEmptyEvent` could be ignored due to race condition (#379,#1281,#1285,#2033) + - [X11] Bugfix: Dynamic loading on NetBSD failed due to soname differences - [Wayland] Added dynamic loading of all Wayland libraries - [Wayland] Added support for key names via xkbcommon - [Wayland] Removed support for `wl_shell` (#1443) diff --git a/src/egl_context.c b/src/egl_context.c index 963a59d6..f8850fa2 100644 --- a/src/egl_context.c +++ b/src/egl_context.c @@ -325,7 +325,7 @@ GLFWbool _glfwInitEGL(void) "libEGL.dylib", #elif defined(__CYGWIN__) "libEGL-1.so", -#elif defined(__OpenBSD__) +#elif defined(__OpenBSD__) || defined(__NetBSD__) "libEGL.so", #else "libEGL.so.1", @@ -702,7 +702,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, "libGLES_CM.dll", #elif defined(_GLFW_COCOA) "libGLESv1_CM.dylib", -#elif defined(__OpenBSD__) +#elif defined(__OpenBSD__) || defined(__NetBSD__) "libGLESv1_CM.so", #else "libGLESv1_CM.so.1", @@ -721,7 +721,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, "libGLESv2.dylib", #elif defined(__CYGWIN__) "libGLESv2-2.so", -#elif defined(__OpenBSD__) +#elif defined(__OpenBSD__) || defined(__NetBSD__) "libGLESv2.so", #else "libGLESv2.so.2", @@ -734,7 +734,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, _GLFW_OPENGL_LIBRARY, #elif defined(_GLFW_WIN32) #elif defined(_GLFW_COCOA) -#elif defined(__OpenBSD__) +#elif defined(__OpenBSD__) || defined(__NetBSD__) "libGL.so", #else "libGL.so.1", diff --git a/src/glx_context.c b/src/glx_context.c index ced9c88f..872612d1 100644 --- a/src/glx_context.c +++ b/src/glx_context.c @@ -259,7 +259,7 @@ GLFWbool _glfwInitGLX(void) _GLFW_GLX_LIBRARY, #elif defined(__CYGWIN__) "libGL-1.so", -#elif defined(__OpenBSD__) +#elif defined(__OpenBSD__) || defined(__NetBSD__) "libGL.so", #else "libGL.so.1", diff --git a/src/osmesa_context.c b/src/osmesa_context.c index 43ade8dc..38adabbc 100644 --- a/src/osmesa_context.c +++ b/src/osmesa_context.c @@ -124,7 +124,7 @@ GLFWbool _glfwInitOSMesa(void) "libOSMesa.8.dylib", #elif defined(__CYGWIN__) "libOSMesa-8.so", -#elif defined(__OpenBSD__) +#elif defined(__OpenBSD__) || defined(__NetBSD__) "libOSMesa.so", #else "libOSMesa.so.8", diff --git a/src/vulkan.c b/src/vulkan.c index f02b1ede..64a4650f 100644 --- a/src/vulkan.c +++ b/src/vulkan.c @@ -63,7 +63,7 @@ GLFWbool _glfwInitVulkan(int mode) _glfw.vk.handle = _glfwPlatformLoadModule("libvulkan.1.dylib"); if (!_glfw.vk.handle) _glfw.vk.handle = _glfwLoadLocalVulkanLoaderCocoa(); -#elif defined(__OpenBSD__) +#elif defined(__OpenBSD__) || defined(__NetBSD__) _glfw.vk.handle = _glfwPlatformLoadModule("libvulkan.so"); #else _glfw.vk.handle = _glfwPlatformLoadModule("libvulkan.so.1"); diff --git a/src/x11_init.c b/src/x11_init.c index 203828fc..78735d69 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -603,7 +603,7 @@ static void detectEWMH(void) // static GLFWbool initExtensions(void) { -#if defined(__OpenBSD__) +#if defined(__OpenBSD__) || defined(__NetBSD__) _glfw.x11.vidmode.handle = _glfwPlatformLoadModule("libXxf86vm.so"); #else _glfw.x11.vidmode.handle = _glfwPlatformLoadModule("libXxf86vm.so.1"); @@ -627,7 +627,7 @@ static GLFWbool initExtensions(void) #if defined(__CYGWIN__) _glfw.x11.xi.handle = _glfwPlatformLoadModule("libXi-6.so"); -#elif defined(__OpenBSD__) +#elif defined(__OpenBSD__) || defined(__NetBSD__) _glfw.x11.xi.handle = _glfwPlatformLoadModule("libXi.so"); #else _glfw.x11.xi.handle = _glfwPlatformLoadModule("libXi.so.6"); @@ -659,7 +659,7 @@ static GLFWbool initExtensions(void) #if defined(__CYGWIN__) _glfw.x11.randr.handle = _glfwPlatformLoadModule("libXrandr-2.so"); -#elif defined(__OpenBSD__) +#elif defined(__OpenBSD__) || defined(__NetBSD__) _glfw.x11.randr.handle = _glfwPlatformLoadModule("libXrandr.so"); #else _glfw.x11.randr.handle = _glfwPlatformLoadModule("libXrandr.so.2"); @@ -753,7 +753,7 @@ static GLFWbool initExtensions(void) #if defined(__CYGWIN__) _glfw.x11.xcursor.handle = _glfwPlatformLoadModule("libXcursor-1.so"); -#elif defined(__OpenBSD__) +#elif defined(__OpenBSD__) || defined(__NetBSD__) _glfw.x11.xcursor.handle = _glfwPlatformLoadModule("libXcursor.so"); #else _glfw.x11.xcursor.handle = _glfwPlatformLoadModule("libXcursor.so.1"); @@ -776,7 +776,7 @@ static GLFWbool initExtensions(void) #if defined(__CYGWIN__) _glfw.x11.xinerama.handle = _glfwPlatformLoadModule("libXinerama-1.so"); -#elif defined(__OpenBSD__) +#elif defined(__OpenBSD__) || defined(__NetBSD__) _glfw.x11.xinerama.handle = _glfwPlatformLoadModule("libXinerama.so"); #else _glfw.x11.xinerama.handle = _glfwPlatformLoadModule("libXinerama.so.1"); @@ -831,7 +831,7 @@ static GLFWbool initExtensions(void) { #if defined(__CYGWIN__) _glfw.x11.x11xcb.handle = _glfwPlatformLoadModule("libX11-xcb-1.so"); -#elif defined(__OpenBSD__) +#elif defined(__OpenBSD__) || defined(__NetBSD__) _glfw.x11.x11xcb.handle = _glfwPlatformLoadModule("libX11-xcb.so"); #else _glfw.x11.x11xcb.handle = _glfwPlatformLoadModule("libX11-xcb.so.1"); @@ -846,7 +846,7 @@ static GLFWbool initExtensions(void) #if defined(__CYGWIN__) _glfw.x11.xrender.handle = _glfwPlatformLoadModule("libXrender-1.so"); -#elif defined(__OpenBSD__) +#elif defined(__OpenBSD__) || defined(__NetBSD__) _glfw.x11.xrender.handle = _glfwPlatformLoadModule("libXrender.so"); #else _glfw.x11.xrender.handle = _glfwPlatformLoadModule("libXrender.so.1"); @@ -875,7 +875,7 @@ static GLFWbool initExtensions(void) #if defined(__CYGWIN__) _glfw.x11.xshape.handle = _glfwPlatformLoadModule("libXext-6.so"); -#elif defined(__OpenBSD__) +#elif defined(__OpenBSD__) || defined(__NetBSD__) _glfw.x11.xshape.handle = _glfwPlatformLoadModule("libXext.so"); #else _glfw.x11.xshape.handle = _glfwPlatformLoadModule("libXext.so.6"); @@ -1254,7 +1254,7 @@ GLFWbool _glfwConnectX11(int platformID, _GLFWplatform* platform) #if defined(__CYGWIN__) void* module = _glfwPlatformLoadModule("libX11-6.so"); -#elif defined(__OpenBSD__) +#elif defined(__OpenBSD__) || defined(__NetBSD__) void* module = _glfwPlatformLoadModule("libX11.so"); #else void* module = _glfwPlatformLoadModule("libX11.so.6");