From 2d98244c9da7ce23f6c342239c9ff904f664a088 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Mon, 15 May 2023 13:00:53 +0300 Subject: gnu: alacritty: Update how we patch libraries. * gnu/packages/terminals.scm (alacritty)[arguments]: Rewrite the 'add-absolute-library-references phase to search all of the rust sources and patch the necessary libraries. --- gnu/packages/terminals.scm | 55 ++++++++++++++++++---------------------------- 1 file changed, 21 insertions(+), 34 deletions(-) (limited to 'gnu/packages') diff --git a/gnu/packages/terminals.scm b/gnu/packages/terminals.scm index 570de2259e..f76351b17f 100644 --- a/gnu/packages/terminals.scm +++ b/gnu/packages/terminals.scm @@ -1435,8 +1435,6 @@ basic input/output.") ("rust-embed-resource" ,rust-embed-resource-1) ("rust-fnv" ,rust-fnv-1) ("rust-gl-generator" ,rust-gl-generator-0.14) - ;; XXX: Adjust `add-absolute-library-references' phase when updating - ;; glutin input. ("rust-glutin" ,rust-glutin-0.30) ("rust-libc" ,rust-libc-0.2) ("rust-log" ,rust-log-0.4) @@ -1464,39 +1462,28 @@ basic input/output.") (substitute* "alacritty/src/config/ui_config.rs" (("xdg-open") (search-input-file inputs "/bin/xdg-open"))))) (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.30)) - (glutin-version ,(package-version rust-glutin-0.30)) - (glutin-api (string-append glutin-name "-" glutin-version - ".tar.gz/src/api/")) - (smithay-client-toolkit-name - ,(package-name rust-smithay-client-toolkit-0.16)) - (smithay-client-toolkit-version - ,(package-version rust-smithay-client-toolkit-0.16)) - (smithay-client-toolkit-src - (string-append smithay-client-toolkit-name "-" - smithay-client-toolkit-version ".tar.gz/src")) - (libxkbcommon (assoc-ref inputs "libxkbcommon")) - (mesa (assoc-ref inputs "mesa"))) - ;; Fix dlopen()ing some libraries on pure Wayland (no $DISPLAY): - ;; Failed to initialize any backend! Wayland status: NoWaylandLib - ;; XXX We patch transitive dependencies that aren't even direct - ;; inputs to this package, because of the way Guix's Rust build - ;; system currently works. - ;; might fix this and allow patching them directly. - (substitute* (string-append vendor-dir "/" - smithay-client-toolkit-src - "/seat/keyboard/ffi.rs") - (("libxkbcommon\\.so") - (string-append libxkbcommon "/lib/libxkbcommon.so"))) + (lambda* (#:key inputs vendor-dir #:allow-other-keys) + ;; Fix dlopen()ing some libraries on pure Wayland (no $DISPLAY): + ;; Failed to initialize any backend! Wayland status: NoWaylandLib + ;; XXX We patch transitive dependencies that aren't even direct + ;; inputs to this package, because of the way Guix's Rust build + ;; system currently works. + ;; might fix this and allow patching them directly. + (substitute* (find-files vendor-dir "\\.rs$") + (("libEGL\\.so") + (search-input-file inputs "lib/libEGL.so")) + (("libGL\\.so") + (search-input-file inputs "lib/libGL.so")) + ;; Lots of libraries from rust-x11-dl. + ;; XXX: Not all X11 libraries are inside the build enclosure. + ;(("libX.*\\.so" all) + ; (search-input-file inputs (string-append "lib/" all))) - ;; Mesa is needed everywhere. - (substitute* - (string-append vendor-dir "/" glutin-api "glx/mod.rs") - (("libGL.so") (string-append mesa "/lib/libGL.so"))) - (substitute* - (string-append vendor-dir "/" glutin-api "egl/mod.rs") - (("libEGL.so") (string-append mesa "/lib/libEGL.so")))))) + ;; There are several libwayland libraries. + (("libwayland-.*\\.so" all) + (search-input-file inputs (string-append "lib/" all))) + (("libxkbcommon\\.so") + (search-input-file inputs "lib/libxkbcommon.so"))))) (replace 'install ;; Upstream install script only takes care of executable. (lambda* (#:key inputs outputs #:allow-other-keys) -- cgit v1.2.3