Subject: [bug#69803] [PATCH rust-team 33/37] gnu: Add rust-eframe-0.26.

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

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

Change-Id: I02104386c91baa2a1a563212af7ccf1507553077
---
 gnu/local.mk                                  |   1 +
 gnu/packages/crates-io.scm                    |  50 ++++++
 .../patches/rust-eframe-unix-only.patch       | 152 ++++++++++++++++++
 3 files changed, 203 insertions(+)
 create mode 100644 gnu/packages/patches/rust-eframe-unix-only.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 355889f1b7..2f9fdb675c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2009,6 +2009,7 @@ dist_patch_DATA =						\
   %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-eframe-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 489cde6da2..5ef4f76fe5 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -20711,6 +20711,56 @@ (define-public rust-editdistancek-1
      "This crate provides fast algorithm for computing edit distance.")
     (license license:expat)))
 
+(define-public rust-eframe-0.26
+  (package
+    (name "rust-eframe")
+    (version "0.26.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "eframe" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "0vzjpm6kmqnnyhsvm4gq7yi7033m7mq88x15h2vnigqkdnxw2mn4"))
+       (patches (search-patches "rust-eframe-unix-only.patch"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-inputs
+       (("rust-bytemuck" ,rust-bytemuck-1)
+        ("rust-directories-next" ,rust-directories-next-2)
+        ("rust-document-features" ,rust-document-features-0.2)
+        ("rust-egui" ,rust-egui-0.26)
+        ("rust-egui-winit" ,rust-egui-winit-0.26)
+        ("rust-egui-glow" ,rust-egui-glow-0.26)
+        ("rust-glow" ,rust-glow-0.13)
+        ("rust-glutin" ,rust-glutin-0.31)
+        ("rust-glutin-winit" ,rust-glutin-winit-0.4)
+        ("rust-image" ,rust-image-0.24)
+        ("rust-js-sys" ,rust-js-sys-0.3)
+        ("rust-log" ,rust-log-0.4)
+        ("rust-parking-lot" ,rust-parking-lot-0.12)
+        ("rust-percent-encoding" ,rust-percent-encoding-2)
+        ("rust-pollster" ,rust-pollster-0.3)
+        ("rust-puffin" ,rust-puffin-0.19)
+        ("rust-raw-window-handle" ,rust-raw-window-handle-0.6)
+        ("rust-raw-window-handle" ,rust-raw-window-handle-0.5)
+        ("rust-ron" ,rust-ron-0.8)
+        ("rust-serde" ,rust-serde-1)
+        ("rust-static-assertions" ,rust-static-assertions-1)
+        ("rust-thiserror" ,rust-thiserror-1)
+        ("rust-wasm-bindgen" ,rust-wasm-bindgen-0.2)
+        ("rust-wasm-bindgen-futures" ,rust-wasm-bindgen-futures-0.4)
+        ("rust-web-sys" ,rust-web-sys-0.3)
+        ("rust-web-time" ,rust-web-time-0.2)
+        ("rust-winapi" ,rust-winapi-0.3)
+        ("rust-winit" ,rust-winit-0.29))))
+    (home-page "https://github.com/emilk/egui/tree/master/crates/eframe")
+    (synopsis "Write GUI apps that compile natively and for web")
+    (description
+     "This package provides the egui framework: write GUI apps that
+compile to web and/or natively.")
+    (license (list license:expat license:asl2.0))))
+
 (define-public rust-ego-tree-0.6
   (package
     (name "rust-ego-tree")
diff --git a/gnu/packages/patches/rust-eframe-unix-only.patch b/gnu/packages/patches/rust-eframe-unix-only.patch
new file mode 100644
index 0000000000..656cbdd0a5
--- /dev/null
+++ b/gnu/packages/patches/rust-eframe-unix-only.patch
@@ -0,0 +1,152 @@
+diff --git a/Cargo.toml b/Cargo.toml
+index 0065f39..c0b3c13 100644
+--- a/Cargo.toml
++++ b/Cargo.toml
+@@ -115,7 +115,6 @@ default = [
+     "default_fonts",
+     "glow",
+     "wayland",
+-    "web_screen_reader",
+     "winit/default",
+     "x11",
+ ]
+@@ -139,49 +138,21 @@ puffin = [
+     "dep:puffin",
+     "egui/puffin",
+     "egui_glow?/puffin",
+-    "egui-wgpu?/puffin",
+     "egui-winit/puffin",
+ ]
+ wayland = [
+     "egui-winit/wayland",
+-    "egui-wgpu?/wayland",
+     "egui_glow?/wayland",
+ ]
+-web_screen_reader = [
+-    "web-sys/SpeechSynthesis",
+-    "web-sys/SpeechSynthesisUtterance",
+-]
+-wgpu = [
+-    "dep:wgpu",
+-    "dep:egui-wgpu",
+-    "dep:pollster",
+-]
+ x11 = [
+     "egui-winit/x11",
+-    "egui-wgpu?/x11",
+     "egui_glow?/x11",
+ ]
+ 
+-[target."cfg(any(target_os = \"macos\"))".dependencies.cocoa]
+-version = "0.25.0"
+-
+-[target."cfg(any(target_os = \"macos\"))".dependencies.objc]
+-version = "0.2.7"
+-
+-[target."cfg(any(target_os = \"windows\"))".dependencies.winapi]
+-version = "0.3.9"
+-features = ["winuser"]
+-
+ [target."cfg(not(target_arch = \"wasm32\"))".dependencies.directories-next]
+ version = "2"
+ optional = true
+ 
+-[target."cfg(not(target_arch = \"wasm32\"))".dependencies.egui-wgpu]
+-version = "0.26.2"
+-features = ["winit"]
+-optional = true
+-default-features = false
+-
+ [target."cfg(not(target_arch = \"wasm32\"))".dependencies.egui-winit]
+ version = "0.26.2"
+ features = [
+@@ -211,89 +182,7 @@ optional = true
+ version = "0.19"
+ optional = true
+ 
+-[target."cfg(not(target_arch = \"wasm32\"))".dependencies.wgpu]
+-version = "0.19.1"
+-features = [
+-    "fragile-send-sync-non-atomic-wasm",
+-    "metal",
+-    "webgpu",
+-]
+-optional = true
+-default-features = false
+-
+ [target."cfg(not(target_arch = \"wasm32\"))".dependencies.winit]
+ version = "0.29.4"
+ features = ["rwh_06"]
+ default-features = false
+-
+-[target."cfg(target_arch = \"wasm32\")".dependencies.bytemuck]
+-version = "1.7"
+-
+-[target."cfg(target_arch = \"wasm32\")".dependencies.egui-wgpu]
+-version = "0.26.2"
+-optional = true
+-default-features = false
+-
+-[target."cfg(target_arch = \"wasm32\")".dependencies.js-sys]
+-version = "0.3"
+-
+-[target."cfg(target_arch = \"wasm32\")".dependencies.percent-encoding]
+-version = "2.1"
+-
+-[target."cfg(target_arch = \"wasm32\")".dependencies.wasm-bindgen]
+-version = "0.2"
+-
+-[target."cfg(target_arch = \"wasm32\")".dependencies.wasm-bindgen-futures]
+-version = "0.4"
+-
+-[target."cfg(target_arch = \"wasm32\")".dependencies.web-sys]
+-version = "0.3.58"
+-features = [
+-    "BinaryType",
+-    "Blob",
+-    "Clipboard",
+-    "ClipboardEvent",
+-    "CompositionEvent",
+-    "console",
+-    "CssStyleDeclaration",
+-    "DataTransfer",
+-    "DataTransferItem",
+-    "DataTransferItemList",
+-    "Document",
+-    "DomRect",
+-    "DragEvent",
+-    "Element",
+-    "Event",
+-    "EventListener",
+-    "EventTarget",
+-    "ExtSRgb",
+-    "File",
+-    "FileList",
+-    "FocusEvent",
+-    "HtmlCanvasElement",
+-    "HtmlElement",
+-    "HtmlInputElement",
+-    "InputEvent",
+-    "KeyboardEvent",
+-    "Location",
+-    "MediaQueryList",
+-    "MediaQueryListEvent",
+-    "MouseEvent",
+-    "Navigator",
+-    "Performance",
+-    "Storage",
+-    "Touch",
+-    "TouchEvent",
+-    "TouchList",
+-    "WebGl2RenderingContext",
+-    "WebglDebugRendererInfo",
+-    "WebGlRenderingContext",
+-    "WheelEvent",
+-    "Window",
+-]
+-
+-[target."cfg(target_arch = \"wasm32\")".dependencies.wgpu]
+-version = "0.19.1"
+-features = ["fragile-send-sync-non-atomic-wasm"]
+-optional = true
+-default-features = false
-- 
2.41.0