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.
This commit is contained in:
Marius Bakke 2020-11-27 20:51:13 +01:00
parent 1807632393
commit 3bbe2806bf
No known key found for this signature in database
GPG key ID: A2A06DF2A33A54FA

View file

@ -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 @@ (define-public alacritty
("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 @@ (define-public alacritty
(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)