>From 541a4d4156f3d00d1639eb17ce91842e4331cd14 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@debian.org>
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

