>From 56ff2e0503c641928347d03da89f01c318b5b5fe Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@debian.org>
Date: Mon, 20 Oct 2025 23:40:38 +0100
Subject: [PATCH 1/2] Build with a libpeas that uses libgirepository-2.0

Add patch from Fedora to enable that.

Helps: #1099164, #1118363
Closes: #-1
---
 debian/control                                |  2 +-
 .../1001-Rebuild-for-libpeas1-changes.patch   | 86 +++++++++++++++++++
 debian/patches/series                         |  1 +
 3 files changed, 88 insertions(+), 1 deletion(-)
 create mode 100644 debian/patches/1001-Rebuild-for-libpeas1-changes.patch
 create mode 100644 debian/patches/series

diff --git a/debian/control b/debian/control
index 45b43a7..d5b825a 100644
--- a/debian/control
+++ b/debian/control
@@ -26,7 +26,7 @@ Build-Depends: autoconf-archive,
                libjpeg-dev,
                liblcms2-dev,
                libmate-desktop-dev (>= 1.18),
-               libpeas-dev,
+               libpeas-dev (>= 1.36.0-6~),
                librsvg2-dev (>= 2.36.2),
                libstartup-notification0-dev,
                libxml2-dev,
diff --git a/debian/patches/1001-Rebuild-for-libpeas1-changes.patch b/debian/patches/1001-Rebuild-for-libpeas1-changes.patch
new file mode 100644
index 0000000..35fbba6
--- /dev/null
+++ b/debian/patches/1001-Rebuild-for-libpeas1-changes.patch
@@ -0,0 +1,86 @@
+From: Leigh Scott <leigh123linux@gmail.com>
+Date: Wed, 10 Sep 2025 14:21:43 +0100
+Subject: Rebuild for libpeas1 changes
+
+Recent libpeas versions add patches from the (as yet unreleased) 1.38
+upstream branch to make it compatible with pygobject >= 3.52, by using
+libgirepository-2.0 instead of libgirepository-1.0. Do similarly here.
+
+This leaks some references to the global singleton GIRepository
+instance, but that should be harmless since it's a global singleton.
+
+[smcv: Added commit message]
+
+Origin: vendor, Fedora, https://src.fedoraproject.org/rpms/eom/c/84b45dc6302f378926be390d39a7cca3ec4f26ea?branch=rawhide
+Bug-Debian: https://bugs.debian.org/1099164
+Bug-Debian: https://bugs.debian.org/1118363
+---
+ src/eom-plugin-engine.c | 8 ++++----
+ src/main.c              | 4 ++--
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/eom-plugin-engine.c b/src/eom-plugin-engine.c
+index dc434f2..19d1988 100644
+--- a/src/eom-plugin-engine.c
++++ b/src/eom-plugin-engine.c
+@@ -34,7 +34,7 @@
+ #include <glib/gi18n.h>
+ #include <glib.h>
+ #include <gio/gio.h>
+-#include <girepository.h>
++#include <girepository/girepository.h>
+ 
+ #define USER_EOM_PLUGINS_LOCATION "plugins/"
+ 
+@@ -87,7 +87,7 @@ eom_plugin_engine_new (void)
+ 	private_path = g_build_filename (LIBDIR, "girepository-1.0", NULL);
+ 
+ 	/* This should be moved to libpeas */
+-	if (g_irepository_require (g_irepository_get_default (),
++	if (gi_repository_require (gi_repository_dup_default (),
+ 	                           "Peas", "1.0", 0, &error) == NULL)
+ 	{
+ 		g_warning ("Error loading Peas typelib: %s\n",
+@@ -95,7 +95,7 @@ eom_plugin_engine_new (void)
+ 		g_clear_error (&error);
+ 	}
+ 
+-	if (g_irepository_require (g_irepository_get_default (),
++	if (gi_repository_require (gi_repository_dup_default (),
+ 	                           "PeasGtk", "1.0", 0, &error) == NULL)
+ 	{
+ 		g_warning ("Error loading PeasGtk typelib: %s\n",
+@@ -103,7 +103,7 @@ eom_plugin_engine_new (void)
+ 		g_clear_error (&error);
+ 	}
+ 
+-	if (g_irepository_require_private (g_irepository_get_default (),
++	if (gi_repository_require_private (gi_repository_dup_default (),
+ 	                                   private_path, "Eom", "1.0", 0,
+ 	                                   &error) == NULL)
+ 	{
+diff --git a/src/main.c b/src/main.c
+index 5f0806c..cb24122 100644
+--- a/src/main.c
++++ b/src/main.c
+@@ -27,7 +27,7 @@
+ #include "config.h"
+ #endif
+ #ifdef HAVE_INTROSPECTION
+-#include <girepository.h>
++#include <girepository/girepository.h>
+ #endif
+ 
+ #include "eom-session.h"
+@@ -111,7 +111,7 @@ main (int argc, char **argv)
+ 	 * Using gtk_get_option_group here initializes gtk during parsing */
+ 	g_option_context_add_group (ctx, gtk_get_option_group (TRUE));
+ #ifdef HAVE_INTROSPECTION
+-	g_option_context_add_group (ctx, g_irepository_get_option_group ());
++	g_option_context_add_group (ctx, gi_repository_get_option_group ());
+ #endif
+ 
+ 	if (!g_option_context_parse (ctx, &argc, &argv, &error)) {
+-- 
+2.51.0
+
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..e7e6022
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+1001-Rebuild-for-libpeas1-changes.patch
-- 
2.51.0

