summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2024-01-04 12:07:43 +0200
committerEfraim Flashner <efraim@flashner.co.il>2024-02-20 13:57:22 +0200
commitda745dca5940bebaf9eb0fcfbed6399d8ec0f81d (patch)
treee27688c0eab7ca01a8ea680d3f98ec55a657309c /gnu
parentef26d36b5f0ce02608efefdf032d173360501319 (diff)
downloadguix-da745dca5940bebaf9eb0fcfbed6399d8ec0f81d.tar.gz
gnu: Add rust-winit-test-0.1.
* gnu/packages/crates-graphics.scm (rust-winit-test-0.1): New variable.

Change-Id: I1398fae41f18b8edf447a5532d1cc5e503fff2f8
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/crates-graphics.scm59
1 files changed, 59 insertions, 0 deletions
diff --git a/gnu/packages/crates-graphics.scm b/gnu/packages/crates-graphics.scm
index 30f5841e7a..fb29fff0be 100644
--- a/gnu/packages/crates-graphics.scm
+++ b/gnu/packages/crates-graphics.scm
@@ -4871,6 +4871,65 @@ the platform-specific getters provided by winit, or another library.")
         ("rust-winapi" ,rust-winapi-0.3)
         ("rust-x11-dl" ,rust-x11-dl-2))))))
 
+(define-public rust-winit-test-0.1
+  (package
+    (name "rust-winit-test")
+    (version "0.1.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "winit-test" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "1czdg3zvwazng2gwlda1nb26hklk1qizz84h97bk9mv2jf52yjx3"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-inputs (("rust-owo-colors" ,rust-owo-colors-3)
+                       ("rust-wasm-bindgen-test" ,rust-wasm-bindgen-test-0.3)
+                       ("rust-web-time" ,rust-web-time-0.2)
+                       ("rust-winit" ,rust-winit-0.28))
+       #:cargo-development-inputs (("rust-winit" ,rust-winit-0.28))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'configure 'add-absolute-library-references
+           (lambda* (#:key inputs vendor-dir #:allow-other-keys)
+             (substitute* (find-files vendor-dir "\\.rs$")
+               (("libX11\\.so")
+                (search-input-file inputs "lib/libX11.so"))
+               (("libX11-xcb\\.so")
+                (search-input-file inputs "lib/libX11-xcb.so"))
+               ;; Lots of libraries from rust-x11-dl and others.
+               (("libX[[:alpha:]]*\\.so" all)
+                (search-input-file inputs (string-append "lib/" all))))))
+         (add-before 'check 'pre-check
+           (lambda* (#:key native-inputs inputs #:allow-other-keys)
+             ;; Tests do not expect XDG_RUNTIME_DIR to be empty.
+             (setenv "XDG_RUNTIME_DIR" "/tmp")
+
+             ;; Most tests require an X server.
+             (let ((xvfb (search-input-file (or native-inputs inputs)
+                                            "bin/Xvfb"))
+                   (display ":1"))
+               (setenv "DISPLAY" display)
+               (system (string-append xvfb " " display " &"))))))))
+    (inputs (list libx11
+                  libxcursor
+                  libxext
+                  libxft
+                  libxi
+                  libxinerama
+                  libxmu
+                  libxpresent
+                  libxrandr
+                  libxscrnsaver
+                  libxt
+                  libxtst))
+    (native-inputs (list xorg-server-for-tests))
+    (home-page "https://github.com/notgull/winit-test")
+    (synopsis "Run tests using the winit event loop")
+    (description "Run tests using the winit event loop.")
+    (license (list license:expat license:asl2.0 license:zlib))))
+
 (define-public rust-x11-2
   (package
     (name "rust-x11")