Subject: [PATCH rust-team 36/37] gnu: Add rust-gilrs-core-0.5.

From: Herman Rimm <[email-masked]>
Date: Thu, 14 Mar 2024 22:16:37 +0100

* gnu/packages/crates-io.scm (rust-gilrs-core-0.5): Add variable.
* gnu/packages/patches/rust-gilrs-core-unix-only.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register file.

Change-Id: I791d20d9d83f0d7ff6569b3d82314a72e4656a30
---
 gnu/local.mk                                  |  1 +
 gnu/packages/crates-io.scm                    | 37 ++++++++++++
 .../patches/rust-gilrs-core-unix-only.patch   | 57 +++++++++++++++++++
 3 files changed, 95 insertions(+)
 create mode 100644 gnu/packages/patches/rust-gilrs-core-unix-only.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 2f9fdb675c..78d104ff08 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2010,6 +2010,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/rust-arboard-3-unix-only.patch		\
   %D%/packages/patches/rust-cargo-edit-remove-ureq.patch	\
   %D%/packages/patches/rust-eframe-unix-only.patch		\
+  %D%/packages/patches/rust-gilrs-core-unix-only.patch		\
   %D%/packages/patches/rust-ring-0.17-ring-core.patch		\
   %D%/packages/patches/rust-ndarray-remove-blas-src-dep.patch	\
   %D%/packages/patches/rust-ndarray-0.13-remove-blas-src.patch	\
diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index bfbc5f63e6..930b61a4a8 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -27208,6 +27208,43 @@ (define-public rust-ghost-0.1
     ;; Either license can be chosen at the users option.
     (license (list license:expat license:asl2.0))))
 
+(define-public rust-gilrs-core-0.5
+  (package
+    (name "rust-gilrs-core")
+    (version "0.5.10")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "gilrs-core" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "0nlc1qx1819hi28zyqgv6cjw2r0dxarw217819s6vwyjgmxq5w8a"))
+       (patches (search-patches "rust-gilrs-core-unix-only.patch"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-inputs (("rust-inotify" ,rust-inotify-0.10)
+                       ("rust-js-sys" ,rust-js-sys-0.3)
+                       ("rust-libc" ,rust-libc-0.2)
+                       ("rust-libudev-sys" ,rust-libudev-sys-0.1)
+                       ("rust-log" ,rust-log-0.4)
+                       ("rust-nix" ,rust-nix-0.27)
+                       ("rust-serde" ,rust-serde-1)
+                       ("rust-uuid" ,rust-uuid-1)
+                       ("rust-vec-map" ,rust-vec-map-0.8)
+                       ("rust-wasm-bindgen" ,rust-wasm-bindgen-0.2)
+                       ("rust-web-sys" ,rust-web-sys-0.3)
+                       ("rust-windows" ,rust-windows-0.44))
+       #:cargo-development-inputs
+       (("rust-env-logger" ,rust-env-logger-0.10))))
+    (native-inputs (list pkg-config))
+    (inputs (list eudev))
+    (home-page "https://gitlab.com/gilrs-project/gilrs")
+    (synopsis "Event based abstraction for working with gamepads")
+    (description
+      "This package provides a minimal event based abstraction for
+working with gamepads.")
+    (license (list license:asl2.0 license:expat))))
+
 (define-public rust-gimli-0.27
   (package
     (name "rust-gimli")
diff --git a/gnu/packages/patches/rust-gilrs-core-unix-only.patch b/gnu/packages/patches/rust-gilrs-core-unix-only.patch
new file mode 100644
index 0000000000..767693f4e3
--- /dev/null
+++ b/gnu/packages/patches/rust-gilrs-core-unix-only.patch
@@ -0,0 +1,57 @@
+diff --git a/Cargo.toml b/Cargo.toml
+index 4065497..d5ac0cf 100644
+--- a/Cargo.toml
++++ b/Cargo.toml
+@@ -48,10 +48,6 @@ version = "0.10.0"
+ default = ["wgi"]
+ serde-serialize = ["serde"]
+ wgi = ["windows"]
+-xinput = [
+-    "rusty-xinput",
+-    "winapi",
+-]
+ 
+ [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\"))".dependencies.inotify]
+ version = "0.10.2"
+@@ -74,41 +70,6 @@ default-features = false
+ [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\"))".dependencies.vec_map]
+ version = "0.8"
+ 
+-[target."cfg(target_arch = \"wasm32\")".dependencies.js-sys]
+-version = "0.3"
+-
+-[target."cfg(target_arch = \"wasm32\")".dependencies.wasm-bindgen]
+-version = "0.2"
+-
+-[target."cfg(target_arch = \"wasm32\")".dependencies.web-sys]
+-version = "0.3"
+-features = [
+-    "Gamepad",
+-    "GamepadButton",
+-    "GamepadMappingType",
+-    "Window",
+-    "Navigator",
+-    "DomException",
+-]
+-
+-[target."cfg(target_os = \"macos\")".dependencies.core-foundation]
+-version = "0.9.3"
+-
+-[target."cfg(target_os = \"macos\")".dependencies.io-kit-sys]
+-version = "0.4.0"
+-
+-[target."cfg(target_os = \"macos\")".dependencies.vec_map]
+-version = "0.8"
+-
+-[target."cfg(target_os = \"windows\")".dependencies.rusty-xinput]
+-version = "1.2.0"
+-optional = true
+-
+-[target."cfg(target_os = \"windows\")".dependencies.winapi]
+-version = "0.3.4"
+-features = ["xinput"]
+-optional = true
+-
+ [target."cfg(target_os = \"windows\")".dependencies.windows]
+ version = ">=0.44, <=0.52"
+ features = [
-- 
2.41.0