Subject: [PATCH] gnu: Add rust-gtk4 and dependencies.

From: Herman Rimm <[email-masked]>
Date: Sun, 24 Dec 2023 16:27:30 +0100

* gnu/packages/crates-gtk.scm (rust-gdk4-0.6): New variable.
(rust-graphene-rs-0.17): New variable.
(rust-graphene-sys-0.17): New variable.
(rust-gsk4-0.6): New variable.
(rust-gsk4-sys-0.6): New variable.
(rust-gtk4-0.6): New variable.
(rust-gtk4-macros-0.6): New variable.
(rust-gtk4-sys-0.6): New variable.
---
Hello,

Should each package be added in a separate patch?

The latest gtk4-rs version is 0.7, I chose 0.6 because it has more
compatible dependencies. gtk4-rs can be updated to 0.7 together with
those dependencies. For the new packages, guix lint notes the newer
version and that the source is not archived on Software Heritage etc..

The package descriptions are still single sentences, so it can't be
merged. But I mail this patch for people who would like to use newer
gtk4-rs packages despite that. Please improve the descriptions if you
feel like it.

Cheers,
Herman Rimm

 gnu/packages/crates-gtk.scm | 291 ++++++++++++++++++++++++++++++++++++
 1 file changed, 291 insertions(+)

diff --git a/gnu/packages/crates-gtk.scm b/gnu/packages/crates-gtk.scm
index 266a513dc2..0c275b739e 100644
--- a/gnu/packages/crates-gtk.scm
+++ b/gnu/packages/crates-gtk.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2022 Petr Hodina <[email-masked]>
 ;;; Copyright © 2022 Aleksandr Vityazev <[email-masked]>
 ;;; Copyright © 2023 Steve George <[email-masked]>
+;;; Copyright © 2023 Herman Rimm <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -860,6 +861,68 @@ (define-public rust-gdk-sys-0.9
        (("rust-shell-words" ,rust-shell-words-0.1)
         ("rust-tempfile" ,rust-tempfile-3))))))
 
+(define-public rust-gdk4-0.6
+  (package
+    (name "rust-gdk4")
+    (version "0.6.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "gdk4" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "1zri4z8nxsp88mvk8vhk6xqpc4g1l69zi9w1z3fkwvm211jgkay3"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:tests? #f ;`Errors` cannot be formatted with the default formatter.
+       #:cargo-inputs (("rust-bitflags" ,rust-bitflags-1)
+                       ("rust-cairo-rs" ,rust-cairo-rs-0.17)
+                       ("rust-gdk-pixbuf" ,rust-gdk-pixbuf-0.17)
+                       ("rust-gdk4-sys" ,rust-gdk4-sys-0.6)
+                       ("rust-gio" ,rust-gio-0.17)
+                       ("rust-glib" ,rust-glib-0.17)
+                       ("rust-libc" ,rust-libc-0.2)
+                       ("rust-pango" ,rust-pango-0.17))
+       #:cargo-development-inputs (("rust-gir-format-check" ,rust-gir-format-check-0.1))))
+    (native-inputs (list pkg-config))
+    (inputs (list cairo gdk-pixbuf glib gtk pango))
+    (home-page "https://gtk-rs.org/")
+    (synopsis "Rust bindings of the GDK 4 library")
+    (description "This package provides the Rust bindings of the GDK 4
+library.")
+    (license license:expat)))
+
+(define-public rust-gdk4-sys-0.6
+  (package
+    (name "rust-gdk4-sys")
+    (version "0.6.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "gdk4-sys" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "0r7dm9vyzg2xlzdgxqa190gd1403mhw4q09x754rq24cc2hjmj8v"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-inputs (("rust-cairo-sys-rs" ,rust-cairo-sys-rs-0.17)
+                       ("rust-gdk-pixbuf-sys" ,rust-gdk-pixbuf-sys-0.17)
+                       ("rust-gio-sys" ,rust-gio-sys-0.17)
+                       ("rust-glib-sys" ,rust-glib-sys-0.17)
+                       ("rust-gobject-sys" ,rust-gobject-sys-0.17)
+                       ("rust-libc" ,rust-libc-0.2)
+                       ("rust-pango-sys" ,rust-pango-sys-0.17)
+                       ("rust-pkg-config" ,rust-pkg-config-0.3)
+                       ("rust-system-deps" ,rust-system-deps-6))
+       #:cargo-development-inputs (("rust-shell-words" ,rust-shell-words-1)
+                                   ("rust-tempfile" ,rust-tempfile-3))))
+    (native-inputs (list pkg-config))
+    (inputs (list cairo gdk-pixbuf glib gtk pango))
+    (home-page "https://gtk-rs.org/")
+    (synopsis "FFI bindings of GDK 4")
+    (description "This package provides the FFI bindings of GDK 4.")
+    (license license:expat)))
+
 (define-public rust-gio-0.17
   (package
     (name "rust-gio")
@@ -1711,6 +1774,130 @@ (define-public rust-gobject-sys-0.9
        (("rust-shell-words" ,rust-shell-words-0.1)
         ("rust-tempfile" ,rust-tempfile-3))))))
 
+(define-public rust-graphene-rs-0.17
+  (package
+    (name "rust-graphene-rs")
+    (version "0.17.10")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "graphene-rs" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "1na0kg5q746kpg0x8hic06rqknbjs9050i85idafsnav4q0vpx6y"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:tests? #f ;`Errors` cannot be formatted with the default formatter.
+       #:cargo-inputs (("rust-glib" ,rust-glib-0.17)
+                       ("rust-graphene-sys" ,rust-graphene-sys-0.17)
+                       ("rust-libc" ,rust-libc-0.2))
+       #:cargo-development-inputs (("rust-gir-format-check" ,rust-gir-format-check-0.1))))
+    (native-inputs (list pkg-config))
+    (inputs (list glib graphene))
+    (home-page "https://gtk-rs.org/")
+    (synopsis "Rust bindings for the Graphene library")
+    (description "This package provides the Rust bindings for the Graphene
+library.")
+    (license license:expat)))
+
+(define-public rust-graphene-sys-0.17
+  (package
+    (name "rust-graphene-sys")
+    (version "0.17.10")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "graphene-sys" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "07dj19zwffl0h8qjs7lxf3czb5p2myixj2zadkiparkags0zqmhq"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-inputs (("rust-glib-sys" ,rust-glib-sys-0.17)
+                       ("rust-libc" ,rust-libc-0.2)
+                       ("rust-pkg-config" ,rust-pkg-config-0.3)
+                       ("rust-system-deps" ,rust-system-deps-6))
+       #:cargo-development-inputs (("rust-shell-words" ,rust-shell-words-1)
+                                   ("rust-tempfile" ,rust-tempfile-3))))
+    (native-inputs (list pkg-config))
+    (inputs (list glib graphene))
+    (home-page "https://gtk-rs.org/")
+    (synopsis "FFI bindings to libgraphene-1.0")
+    (description "This package provides FFI bindings to libgraphene-1.0.")
+    (license license:expat)))
+
+(define-public rust-gsk4-0.6
+  (package
+    (name "rust-gsk4")
+    (version "0.6.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "gsk4" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "0g1srhahmhdl6rqbz98bawzf1gp6hf9m4y4rvbi1bb3wz92fy0bg"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:tests? #f ;`Errors` cannot be formatted with the default formatter.
+       #:cargo-inputs (("rust-bitflags" ,rust-bitflags-1)
+                       ("rust-cairo-rs" ,rust-cairo-rs-0.17)
+                       ("rust-gdk4" ,rust-gdk4-0.6)
+                       ("rust-glib" ,rust-glib-0.17)
+                       ("rust-graphene-rs" ,rust-graphene-rs-0.17)
+                       ("rust-gsk4-sys" ,rust-gsk4-sys-0.6)
+                       ("rust-libc" ,rust-libc-0.2)
+                       ("rust-pango" ,rust-pango-0.17))
+       #:cargo-development-inputs (("rust-gir-format-check" ,rust-gir-format-check-0.1))))
+    (native-inputs (list pkg-config))
+    (inputs (list cairo
+                  gdk-pixbuf
+                  glib
+                  graphene
+                  gtk
+                  pango))
+    (home-page "https://gtk-rs.org/")
+    (synopsis "Rust bindings of the GSK 4 library")
+    (description "This package provides the Rust bindings of the GSK 4
+library.")
+    (license license:expat)))
+
+(define-public rust-gsk4-sys-0.6
+  (package
+    (name "rust-gsk4-sys")
+    (version "0.6.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "gsk4-sys" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "1c013zdd0yzcfmkz1gj28dbfz2zmypi8baimjk9264yg9pxq8yn0"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:tests? #f ;tests FAILED
+       #:cargo-inputs (("rust-cairo-sys-rs" ,rust-cairo-sys-rs-0.17)
+                       ("rust-gdk4-sys" ,rust-gdk4-sys-0.6)
+                       ("rust-glib-sys" ,rust-glib-sys-0.17)
+                       ("rust-gobject-sys" ,rust-gobject-sys-0.17)
+                       ("rust-graphene-sys" ,rust-graphene-sys-0.17)
+                       ("rust-libc" ,rust-libc-0.2)
+                       ("rust-pango-sys" ,rust-pango-sys-0.17)
+                       ("rust-system-deps" ,rust-system-deps-6))
+       #:cargo-development-inputs (("rust-shell-words" ,rust-shell-words-1)
+                                   ("rust-tempfile" ,rust-tempfile-3))))
+    (native-inputs (list pkg-config))
+    (inputs (list cairo
+                  gdk-pixbuf
+                  glib
+                  graphene
+                  gtk
+                  pango))
+    (home-page "https://gtk-rs.org/")
+    (synopsis "FFI bindings of GSK 4")
+    (description "This package provides the FFI bindings of GSK 4.")
+    (license license:expat)))
+
 (define-public rust-gstreamer-0.18
   (package
     (name "rust-gstreamer")
@@ -2187,6 +2374,110 @@ (define-public rust-gtk3-macros-0.14
 library.")
     (license license:expat)))
 
+(define-public rust-gtk4-0.6
+  (package
+    (name "rust-gtk4")
+    (version "0.6.6")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "gtk4" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "12y8ck3y555mvv65lwm7l19f23wycq68ngwql0afyp6p9jh352mj"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:tests? #f ;`Errors` cannot be formatted with the default formatter.
+       #:cargo-inputs (("rust-bitflags" ,rust-bitflags-1)
+                       ("rust-cairo-rs" ,rust-cairo-rs-0.17)
+                       ("rust-field-offset" ,rust-field-offset-0.3)
+                       ("rust-futures-channel" ,rust-futures-channel-0.3)
+                       ("rust-gdk-pixbuf" ,rust-gdk-pixbuf-0.17)
+                       ("rust-gdk4" ,rust-gdk4-0.6)
+                       ("rust-gio" ,rust-gio-0.17)
+                       ("rust-glib" ,rust-glib-0.17)
+                       ("rust-graphene-rs" ,rust-graphene-rs-0.17)
+                       ("rust-gsk4" ,rust-gsk4-0.6)
+                       ("rust-gtk4-macros" ,rust-gtk4-macros-0.6)
+                       ("rust-gtk4-sys" ,rust-gtk4-sys-0.6)
+                       ("rust-libc" ,rust-libc-0.2)
+                       ("rust-once-cell" ,rust-once-cell-1)
+                       ("rust-pango" ,rust-pango-0.17))
+       #:cargo-development-inputs (("rust-gir-format-check" ,rust-gir-format-check-0.1))))
+    (native-inputs (list pkg-config))
+    (inputs (list cairo gdk-pixbuf glib gtk pango))
+    (home-page "https://gtk-rs.org/")
+    (synopsis "Rust bindings of the GTK 4 library")
+    (description "This package provides Rust bindings of the GTK 4
+library.")
+    (license license:expat)))
+
+(define-public rust-gtk4-macros-0.6
+  (package
+    (name "rust-gtk4-macros")
+    (version "0.6.6")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "gtk4-macros" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "03shq84fvay3zqdccr2j22v6kkdi8fj4v61dakpd6xhgaxhnnkba"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:tests? #f ;tests FAILED
+       #:cargo-inputs (("rust-anyhow" ,rust-anyhow-1)
+                       ("rust-proc-macro-crate" ,rust-proc-macro-crate-1)
+                       ("rust-proc-macro-error" ,rust-proc-macro-error-1)
+                       ("rust-proc-macro2" ,rust-proc-macro2-1)
+                       ("rust-quick-xml" ,rust-quick-xml-0.27)
+                       ("rust-quote" ,rust-quote-1)
+                       ("rust-syn" ,rust-syn-1))
+       #:cargo-development-inputs (("rust-futures-channel" ,rust-futures-channel-0.3)
+                                   ("rust-futures-util" ,rust-futures-util-0.3)
+                                   ("rust-gtk4" ,rust-gtk4-0.6)
+                                   ("rust-trybuild2" ,rust-trybuild2-1))))
+    (native-inputs (list pkg-config))
+    (inputs (list gtk))
+    (home-page "https://gtk-rs.org/")
+    (synopsis "Macros helpers for GTK 4 bindings")
+    (description "This package provides macros helpers for GTK 4 bindings.")
+    (license license:expat)))
+
+(define-public rust-gtk4-sys-0.6
+  (package
+    (name "rust-gtk4-sys")
+    (version "0.6.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "gtk4-sys" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "0bz26ix7pl4d1m63zacaw1vw5021vm5r7wn7fsg02zmh0zvq70jz"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:tests? #f
+       #:cargo-inputs (("rust-cairo-sys-rs" ,rust-cairo-sys-rs-0.17)
+                       ("rust-gdk-pixbuf-sys" ,rust-gdk-pixbuf-sys-0.17)
+                       ("rust-gdk4-sys" ,rust-gdk4-sys-0.6)
+                       ("rust-gio-sys" ,rust-gio-sys-0.17)
+                       ("rust-glib-sys" ,rust-glib-sys-0.17)
+                       ("rust-gobject-sys" ,rust-gobject-sys-0.17)
+                       ("rust-graphene-sys" ,rust-graphene-sys-0.17)
+                       ("rust-gsk4-sys" ,rust-gsk4-sys-0.6)
+                       ("rust-libc" ,rust-libc-0.2)
+                       ("rust-pango-sys" ,rust-pango-sys-0.17)
+                       ("rust-system-deps" ,rust-system-deps-6))
+       #:cargo-development-inputs (("rust-shell-words" ,rust-shell-words-1)
+                                   ("rust-tempfile" ,rust-tempfile-3))))
+    (native-inputs (list pkg-config))
+    (inputs (list cairo gdk-pixbuf glib gtk pango))
+    (home-page "https://gtk-rs.org/")
+    (synopsis "FFI bindings of GTK 4")
+    (description "This package provides the FFI bindings of GTK 4.")
+    (license license:expat)))
+
 (define-public rust-pango-0.17
   (package
     (name "rust-pango")

base-commit: 0d13d095420861022e68e87ceebd5e037e12a8b3
-- 
2.41.0