summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2020-11-27 20:51:13 +0100
committerMarius Bakke <marius@gnu.org>2020-11-27 21:33:59 +0100
commit3bbe2806bf11f6e95be42b1a21d79bd557f68d0b (patch)
tree3d1aa570c3230ac9d8d55f7f9ea008007210fe39
parent1807632393d0723f3085c457517965c32715717a (diff)
downloadguix-3bbe2806bf11f6e95be42b1a21d79bd557f68d0b.tar.gz
gnu: alacritty: Embed absolute references to required libraries.
* gnu/packages/terminals.scm (alacritty)[arguments]: Rename phase
"patch-glutin-libgl-path" to "add-absolute-library-references".  Patch in
absolute references to LIBXKBCOMMON and WAYLAND libraries.  Remove
LD_LIBRARY_PATH wrapper.
-rw-r--r--gnu/packages/terminals.scm56
1 files changed, 42 insertions, 14 deletions
diff --git a/gnu/packages/terminals.scm b/gnu/packages/terminals.scm
index c9d57bee67..f6ad90024b 100644
--- a/gnu/packages/terminals.scm
+++ b/gnu/packages/terminals.scm
@@ -20,6 +20,7 @@
 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
 ;;; Copyright © 2020 Valentin Ignatev <valentignatev@gmail.com>
 ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
+;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1223,18 +1224,52 @@ made by suckless.")
         ("rust-winapi" ,rust-winapi-0.3))
        #:phases
        (modify-phases %standard-phases
-         (add-after 'configure 'patch-glutin-libgl-path
+         (add-after 'configure 'add-absolute-library-references
            (lambda* (#:key inputs cargo-inputs vendor-dir #:allow-other-keys)
              (let* ((glutin-name ,(package-name rust-glutin-0.22))
                     (glutin-version ,(package-version rust-glutin-0.22))
-                    (src-api
-                      (string-append
-                        glutin-name "-" glutin-version ".tar.gz/src/api/"))
+                    (glutin-api (string-append glutin-name "-" glutin-version
+                                               ".tar.gz/src/api/"))
+                    (smithay-client-toolkit-name
+                     ,(package-name rust-smithay-client-toolkit-0.6))
+                    (smithay-client-toolkit-version
+                     ,(package-version rust-smithay-client-toolkit-0.6))
+                    (smithay-client-toolkit-src
+                     (string-append smithay-client-toolkit-name "-"
+                                    smithay-client-toolkit-version ".tar.gz/src"))
+                    (wayland-sys-name ,(package-name rust-wayland-sys-0.23))
+                    (wayland-sys-version ,(package-version rust-wayland-sys-0.23))
+                    (wayland-sys-src (string-append wayland-sys-name "-"
+                                                    wayland-sys-version
+                                                    ".tar.gz/src"))
+                    (libxkbcommon (assoc-ref inputs "libxkbcommon"))
+                    (libwayland (assoc-ref inputs "wayland"))
                     (mesa (assoc-ref inputs "mesa")))
-              (substitute* (string-append vendor-dir "/" src-api "glx/mod.rs")
+              (substitute* (string-append vendor-dir "/" glutin-api "glx/mod.rs")
                 (("libGL.so") (string-append mesa "/lib/libGL.so")))
-              (substitute* (string-append vendor-dir "/" src-api "egl/mod.rs")
+              (substitute* (string-append vendor-dir "/" glutin-api "egl/mod.rs")
                 (("libEGL.so") (string-append mesa "/lib/libEGL.so")))
+              (substitute* (string-append vendor-dir "/"
+                                          smithay-client-toolkit-src
+                                          "/keyboard/ffi.rs")
+                (("libxkbcommon\\.so")
+                 (string-append libxkbcommon "/lib/libxkbcommon.so")))
+              (substitute* (string-append vendor-dir "/" wayland-sys-src
+                                          "/server.rs")
+                (("libwayland-server\\.so")
+                 (string-append libwayland "/lib/libwayland-server.so")))
+              (substitute* (string-append vendor-dir "/" wayland-sys-src
+                                          "/cursor.rs")
+                (("libwayland-cursor\\.so")
+                 (string-append libwayland "/lib/libwayland-cursor.so")))
+              (substitute* (string-append vendor-dir "/" wayland-sys-src
+                                          "/egl.rs")
+                (("libwayland-egl\\.so")
+                 (string-append libwayland "/lib/libwayland-egl.so")))
+              (substitute* (string-append vendor-dir "/" wayland-sys-src
+                                          "/client.rs")
+                (("libwayland-client\\.so")
+                 (string-append libwayland "/lib/libwayland-client.so")))
               #t)))
          (add-after 'configure 'remove-alacritty-vendor
            (lambda* (#:key vendor-dir #:allow-other-keys)
@@ -1254,15 +1289,8 @@ made by suckless.")
                     (man   (string-append share "/man/man1"))
                     (alacritty-bin "target/release/alacritty"))
 
-               ;; Install and wrap the binary.
+               ;; Install the executable.
                (install-file alacritty-bin bin)
-               (wrap-program (string-append bin "/alacritty")
-                 ;; Both libraries are dlopen()d by cargo dependencies above
-                 ;; when running Alacritty on pure Wayland.
-                 ;; XXX Find out how to patch these at the source.
-                 `("LD_LIBRARY_PATH" ":" prefix
-                   (,(string-append (assoc-ref inputs "libxkbcommon") "/lib:"
-                                    (assoc-ref inputs "wayland") "/lib"))))
 
                ;; Install man pages.
                (mkdir-p man)