diff mbox series

[meta-gnome,2/4] libgsf: Fix build with libxml2 2.13+

Message ID 20240824224545.1944956-2-raj.khem@gmail.com
State New
Headers show
Series [meta-oe,1/4] raptor2: Do not use curl-config to detect curl | expand

Commit Message

Khem Raj Aug. 24, 2024, 10:45 p.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...lation-attempt-fixes-for-libxml-2.13.patch | 105 ++++++++++++++++++
 .../recipes-gnome/libgsf/libgsf_1.14.52.bb    |   3 +-
 2 files changed, 107 insertions(+), 1 deletion(-)
 create mode 100644 meta-gnome/recipes-gnome/libgsf/libgsf/0001-Compilation-attempt-fixes-for-libxml-2.13.patch
diff mbox series

Patch

diff --git a/meta-gnome/recipes-gnome/libgsf/libgsf/0001-Compilation-attempt-fixes-for-libxml-2.13.patch b/meta-gnome/recipes-gnome/libgsf/libgsf/0001-Compilation-attempt-fixes-for-libxml-2.13.patch
new file mode 100644
index 0000000000..08ff51205a
--- /dev/null
+++ b/meta-gnome/recipes-gnome/libgsf/libgsf/0001-Compilation-attempt-fixes-for-libxml-2.13.patch
@@ -0,0 +1,105 @@ 
+From 4a84e9857d83f684bf53d616942a393ce558a328 Mon Sep 17 00:00:00 2001
+From: Morten Welinder <terra@gnome.org>
+Date: Wed, 3 Jul 2024 19:18:15 -0400
+Subject: [PATCH] Compilation: attempt fixes for libxml 2.13
+
+Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libgsf/-/commit/5d4bb55095d3d6ef793c1908a88504183e28644c]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ configure.ac         |  1 +
+ gsf/gsf-input-http.c | 19 +++++++++++++++++++
+ 2 files changed, 20 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index fceb776..7c2f946 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -238,6 +238,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <glib/gstdio.h>]], [[(void)g_chown("/
+ 		AC_MSG_RESULT(yes)],
+ 	       [AC_MSG_RESULT(no)])
+ AC_CHECK_FUNCS(g_date_time_new_from_iso8601 g_date_time_format_iso8601)
++AC_CHECK_FUNCS(xmlNanoHTTPOpen xmlNanoHTTPClose)
+ CFLAGS=$SAVE_CFLAGS
+ LIBS=$SAVE_LIBS
+ 
+diff --git a/gsf/gsf-input-http.c b/gsf/gsf-input-http.c
+index bdde3c8..03f4045 100644
+--- a/gsf/gsf-input-http.c
++++ b/gsf/gsf-input-http.c
+@@ -23,7 +23,10 @@
+ #include <gsf/gsf-input-http.h>
+ #include <gsf/gsf.h>
+ 
++#ifdef HAVE_XMLNANOHTTPOPEN
++// It's going away, so make it conditional
+ #include <libxml/nanohttp.h>
++#endif
+ 
+ struct _GsfInputHTTP {
+         GsfInput input;
+@@ -74,7 +77,9 @@ gsf_input_http_finalize (GObject *obj_input)
+ 	input->content_type = NULL;
+ 
+         if (input->ctx) {
++#ifdef HAVE_XMLNANOHTTPCLOSE
+                 xmlNanoHTTPClose ((gpointer) input->ctx);
++#endif
+                 input->ctx = NULL;
+         }
+ 
+@@ -215,6 +220,7 @@ gsf_input_http_get_content_type (GsfInputHTTP *input)
+         return content_type;
+ }
+ 
++#ifdef HAVE_XMLNANOHTTPOPEN
+ static GsfInput *
+ make_local_copy (gpointer *ctx)
+ {
+@@ -254,6 +260,7 @@ make_local_copy (gpointer *ctx)
+ 
+ 	return copy;
+ }
++#endif
+ 
+ /**
+  * gsf_input_http_new:
+@@ -265,6 +272,7 @@ make_local_copy (gpointer *ctx)
+ GsfInput *
+ gsf_input_http_new (gchar const * url, GError **error G_GNUC_UNUSED)
+ {
++#ifdef HAVE_XMLNANOHTTPOPEN
+         GObject *obj;
+ 	GsfInput *input;
+         gpointer ctx;
+@@ -293,6 +301,10 @@ gsf_input_http_new (gchar const * url, GError **error G_GNUC_UNUSED)
+         GSF_INPUT_HTTP (obj)->ctx = ctx;
+ 
+         return GSF_INPUT (obj);
++#else
++        g_return_val_if_fail(url != NULL, NULL);
++	return NULL;
++#endif
+ }
+ 
+ static GsfInput *
+@@ -304,6 +316,7 @@ gsf_input_http_dup (GsfInput *src, GError **err)
+ static guint8 const *
+ gsf_input_http_read (GsfInput *input, size_t num_bytes, guint8 *buffer)
+ {
++#ifdef HAVE_XMLNANOHTTPOPEN
+         int nread;
+         size_t total_read;
+         gpointer ctx = GSF_INPUT_HTTP (input)->ctx;
+@@ -324,6 +337,12 @@ gsf_input_http_read (GsfInput *input, size_t num_bytes, guint8 *buffer)
+                         return NULL;
+         }
+         return buffer;
++#else
++	(void)input;
++	(void)num_bytes;
++	(void)buffer;
++	return NULL;
++#endif
+ }
+ 
+ static gboolean
diff --git a/meta-gnome/recipes-gnome/libgsf/libgsf_1.14.52.bb b/meta-gnome/recipes-gnome/libgsf/libgsf_1.14.52.bb
index 7e1842b1ac..97cbbe450c 100644
--- a/meta-gnome/recipes-gnome/libgsf/libgsf_1.14.52.bb
+++ b/meta-gnome/recipes-gnome/libgsf/libgsf_1.14.52.bb
@@ -10,7 +10,8 @@  GNOMEBASEBUILDCLASS = "autotools"
 inherit gnomebase gobject-introspection gettext gtk-doc
 
 SRC_URI[archive.sha256sum] = "9181c914b9fac0e05d6bcaa34c7b552fe5fc0961d3c9f8c01ccc381fb084bcf0"
-SRC_URI += "file://0001-configure.ac-drop-a-copy-paste-of-introspection.m4-m.patch"
+SRC_URI += "file://0001-configure.ac-drop-a-copy-paste-of-introspection.m4-m.patch \
+            file://0001-Compilation-attempt-fixes-for-libxml-2.13.patch"
 
 PACKAGECONFIG ??= ""
 PACKAGECONFIG[gdk-pixbuf] = "--with-gdk-pixbuf,--without-gdk-pixbuf,gdk-pixbuf"