diff options
author | Michal Privoznik <michal.privoznik@gmail.com> | 2023-11-28 08:40:04 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-12-03 06:22:11 +0000 |
commit | 1f916c7b39826f359d64ae7b938cb962b22fca42 (patch) | |
tree | 2acaab53829c8f14bf93dfdb40995163d6ff4e83 | |
parent | sys-devel/gdb: add 14.1 (diff) | |
download | gentoo-1f916c7b39826f359d64ae7b938cb962b22fca42.tar.gz gentoo-1f916c7b39826f359d64ae7b938cb962b22fca42.tar.bz2 gentoo-1f916c7b39826f359d64ae7b938cb962b22fca42.zip |
app-emulation/libvirt-glib: Fix build with >=dev-libs/libxml2-2.12.0
As of its 2.12.0 release, libxml2 cleaned up header files which
rendered libvirt-glib unable to compile. Backport fixes from
upstream repo.
Bug: https://bugs.gentoo.org/917526
Signed-off-by: Michal Privoznik <michal.privoznik@gmail.com>
Signed-off-by: Sam James <sam@gentoo.org>
3 files changed, 119 insertions, 0 deletions
diff --git a/app-emulation/libvirt-glib/files/libvirt-glib-4.0.0-Make-xmlError-structs-constant.patch b/app-emulation/libvirt-glib/files/libvirt-glib-4.0.0-Make-xmlError-structs-constant.patch new file mode 100644 index 000000000000..654436a65d99 --- /dev/null +++ b/app-emulation/libvirt-glib/files/libvirt-glib-4.0.0-Make-xmlError-structs-constant.patch @@ -0,0 +1,64 @@ +From 56acbe8a0765a02418f80fb3599b3cf7160ef446 Mon Sep 17 00:00:00 2001 +Message-ID: <56acbe8a0765a02418f80fb3599b3cf7160ef446.1701156704.git.mprivozn@redhat.com> +From: Michal Privoznik <mprivozn@redhat.com> +Date: Sat, 25 Nov 2023 07:13:33 +0100 +Subject: [glib PATCH 1/2] Make xmlError structs constant + +In libxml2 commits v2.12.0~14 and v2.12.0~77 the API changed so +that: + +1) xmlGetLastError() returns pointer to a constant xmlError + struct, and + +2) xmlSetStructuredErrorFunc() changed the signature of callback + (gvir_xml_structured_error_nop()), it too is passed pointer to + a constant xmlError struct. + +But of course, older libxml2 expects different callback +signature. Therefore, we need to typecast it anyway. + +Signed-off-by: Michal Privoznik <mprivozn@redhat.com> +--- + libvirt-gconfig/libvirt-gconfig-helpers.c | 2 +- + libvirt-gconfig/libvirt-gconfig-object.c | 5 +++-- + 2 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/libvirt-gconfig/libvirt-gconfig-helpers.c b/libvirt-gconfig/libvirt-gconfig-helpers.c +index e8f9664..37075e3 100644 +--- a/libvirt-gconfig/libvirt-gconfig-helpers.c ++++ b/libvirt-gconfig/libvirt-gconfig-helpers.c +@@ -41,7 +41,7 @@ static GError *gvir_config_error_new_literal(GQuark domain, + gint code, + const gchar *message) + { +- xmlErrorPtr xerr = xmlGetLastError(); ++ const xmlError *xerr = xmlGetLastError(); + + if (!xerr) + return NULL; +diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c +index eb8763e..1fcc667 100644 +--- a/libvirt-gconfig/libvirt-gconfig-object.c ++++ b/libvirt-gconfig/libvirt-gconfig-object.c +@@ -59,7 +59,7 @@ static void gvir_xml_generic_error_nop(void *userData G_GNUC_UNUSED, + } + + static void gvir_xml_structured_error_nop(void *userData G_GNUC_UNUSED, +- xmlErrorPtr error G_GNUC_UNUSED) ++ const xmlError *error G_GNUC_UNUSED) + { + } + +@@ -197,7 +197,8 @@ void gvir_config_object_validate(GVirConfigObject *config, + priv = config->priv; + + xmlSetGenericErrorFunc(NULL, gvir_xml_generic_error_nop); +- xmlSetStructuredErrorFunc(NULL, gvir_xml_structured_error_nop); ++ /* Drop this typecast when >=libxml2-2.12.0 is required */ ++ xmlSetStructuredErrorFunc(NULL, (xmlStructuredErrorFunc) gvir_xml_structured_error_nop); + + if (!priv->node) { + gvir_config_set_error_literal(err, +-- +2.41.0 + diff --git a/app-emulation/libvirt-glib/files/libvirt-glib-4.0.0-libvirt-gconfig-Add-more-libxml-includes.patch b/app-emulation/libvirt-glib/files/libvirt-glib-4.0.0-libvirt-gconfig-Add-more-libxml-includes.patch new file mode 100644 index 000000000000..7a13eb211e20 --- /dev/null +++ b/app-emulation/libvirt-glib/files/libvirt-glib-4.0.0-libvirt-gconfig-Add-more-libxml-includes.patch @@ -0,0 +1,50 @@ +From bcc82de1d74057f6d124c2eaff0ac97cbbf52657 Mon Sep 17 00:00:00 2001 +Message-ID: <bcc82de1d74057f6d124c2eaff0ac97cbbf52657.1701156704.git.mprivozn@redhat.com> +In-Reply-To: <56acbe8a0765a02418f80fb3599b3cf7160ef446.1701156704.git.mprivozn@redhat.com> +References: <56acbe8a0765a02418f80fb3599b3cf7160ef446.1701156704.git.mprivozn@redhat.com> +From: Michal Privoznik <mprivozn@redhat.com> +Date: Sat, 25 Nov 2023 07:15:46 +0100 +Subject: [glib PATCH 2/2] libvirt-gconfig: Add more libxml/ includes + +In its 2.12.0 release, libxml reworked their header files (some +might even call it cleaning up, I call it API incompatible +change) and now we don't get all declarations we need by just +including one file. Add missing includes. + +Resolves: https://gitlab.com/libvirt/libvirt-glib/-/issues/6 +Signed-off-by: Michal Privoznik <mprivozn@redhat.com> +--- + libvirt-gconfig/libvirt-gconfig-helpers.c | 1 + + libvirt-gconfig/libvirt-gconfig-object.c | 3 +++ + 2 files changed, 4 insertions(+) + +diff --git a/libvirt-gconfig/libvirt-gconfig-helpers.c b/libvirt-gconfig/libvirt-gconfig-helpers.c +index 37075e3..4dbb177 100644 +--- a/libvirt-gconfig/libvirt-gconfig-helpers.c ++++ b/libvirt-gconfig/libvirt-gconfig-helpers.c +@@ -25,6 +25,7 @@ + + #include <string.h> + ++#include <libxml/parser.h> + #include <libxml/xmlerror.h> + #include <glib/gi18n-lib.h> + +diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c +index 1fcc667..4dd189d 100644 +--- a/libvirt-gconfig/libvirt-gconfig-object.c ++++ b/libvirt-gconfig/libvirt-gconfig-object.c +@@ -25,7 +25,10 @@ + + #include <string.h> + ++#include <libxml/tree.h> ++#include <libxml/entities.h> + #include <libxml/relaxng.h> ++ + #include <glib/gi18n-lib.h> + + #include "libvirt-gconfig/libvirt-gconfig.h" +-- +2.41.0 + diff --git a/app-emulation/libvirt-glib/libvirt-glib-4.0.0.ebuild b/app-emulation/libvirt-glib/libvirt-glib-4.0.0.ebuild index 22cba180aefe..058cfd1881c7 100644 --- a/app-emulation/libvirt-glib/libvirt-glib-4.0.0.ebuild +++ b/app-emulation/libvirt-glib/libvirt-glib-4.0.0.ebuild @@ -31,6 +31,11 @@ BDEPEND=" vala? ( $(vala_depend) ) " +PATCHES=( + "${FILESDIR}"/${PN}-4.0.0-Make-xmlError-structs-constant.patch + "${FILESDIR}"/${PN}-4.0.0-libvirt-gconfig-Add-more-libxml-includes.patch +) + src_prepare() { default use vala && vala_src_prepare |