diff mbox series

[meta-oe] xmlstarlet: Fix build with libxml2 2.14+

Message ID 20250527231822.1570430-1-raj.khem@gmail.com
State New
Headers show
Series [meta-oe] xmlstarlet: Fix build with libxml2 2.14+ | expand

Commit Message

Khem Raj May 27, 2025, 11:18 p.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...-ATTRIBUTE_UNUSED-if-its-not-defined.patch | 37 +++++++++++++++++++
 .../xmlstarlet/xmlstarlet_1.6.1.bb            |  3 +-
 2 files changed, 39 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-support/xmlstarlet/files/0001-Define-ATTRIBUTE_UNUSED-if-its-not-defined.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/xmlstarlet/files/0001-Define-ATTRIBUTE_UNUSED-if-its-not-defined.patch b/meta-oe/recipes-support/xmlstarlet/files/0001-Define-ATTRIBUTE_UNUSED-if-its-not-defined.patch
new file mode 100644
index 0000000000..1468559e7f
--- /dev/null
+++ b/meta-oe/recipes-support/xmlstarlet/files/0001-Define-ATTRIBUTE_UNUSED-if-its-not-defined.patch
@@ -0,0 +1,37 @@ 
+From 4e94034e9231f5d8312497b7504f21b7a6062bf4 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 27 May 2025 16:12:01 -0700
+Subject: [PATCH] Define ATTRIBUTE_UNUSED if its not defined
+
+ATTRIBUTE_UNUSED is not defined in libxml2 2.14+, so check if the define is
+not there then define it.
+
+Fixes build errors e.g.
+../xmlstarlet-1.6.1/src/xml_pyx.c:203:36: error: expected ')'
+  203 | pyxExternalSubsetHandler(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name,
+      |                                    ^
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/xml_pyx.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/src/xml_pyx.c b/src/xml_pyx.c
+index ab295f1..f1a1884 100644
+--- a/src/xml_pyx.c
++++ b/src/xml_pyx.c
+@@ -21,6 +21,13 @@
+ 
+ #include "xmlstar.h"
+ 
++/**
++ * Unbreak build with libxml2 2.14
++ */
++#ifndef ATTRIBUTE_UNUSED
++#define ATTRIBUTE_UNUSED __attribute__((unused))
++#endif
++
+ /**
+  *  Output newline and tab characters as escapes
+  *  Required both for attribute values and character data (#PCDATA)
diff --git a/meta-oe/recipes-support/xmlstarlet/xmlstarlet_1.6.1.bb b/meta-oe/recipes-support/xmlstarlet/xmlstarlet_1.6.1.bb
index 80fbe537e5..c8cfd884e2 100644
--- a/meta-oe/recipes-support/xmlstarlet/xmlstarlet_1.6.1.bb
+++ b/meta-oe/recipes-support/xmlstarlet/xmlstarlet_1.6.1.bb
@@ -16,7 +16,8 @@  SRC_URI = "${SOURCEFORGE_MIRROR}/xmlstar/${BP}.tar.gz \
            file://configure.ac.patch \
            file://0001-usage2c.awk-fix-wrong-basename-regexp.patch \
            file://0001-Make-xmlError-struct-constant.patch \
-           file://0001-Fix-hash_key_put-signature.patch"
+           file://0001-Fix-hash_key_put-signature.patch \
+		   file://0001-Define-ATTRIBUTE_UNUSED-if-its-not-defined.patch"
 SRC_URI[sha256sum] = "15d838c4f3375332fd95554619179b69e4ec91418a3a5296e7c631b7ed19e7ca"
 
 inherit autotools