Subject: [PATCH rust-team 19/37] gnu: Add rust-arboard-2.

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

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

Change-Id: I0ed9d713e3bcc2c60032513e04cd9ae985b3c387
---
 gnu/local.mk                                  |  1 +
 gnu/packages/crates-io.scm                    | 27 ++++++++++
 .../patches/rust-arboard-2-unix-only.patch    | 53 +++++++++++++++++++
 3 files changed, 81 insertions(+)
 create mode 100644 gnu/packages/patches/rust-arboard-2-unix-only.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 731a4799b4..355889f1b7 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2006,6 +2006,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/rust-1.64-fix-riscv64-bootstrap.patch	\
   %D%/packages/patches/rust-1.70-fix-rustix-build.patch	\
   %D%/packages/patches/rust-accesskit-winit-unix-only.patch	\
+  %D%/packages/patches/rust-arboard-2-unix-only.patch		\
   %D%/packages/patches/rust-arboard-3-unix-only.patch		\
   %D%/packages/patches/rust-cargo-edit-remove-ureq.patch	\
   %D%/packages/patches/rust-ring-0.17-ring-core.patch		\
diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 90d7e17e3b..580209c281 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -2162,6 +2162,33 @@ (define-public rust-arboard-3
 clipboard.")
     (license (list license:expat license:asl2.0))))
 
+(define-public rust-arboard-2
+  (package
+    (inherit rust-arboard-3)
+    (name "rust-arboard")
+    (version "2.1.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "arboard" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "1fq8gqbvajjmxdbd65aygf9ramgpvq1bcxj8mxx6vv5ms5a064nw"))
+       (patches (search-patches "rust-arboard-2-unix-only.patch"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:tests? #f ; error while interacting with clipboard
+       #:cargo-inputs
+       (("rust-image" ,rust-image-0.23)
+        ("rust-log" ,rust-log-0.4)
+        ("rust-parking-lot" ,rust-parking-lot-0.12)
+        ("rust-thiserror" ,rust-thiserror-1)
+        ("rust-wl-clipboard-rs" ,rust-wl-clipboard-rs-0.4)
+        ("rust-x11rb" ,rust-x11rb-0.9))
+       #:cargo-development-inputs
+       (("rust-env-logger" ,rust-env-logger-0.9)
+        ("rust-simple-logger" ,rust-simple-logger-2))))))
+
 (define-public rust-arboard-1
   (package
     (inherit rust-arboard-3)
diff --git a/gnu/packages/patches/rust-arboard-2-unix-only.patch b/gnu/packages/patches/rust-arboard-2-unix-only.patch
new file mode 100644
index 0000000000..59141cdce9
--- /dev/null
+++ b/gnu/packages/patches/rust-arboard-2-unix-only.patch
@@ -0,0 +1,53 @@
+diff --git a/Cargo.toml b/Cargo.toml
+index 1d3f38d..7661aad 100644
+--- a/Cargo.toml
++++ b/Cargo.toml
+@@ -47,11 +47,7 @@ version = "2.1"
+ [features]
+ default = ["image-data"]
+ image-data = [
+-    "core-graphics",
+     "image",
+-    "winapi/minwindef",
+-    "winapi/wingdi",
+-    "winapi/winnt",
+ ]
+ wayland-data-control = ["wl-clipboard-rs"]
+ 
+@@ -73,36 +69,3 @@ optional = true
+ 
+ [target."cfg(all(unix, not(any(target_os=\"macos\", target_os=\"android\", target_os=\"emscripten\"))))".dependencies.x11rb]
+ version = "0.9"
+-
+-[target."cfg(target_os = \"macos\")".dependencies.core-graphics]
+-version = "0.22"
+-optional = true
+-
+-[target."cfg(target_os = \"macos\")".dependencies.image]
+-version = "0.23"
+-features = ["tiff"]
+-optional = true
+-default-features = false
+-
+-[target."cfg(target_os = \"macos\")".dependencies.objc]
+-version = "0.2"
+-
+-[target."cfg(target_os = \"macos\")".dependencies.objc-foundation]
+-version = "0.1"
+-
+-[target."cfg(target_os = \"macos\")".dependencies.objc_id]
+-version = "0.1"
+-
+-[target."cfg(windows)".dependencies.clipboard-win]
+-version = "4.2"
+-
+-[target."cfg(windows)".dependencies.log]
+-version = "0.4"
+-
+-[target."cfg(windows)".dependencies.winapi]
+-version = "0.3.9"
+-features = [
+-    "basetsd",
+-    "winuser",
+-    "winbase",
+-]
-- 
2.41.0