commit:     1a395c389053493823136109272e5e1bd576c165
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 28 15:50:55 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jan 28 15:51:21 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1a395c38

media-libs/musicbrainz: fix build w/ libxml2-2.12

Closes: https://bugs.gentoo.org/923011
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../musicbrainz-5.1.0-libxml2-2.12-compat.patch    | 21 +++++++
 .../files/musicbrainz-5.1.0-libxml2-2.12.patch     | 69 ++++++++++++++++++++++
 media-libs/musicbrainz/musicbrainz-5.1.0-r1.ebuild | 48 +++++++++++++++
 3 files changed, 138 insertions(+)

diff --git 
a/media-libs/musicbrainz/files/musicbrainz-5.1.0-libxml2-2.12-compat.patch 
b/media-libs/musicbrainz/files/musicbrainz-5.1.0-libxml2-2.12-compat.patch
new file mode 100644
index 000000000000..a835ffbb0f2e
--- /dev/null
+++ b/media-libs/musicbrainz/files/musicbrainz-5.1.0-libxml2-2.12-compat.patch
@@ -0,0 +1,21 @@
+Fix build with <libxml2-2.12.
+--- a/src/xmlParser.cc
++++ b/src/xmlParser.cc
+@@ -57,7 +57,7 @@ XMLNode *XMLRootNode::parseFile(const std::string &filename, 
XMLResults* results
+ 
+     doc = xmlParseFile(filename.c_str());
+     if ((doc == NULL) && (results != NULL)) {
+-        const xmlError *error = xmlGetLastError();
++        const xmlError *error = (const xmlError*) xmlGetLastError();
+         results->message = error->message;
+         results->line = error->line;
+         results->code = error->code;
+@@ -72,7 +72,7 @@ XMLNode *XMLRootNode::parseString(const std::string &xml, 
XMLResults* results)
+ 
+     doc = xmlParseMemory(xml.c_str(), xml.length());
+     if ((doc == NULL) && (results != NULL)) {
+-        const xmlError *error = xmlGetLastError();
++        const xmlError *error = (const xmlError*) xmlGetLastError();
+         results->message = error->message;
+         results->line = error->line;
+         results->code = error->code;

diff --git a/media-libs/musicbrainz/files/musicbrainz-5.1.0-libxml2-2.12.patch 
b/media-libs/musicbrainz/files/musicbrainz-5.1.0-libxml2-2.12.patch
new file mode 100644
index 000000000000..41956918bb93
--- /dev/null
+++ b/media-libs/musicbrainz/files/musicbrainz-5.1.0-libxml2-2.12.patch
@@ -0,0 +1,69 @@
+https://bugs.gentoo.org/923011
+https://github.com/metabrainz/libmusicbrainz/commit/9ba00067a15479a52262a5126bcb6889da5884b7
+https://github.com/metabrainz/libmusicbrainz/commit/558c9ba0e6d702d5c877f75be98176f57abf1b02
+
+From 9ba00067a15479a52262a5126bcb6889da5884b7 Mon Sep 17 00:00:00 2001
+From: Christopher Degawa <c...@randomderp.com>
+Date: Sun, 8 Oct 2023 11:41:30 -0500
+Subject: [PATCH] libxml: include parser.h
+
+libxml2 removed the inclusion of global.h in a few of its include files,
+so we can no longer rely on transitive includes.
+
+This applies to functions like xmlParseFile.
+
+Signed-off-by: Christopher Degawa <c...@randomderp.com>
+---
+ src/xmlParser.cc | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/xmlParser.cc b/src/xmlParser.cc
+index e63df55..53dec25 100644
+--- a/src/xmlParser.cc
++++ b/src/xmlParser.cc
+@@ -30,6 +30,7 @@
+ 
+ #include <cstring>
+ #include <libxml/tree.h>
++#include <libxml/parser.h>
+ 
+ XMLResults::XMLResults()
+     : line(0),
+
+
+From 558c9ba0e6d702d5c877f75be98176f57abf1b02 Mon Sep 17 00:00:00 2001
+From: Christopher Degawa <c...@randomderp.com>
+Date: Sun, 8 Oct 2023 11:42:55 -0500
+Subject: [PATCH] libxml: constify the storage of xmlGetLastError()
+
+libxml2 recently made it a const return.
+Since nothing is being modified of it, this should have no real effect
+past satisfying the compiler.
+
+Signed-off-by: Christopher Degawa <c...@randomderp.com>
+---
+ src/xmlParser.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/xmlParser.cc b/src/xmlParser.cc
+index 53dec25..fee684c 100644
+--- a/src/xmlParser.cc
++++ b/src/xmlParser.cc
+@@ -57,7 +57,7 @@ XMLNode *XMLRootNode::parseFile(const std::string &filename, 
XMLResults* results
+ 
+     doc = xmlParseFile(filename.c_str());
+     if ((doc == NULL) && (results != NULL)) {
+-        xmlErrorPtr error = xmlGetLastError();
++        const xmlError *error = xmlGetLastError();
+         results->message = error->message;
+         results->line = error->line;
+         results->code = error->code;
+@@ -72,7 +72,7 @@ XMLNode *XMLRootNode::parseString(const std::string &xml, 
XMLResults* results)
+ 
+     doc = xmlParseMemory(xml.c_str(), xml.length());
+     if ((doc == NULL) && (results != NULL)) {
+-        xmlErrorPtr error = xmlGetLastError();
++        const xmlError *error = xmlGetLastError();
+         results->message = error->message;
+         results->line = error->line;
+         results->code = error->code;

diff --git a/media-libs/musicbrainz/musicbrainz-5.1.0-r1.ebuild 
b/media-libs/musicbrainz/musicbrainz-5.1.0-r1.ebuild
new file mode 100644
index 000000000000..c0ca4e48189b
--- /dev/null
+++ b/media-libs/musicbrainz/musicbrainz-5.1.0-r1.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake
+
+DESCRIPTION="Client Library for accessing the latest XML based MusicBrainz web 
service"
+HOMEPAGE="https://musicbrainz.org/doc/libmusicbrainz";
+SRC_URI="https://github.com/metabrainz/lib${PN}/releases/download/release-${PV}/lib${P}.tar.gz";
+S="${WORKDIR}/lib${P}"
+
+LICENSE="LGPL-2.1"
+SLOT="5/1" # soname of libmusicbrainz5.so
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv 
~sparc ~x86 ~amd64-linux ~x86-linux"
+IUSE="examples test"
+
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+       dev-libs/libxml2
+       net-libs/neon
+"
+DEPEND="
+       ${RDEPEND}
+       test? ( dev-util/cppunit )
+"
+
+PATCHES=(
+       "${FILESDIR}/${P}-no-wildcards.patch"
+       "${FILESDIR}/${P}-libxml2-2.12.patch"
+       "${FILESDIR}/${P}-libxml2-2.12-compat.patch"
+)
+
+src_prepare() {
+       use test || cmake_comment_add_subdirectory tests
+       cmake_src_prepare
+}
+
+src_install() {
+       cmake_src_install
+
+       if use examples; then
+               docinto examples
+               dodoc examples/*.{c,cc,txt}
+               docompress -x /usr/share/doc/${PF}/examples
+       fi
+}

Reply via email to