>From 27e0c379a0f3479768ea3f0714829c430531aace Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@debian.org>
Date: Mon, 20 Oct 2025 23:40:24 +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                                |  4 +-
 .../1001-Rebuild-for-libpeas1-changes.patch   | 84 +++++++++++++++++++
 debian/patches/series                         |  1 +
 3 files changed, 87 insertions(+), 2 deletions(-)
 create mode 100644 debian/patches/1001-Rebuild-for-libpeas1-changes.patch

diff --git a/debian/control b/debian/control
index d1977ba..9a26006 100644
--- a/debian/control
+++ b/debian/control
@@ -18,7 +18,7 @@ Build-Depends: debhelper-compat (= 13),
                libglib2.0-dev,
                libgtk-3-dev,
                libgtksourceview-4-dev,
-               libpeas-dev,
+               libpeas-dev (>= 1.36.0-6~),
                libsm-dev,
                libx11-dev,
                libxml2-dev,
@@ -33,7 +33,7 @@ Homepage: http://www.mate-desktop.org/
 
 Package: pluma
 Architecture: any
-Depends: gir1.2-peas-1.0,
+Depends: gir1.2-peas-1.0 (>= 1.36.0-6~),
          gir1.2-pluma-1.0 (= ${binary:Version}),
          iso-codes,
          mate-desktop-common,
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..9dec38d
--- /dev/null
+++ b/debian/patches/1001-Rebuild-for-libpeas1-changes.patch
@@ -0,0 +1,84 @@
+From: Leigh Scott <leigh123linux@gmail.com>
+Date: Wed, 10 Sep 2025 13:19:12 +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/pluma/c/f84adcd8673eed0592fa8cbd02122da0f9338bf0?branch=rawhide
+Bug-Debian: https://bugs.debian.org/1099164
+Bug-Debian: https://bugs.debian.org/1118363
+---
+ pluma/pluma-plugins-engine.c | 8 ++++----
+ pluma/pluma.c                | 4 ++--
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/pluma/pluma-plugins-engine.c b/pluma/pluma-plugins-engine.c
+index cb5e2c4..c53a31f 100644
+--- a/pluma/pluma-plugins-engine.c
++++ b/pluma/pluma-plugins-engine.c
+@@ -36,7 +36,7 @@
+ #include <string.h>
+ 
+ #include <glib/gi18n.h>
+-#include <girepository.h>
++#include <girepository/girepository.h>
+ 
+ #include "pluma-plugins-engine.h"
+ #include "pluma-debug.h"
+@@ -68,21 +68,21 @@ pluma_plugins_engine_init (PlumaPluginsEngine *engine)
+ 	engine->priv->plugin_settings = g_settings_new (PLUMA_SCHEMA_ID);
+ 
+ 	/* 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))
+ 	{
+ 		g_warning ("Could not load Peas repository: %s", error->message);
+ 		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))
+ 	{
+ 		g_warning ("Could not load PeasGtk repository: %s", error->message);
+ 		g_clear_error (&error);
+ 	}
+ 
+-	if (!g_irepository_require_private (g_irepository_get_default (),
++	if (!gi_repository_require_private (gi_repository_dup_default (),
+ 	                                    LIBDIR "/girepository-1.0",
+ 	                                    "Pluma", "1.0", 0, &error))
+ 	{
+diff --git a/pluma/pluma.c b/pluma/pluma.c
+index d81b9ae..7b2ec0a 100644
+--- a/pluma/pluma.c
++++ b/pluma/pluma.c
+@@ -44,7 +44,7 @@
+ #include <gdk/gdkx.h>
+ 
+ #ifdef HAVE_INTROSPECTION
+-#include <girepository.h>
++#include <girepository/girepository.h>
+ #endif
+ 
+ #include "pluma-app.h"
+@@ -527,7 +527,7 @@ main (int argc, char *argv[])
+ 	g_option_context_add_group (context, egg_sm_client_get_option_group ());
+ 
+ #ifdef HAVE_INTROSPECTION
+-	g_option_context_add_group (context, g_irepository_get_option_group ());
++	g_option_context_add_group (context, gi_repository_get_option_group ());
+ #endif
+ 
+ 	if (!g_option_context_parse (context, &argc, &argv, &error))
+-- 
+2.51.0
+
diff --git a/debian/patches/series b/debian/patches/series
index 3abdedd..7aee226 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 0001-filebrowser-fix-warning-Wincompatible-pointer-types.patch
+1001-Rebuild-for-libpeas1-changes.patch
 2001_fix-bin-sh-path-in-shebang.patch
-- 
2.51.0

