1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/pkgs/development/libraries/epoxy/libgl-path.patch
Alexander V. Nikolaev 867d387a1c epoxy: 1.5.1 -> 1.5.2 (#47178)
libgl-path.patch was updated (it applied with little fuzz, because I am
a bit lazy, and rebase it on master of epoxy, not 1.5.2)
2018-09-25 11:50:51 +02:00

25 lines
919 B
Diff

diff --git a/src/dispatch_common.c b/src/dispatch_common.c
index b3e4f5f..303e8f5 100644
--- a/src/dispatch_common.c
+++ b/src/dispatch_common.c
@@ -310,6 +310,19 @@ get_dlopen_handle(void **handle, const char *lib_name, bool exit_on_fail, bool l
flags |= RTLD_NOLOAD;
*handle = dlopen(lib_name, flags);
+#ifdef LIBGL_PATH
+ if (!*handle) {
+ char pathbuf[sizeof(LIBGL_PATH) + 1 + 1024 + 1];
+ int l = snprintf(pathbuf, sizeof(pathbuf), "%s/%s", LIBGL_PATH, lib_name);
+ if (l < 0 || l >= sizeof(pathbuf)) {
+ // This really shouldn't happen
+ fprintf(stderr, "Error prefixing library pathname\n");
+ exit(1);
+ }
+ *handle = dlopen(pathbuf, flags);
+ }
+#endif
+
if (!*handle) {
if (exit_on_fail) {
fprintf(stderr, "Couldn't open %s: %s\n", lib_name, dlerror());