Source: rust-gtk4
Severity: normal
Tags: patch forky sid
User: [email protected]
Usertags: libgirepository1.0-dev

As announced in 
https://lists.debian.org/debian-devel/2025/08/msg00150.html I would like 
to try to remove libgirepository1.0-dev during the forky cycle (and I 
plan to do a mass-bug filing for this at some point).

As previously discussed with Matthias Geiger on IRC, I've added a new 
tool to gobject-introspection (>= 1.86.0-3~), deb-gir-tool(1), which 
should make it easier to remove this dependency from rust-gtk4 and 
similar packages.

I successfully built rust-gtk4 with the attached patch. I have not 
tested the result, but I used diffoscope to compare the resulting binary 
packages to a reference build done against 
libgirepository1.0-dev_1.86.0-2 without the patch, and they were 
identical - so hopefully everything is as it should be.

This requires a very new gobject-introspection, so you might prefer to 
let it migrate to testing before applying the patch, but I wanted to 
send the patch before I forget about it.

The output of the tool in the build log looks something like this:

>make[1]: Entering directory '/build/reproducible-path/rust-gtk4-0.10.1'
>deb-gir-tool find \
>       --target-directory=/build/reproducible-path/rust-gtk4-0.10.1 \
>       --verbose \
>       --with-dependencies \
>       Gtk-4.0
>deb-gi-tool: Copied “/usr/share/gir-1.0/Gtk-4.0.gir” to 
>“/build/reproducible-path/rust-gtk4-0.10.1/Gtk-4.0.gir”
>deb-gi-tool: Gtk-4.0 depends on Gdk-4.0
>deb-gi-tool: Gtk-4.0 depends on Gsk-4.0
>deb-gi-tool: Copied “/usr/share/gir-1.0/Gdk-4.0.gir” to 
>“/build/reproducible-path/rust-gtk4-0.10.1/Gdk-4.0.gir”
...
>deb-gi-tool: GModule-2.0 depends on GLib-2.0
>deb-gi-tool: Copied “/usr/lib/x86_64-linux-gnu/gir-1.0/GLib-2.0.gir” to 
>“/build/reproducible-path/rust-gtk4-0.10.1/GLib-2.0.gir”
>deb-gi-tool: Copied “/usr/share/gir-1.0/GObject-2.0.gir” to 
>“/build/reproducible-path/rust-gtk4-0.10.1/GObject-2.0.gir”
>deb-gi-tool: GObject-2.0 depends on GLib-2.0 which was already processed
...
>xmlstarlet ed -L \
(build continues)

The same technique can probably be used in many (all?) of the packages 
that follow the same patterns as rust-gtk4. I don't intend to propose 
patches for all of them individually, I was treating rust-gtk4 as a 
proof of concept more than anything else.

    smcv
>From 541a4d4156f3d00d1639eb17ce91842e4331cd14 Mon Sep 17 00:00:00 2001
From: Simon McVittie <[email protected]>
Date: Sat, 27 Sep 2025 18:45:09 +0100
Subject: [PATCH] d/control, d/rules: Use `deb-gir-tool find` to copy GIR XML
 for build

This avoids needing to hard-code the recursive dependencies of Gtk-4.0
and their absolute paths, and also avoids the need to build-depend
on the deprecated libgirepository1.0-dev package.
---
 debian/control |  3 ++-
 debian/rules   | 19 +++++--------------
 2 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/debian/control b/debian/control
index 657028e..762412c 100644
--- a/debian/control
+++ b/debian/control
@@ -5,7 +5,8 @@ Build-Depends: debhelper-compat (= 13),
  dh-sequence-cargo,
  libgtk-4-dev (>= 4.20),
  gir-rust-code-generator (>= 0.21),
- libgirepository1.0-dev,
+ gir1.2-gtk-4.0-dev,
+ gobject-introspection (>= 1.86.0-3~),
  libgraphene-1.0-dev,
  xmlstarlet
 Build-Depends-Arch: cargo:native <!nocheck>,
diff --git a/debian/rules b/debian/rules
index 4b43666..ae8b762 100755
--- a/debian/rules
+++ b/debian/rules
@@ -6,20 +6,11 @@
 # regenerating the source code
 # applying debian patches and upstream xmlstarlet fixes taken from upstream here: https://github.com/gtk-rs/gir-files/blob/master/fix.sh
 execute_before_dh_auto_build:
-	cp /usr/share/gir-1.0/GLib-2.0.gir $(CURDIR)
-	cp /usr/share/gir-1.0/Gdk-4.0.gir $(CURDIR)
-	cp /usr/share/gir-1.0/GdkPixbuf-2.0.gir $(CURDIR)
-	cp /usr/share/gir-1.0/GModule-2.0.gir $(CURDIR)
-	cp /usr/share/gir-1.0/Gio-2.0.gir $(CURDIR)
-	cp /usr/share/gir-1.0/GObject-2.0.gir $(CURDIR)
-	cp /usr/share/gir-1.0/Pango-1.0.gir $(CURDIR)
-	cp /usr/share/gir-1.0/HarfBuzz-0.0.gir $(CURDIR)
-	cp /usr/share/gir-1.0/freetype2-2.0.gir $(CURDIR)
-	cp /usr/share/gir-1.0/cairo-1.0.gir $(CURDIR)
-	cp /usr/share/gir-1.0/PangoCairo-1.0.gir $(CURDIR)
-	cp /usr/share/gir-1.0/Gtk-4.0.gir $(CURDIR)
-	cp /usr/share/gir-1.0/Gsk-4.0.gir $(CURDIR)
-	cp /usr/share/gir-1.0/Graphene-1.0.gir $(CURDIR)
+	deb-gir-tool find \
+		--target-directory=$(CURDIR) \
+		--verbose \
+		--with-dependencies \
+		Gtk-4.0
 	xmlstarlet ed -L \
 	-u '//_:parameter[@name="response_id"]/_:type[@name="gint"]/@c:type' -v "GtkResponseType" \
 	-u '//_:parameter[@name="response_id"]/_:type[@name="gint"]/@name' -v "ResponseType" \
-- 
2.51.0

Reply via email to