aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-08-10 07:07:31 +0200
committerdec05eba <dec05eba@protonmail.com>2024-08-10 07:07:31 +0200
commit1de5e22423bee66769966f21a4c256a0011aba81 (patch)
tree0dbfff86ecf412d8e161806b20569538367390a5 /src
parentee6052d4e727e5197fd6cf5fb55b0fa5102145af (diff)
Make libglx optional (alpine doesn't have it)
Diffstat (limited to 'src')
-rw-r--r--src/gl.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/gl.c b/src/gl.c
index d905eb0..7c9a6bc 100644
--- a/src/gl.c
+++ b/src/gl.c
@@ -116,8 +116,11 @@ static int mgl_gl_load_glx(mgl_gl *self) {
{ NULL, NULL }
};
+ /* In some distros (alpine for example libGLX doesn't exist, but libGL can be used instead) */
+ void *library = self->glx_library ? self->glx_library : self->gl_library;
+
for(int i = 0; required_dlsym[i].func; ++i) {
- *required_dlsym[i].func = dlsym_print_fail(self->glx_library, required_dlsym[i].name, 1);
+ *required_dlsym[i].func = dlsym_print_fail(library, required_dlsym[i].name, 1);
if(!*required_dlsym[i].func)
return -1;
}
@@ -169,11 +172,6 @@ int mgl_gl_load(mgl_gl *self) {
}
self->glx_library = dlopen("libGLX.so.0", RTLD_LAZY);
- if(!self->glx_library) {
- fprintf(stderr, "mgl error:dlopen(\"%s\", RTLD_LAZY) failed\n", "libGLX.so.0");
- mgl_gl_unload(self);
- return -1;
- }
self->egl_library = dlopen("libEGL.so.1", RTLD_LAZY);
if(!self->egl_library) {