summary refs log tree commit diff
path: root/gnu/packages/gl.scm
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-09-26 10:39:42 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-09-26 11:30:51 -0400
commite5f27fdfb38562c19d3fa741d6f14596882b5062 (patch)
tree40c95b650a0547aaf3f6d717840af5390a367676 /gnu/packages/gl.scm
parentbf946ad591777469d88f4cbd72d2109818ed5033 (diff)
downloadguix-e5f27fdfb38562c19d3fa741d6f14596882b5062.tar.gz
gnu: glfw: Patch dlopen calls.
* gnu/packages/gl.scm (glfw) [arguments]: Add #:modules and #:phases argument.
[inputs]: New field.
Diffstat (limited to 'gnu/packages/gl.scm')
-rw-r--r--gnu/packages/gl.scm50
1 files changed, 44 insertions, 6 deletions
diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index b53b42a9ba..dfdc21abc6 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -12,7 +12,7 @@
 ;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
-;;; Copyright © 2020, 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2020, 2021, 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2020 Kei Kebreau <kkebreau@posteo.net>
 ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
 ;;; Copyright © 2021, 2022, 2023 John Kehayias <john.kehayias@protonmail.com>
@@ -883,12 +883,50 @@ OpenGL.")
                 "1kcrpl4d6b6h23ib5j9q670d9w3knd07whgbanbmwwhbcqnc9lmv"))))
     (build-system cmake-build-system)
     (arguments
-     '(#:tests? #f ; no test target
-       #:configure-flags '("-DBUILD_SHARED_LIBS=ON")))
-    (native-inputs
-     (list doxygen unzip))
+     (list
+      #:modules '((guix build cmake-build-system)
+                  (guix build utils)
+                  (ice-9 format))
+      #:tests? #f                       ;no test target
+      #:configure-flags #~(list "-DBUILD_SHARED_LIBS=ON")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-sonames
+            (lambda* (#:key inputs #:allow-other-keys)
+              (let-syntax ((patch-sonames
+                            (syntax-rules ()
+                              ((_ (file ...) soname ...)
+                               (substitute* (list file ...)
+                                 (((format #f "(~@{~a~^|~})" soname ...) lib)
+                                  (search-input-file
+                                   inputs (string-append
+                                           "lib/" lib))))))))
+                ;; Avoid looking in LD_LIBRARY_PATH for dlopen calls.
+                (patch-sonames ("src/egl_context.c"
+                                "src/glx_context.c"
+                                "src/vulkan.c"
+                                "src/wl_init.c"
+                                "src/x11_init.c")
+                               "libEGL.so.1"
+                               "libGL.so"
+                               "libGL.so.1"
+                               "libGLESv1_CM.so.1"
+                               "libGLESv2.so.2"
+                               "libvulkan.so.1"
+                               "libwayland-cursor.so.0"
+                               "libwayland-egl.so.1"
+                               "libxkbcommon.so.0"
+                               "libXxf86vm.so.1"
+                               "libXi.so.6"
+                               "libXrandr.so.2"
+                               "libXcursor.so.1"
+                               "libXinerama.so.1"
+                               "libX11-xcb.so.1"
+                               "libXrender.so.1")))))))
+    (native-inputs (list doxygen unzip))
+    (inputs (list libxkbcommon wayland vulkan-loader))
     (propagated-inputs
-     (list mesa ;included in public headers
+     (list mesa              ;included in public headers
            ;; These are in 'Requires.private' of 'glfw3.pc'.
            libx11
            libxrandr