On Mon, 24 Jul 2023 at 08:59:14 +0200, Sven Eckelmann wrote:
> Thanks for the patch. But you can test it by trying to open the attached
> file
> in g3dviewer. With the old version, you got a heightmap. But nothing will be
> loaded when your patch is applied.
Ah, I think I see the problem - I was too aggressive about removing
the unnecessary GDK 2 initialization from gdkpixbuf_init(), and also
removed the `return TRUE` that told libg3d that the plugin is available,
then missed the resulting compiler warning among all the warnings from
-Wpedantic.
Please try the attached instead? It seems to load your height map
successfully this time.
> And since the functionality is gone, it might be better to simply remove the
> package libg3d-plugin-gdkpixbuf.
Don't do that unless there's absolutely no alternaive - it should
be possible to keep this functionality without using the deprecated
libraries. We need GTK 2 for a while anyway, for GIMP; I was mainly
looking at libg3d because it looked like an easy place to drop a GTK 2
dependency without affecting functionality.
smcv
>From 3a2d817c762c960b7d32cd4665d13f95d858c81b Mon Sep 17 00:00:00 2001
From: Simon McVittie <[email protected]>
Date: Sun, 23 Jul 2023 20:48:11 +0100
Subject: [PATCH] Avoid build-dependency on obsolete GTK 2
Instead, use gdk-pixbuf directly, since that's what this package
actually needs.
Closes: #967575
---
debian/control | 2 +-
...ly-instead-of-via-the-obsolete-GTK-2.patch | 60 +++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 62 insertions(+), 1 deletion(-)
create mode 100644 debian/patches/Use-gdk-pixbuf-directly-instead-of-via-the-obsolete-GTK-2.patch
diff --git a/debian/control b/debian/control
index 609d9ea..2c42fe2 100644
--- a/debian/control
+++ b/debian/control
@@ -12,9 +12,9 @@ Build-Depends:
debhelper-compat (= 13),
flex,
gtk-doc-tools,
+ libgdk-pixbuf-2.0-dev,
libglib2.0-dev,
libgsf-1-dev | libgsf-gnome-1-dev,
- libgtk2.0-dev,
libtool,
libxml2-dev,
libz-dev,
diff --git a/debian/patches/Use-gdk-pixbuf-directly-instead-of-via-the-obsolete-GTK-2.patch b/debian/patches/Use-gdk-pixbuf-directly-instead-of-via-the-obsolete-GTK-2.patch
new file mode 100644
index 0000000..7413163
--- /dev/null
+++ b/debian/patches/Use-gdk-pixbuf-directly-instead-of-via-the-obsolete-GTK-2.patch
@@ -0,0 +1,60 @@
+From: Simon McVittie <[email protected]>
+Date: Sun, 23 Jul 2023 20:45:58 +0100
+Subject: Use gdk-pixbuf directly, instead of via the obsolete GTK 2
+
+Bug-Debian: https://bugs.debian.org/967575
+---
+ configure.in | 10 ++--------
+ plugins/image/img_gdkpixbuf.c | 11 -----------
+ 2 files changed, 2 insertions(+), 19 deletions(-)
+
+diff --git a/configure.in b/configure.in
+index 79fc9da..0ec37bb 100644
+--- a/configure.in
++++ b/configure.in
+@@ -48,14 +48,8 @@ GTK_DOC_CHECK
+ AM_PATH_GLIB_2_0(2.0.0,,AC_MSG_ERROR([glib >= 2.0 is needed]), gmodule gobject)
+
+ # gdk-pixbuf
+-AM_PATH_GTK_2_0(2.0.0, have_gtk2=true)
+-if test "x$have_gtk2" = "xtrue" ; then
+-GDKPIXBUF_CFLAGS=$GTK_CFLAGS
+-GDKPIXBUF_LIBS=$GTK_LIBS
+-AC_SUBST(GDKPIXBUF_CFLAGS)
+-AC_SUBST(GDKPIXBUF_LIBS)
+-fi
+-AM_CONDITIONAL([HAVE_GDKPIXBUF], test "x$have_gtk2" = "xtrue")
++PKG_CHECK_MODULES([GDKPIXBUF], [gdk-pixbuf-2.0], [have_gdkpixbuf=true], [have_gdkpixbuf=false])
++AM_CONDITIONAL([HAVE_GDKPIXBUF], test "x$have_gdkpixbuf" = "xtrue")
+
+ # libxml2
+ PKG_CHECK_MODULES(XML, libxml-2.0 >= 2.0.0, [have_libxml2=true], [have_libxml2=false])
+diff --git a/plugins/image/img_gdkpixbuf.c b/plugins/image/img_gdkpixbuf.c
+index 5a4984d..42975ed 100644
+--- a/plugins/image/img_gdkpixbuf.c
++++ b/plugins/image/img_gdkpixbuf.c
+@@ -24,7 +24,6 @@
+ #include <string.h>
+ #include <errno.h>
+
+-#include <gdk/gdk.h>
+ #include <gdk-pixbuf/gdk-pixbuf.h>
+
+ #include <g3d/types.h>
+@@ -141,16 +140,6 @@ gchar **plugin_extensions(G3DContext *context)
+
+ static gboolean gdkpixbuf_init(void)
+ {
+- static gboolean init = TRUE;
+-
+- if(init) {
+- /* initialize GDK */
+- /* FIXME: problem if already initialized with gtk_init()? */
+- gint argc = 0;
+- if(!gdk_init_check(&argc, NULL))
+- return FALSE;
+- init = FALSE;
+- }
+ return TRUE;
+ }
+
diff --git a/debian/patches/series b/debian/patches/series
index 6f52c0c..97c48c2 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -11,3 +11,4 @@ Fix-build-with-automake-1.11.3.patch
Fix-implicit-declarations-of-functions.patch
Fix-spelling-errors.patch
Switch-libxml2-lookup-from-xml2-config-to-pkg-config.patch
+Use-gdk-pixbuf-directly-instead-of-via-the-obsolete-GTK-2.patch
--
2.40.1