new file mode 100644
@@ -0,0 +1,118 @@
+From f4e971e872426563f85b4e2c6a629cecc757fde7 Mon Sep 17 00:00:00 2001
+From: Dario Binacchi <dario.binacchi@amarulasolutions.com>
+Date: Mon, 16 Dec 2024 17:23:23 +0100
+Subject: [PATCH] Fix compilation with uclibc
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The patch fixes the following errors and warnings raised by the
+compilation of the library with uClibc:
+
+encoding.c: In function ‘xmlEncInputChunk’:
+encoding.c:2209:32: warning: comparison between pointer and integer
+ 2209 | else if (handler->iconv_in != NULL) {
+ | ^~
+encoding.c: In function ‘xmlEncOutputChunk’:
+encoding.c:2269:33: warning: comparison between pointer and integer
+ 2269 | else if (handler->iconv_out != NULL) {
+ | ^~
+encoding.c: In function ‘xmlCharEncCloseFunc’:
+encoding.c:2681:29: warning: comparison between pointer and integer
+ 2681 | if ((handler->iconv_out != NULL) || (handler->iconv_in != NULL)) {
+ | ^~
+encoding.c:2681:60: warning: comparison between pointer and integer
+ 2681 | if ((handler->iconv_out != NULL) || (handler->iconv_in != NULL)) {
+ | ^~
+encoding.c:2683:32: warning: comparison between pointer and integer
+ 2683 | if (handler->iconv_out != NULL) {
+ | ^~
+encoding.c:2686:32: error: assignment to ‘iconv_t’ {aka ‘long int’} from ‘void *’ makes integer from pointer without a cast [-Wint-conversion]
+ 2686 | handler->iconv_out = NULL;
+ | ^
+encoding.c:2688:31: warning: comparison between pointer and integer
+ 2688 | if (handler->iconv_in != NULL) {
+ | ^~
+encoding.c:2691:31: error: assignment to ‘iconv_t’ {aka ‘long int’} from ‘void *’ makes integer from pointer without a cast [-Wint-conversion]
+ 2691 | handler->iconv_in = NULL;
+ | ^
+make[4]: *** [Makefile:1147: libxml2_la-encoding.lo] Error 1
+
+Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
+Upstream: https://gitlab.gnome.org/GNOME/libxml2/-/merge_requests/292
+---
+ encoding.c | 24 +++++++++++++++---------
+ 1 file changed, 15 insertions(+), 9 deletions(-)
+
+diff --git a/encoding.c b/encoding.c
+index 14ffafddbc02..30c75b7a99dc 100644
+--- a/encoding.c
++++ b/encoding.c
+@@ -44,6 +44,12 @@
+ #include "private/enc.h"
+ #include "private/error.h"
+
++#if defined(__GLIBC__) && defined(__UCLIBC__)
++#define ICONV_T_NULL ((iconv_t)-1)
++#else
++#define ICONV_T_NULL NULL
++#endif
++
+ #ifdef LIBXML_ICU_ENABLED
+ #include <unicode/ucnv.h>
+ /* Size of pivot buffer, same as icu/source/common/ucnv.cpp CHUNK_SIZE */
+@@ -1389,8 +1395,8 @@ xmlNewCharEncodingHandler(const char *name,
+ handler->name = up;
+
+ #ifdef LIBXML_ICONV_ENABLED
+- handler->iconv_in = NULL;
+- handler->iconv_out = NULL;
++ handler->iconv_in = ICONV_T_NULL;
++ handler->iconv_out = ICONV_T_NULL;
+ #endif
+ #ifdef LIBXML_ICU_ENABLED
+ handler->uconv_in = NULL;
+@@ -2200,7 +2206,7 @@ xmlEncInputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
+ }
+ }
+ #ifdef LIBXML_ICONV_ENABLED
+- else if (handler->iconv_in != NULL) {
++ else if (handler->iconv_in != ICONV_T_NULL) {
+ ret = xmlIconvWrapper(handler->iconv_in, out, outlen, in, inlen);
+ }
+ #endif /* LIBXML_ICONV_ENABLED */
+@@ -2260,7 +2266,7 @@ xmlEncOutputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
+ }
+ }
+ #ifdef LIBXML_ICONV_ENABLED
+- else if (handler->iconv_out != NULL) {
++ else if (handler->iconv_out != ICONV_T_NULL) {
+ ret = xmlIconvWrapper(handler->iconv_out, out, outlen, in, inlen);
+ }
+ #endif /* LIBXML_ICONV_ENABLED */
+@@ -2672,17 +2678,17 @@ xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) {
+ * Iconv handlers can be used only once, free the whole block.
+ * and the associated icon resources.
+ */
+- if ((handler->iconv_out != NULL) || (handler->iconv_in != NULL)) {
++ if ((handler->iconv_out != ICONV_T_NULL) || (handler->iconv_in != ICONV_T_NULL)) {
+ tofree = 1;
+- if (handler->iconv_out != NULL) {
++ if (handler->iconv_out != ICONV_T_NULL) {
+ if (iconv_close(handler->iconv_out))
+ ret = -1;
+- handler->iconv_out = NULL;
++ handler->iconv_out = ICONV_T_NULL;
+ }
+- if (handler->iconv_in != NULL) {
++ if (handler->iconv_in != ICONV_T_NULL) {
+ if (iconv_close(handler->iconv_in))
+ ret = -1;
+- handler->iconv_in = NULL;
++ handler->iconv_in = ICONV_T_NULL;
+ }
+ }
+ #endif /* LIBXML_ICONV_ENABLED */
+--
+2.43.0
+
The patch fixes the following errors and warnings raised by the compilation of the library with uClibc: encoding.c: In function ‘xmlEncInputChunk’: encoding.c:2209:32: warning: comparison between pointer and integer 2209 | else if (handler->iconv_in != NULL) { | ^~ encoding.c: In function ‘xmlEncOutputChunk’: encoding.c:2269:33: warning: comparison between pointer and integer 2269 | else if (handler->iconv_out != NULL) { | ^~ encoding.c: In function ‘xmlCharEncCloseFunc’: encoding.c:2681:29: warning: comparison between pointer and integer 2681 | if ((handler->iconv_out != NULL) || (handler->iconv_in != NULL)) { | ^~ encoding.c:2681:60: warning: comparison between pointer and integer 2681 | if ((handler->iconv_out != NULL) || (handler->iconv_in != NULL)) { | ^~ encoding.c:2683:32: warning: comparison between pointer and integer 2683 | if (handler->iconv_out != NULL) { | ^~ encoding.c:2686:32: error: assignment to ‘iconv_t’ {aka ‘long int’} from ‘void *’ makes integer from pointer without a cast [-Wint-conversion] 2686 | handler->iconv_out = NULL; | ^ encoding.c:2688:31: warning: comparison between pointer and integer 2688 | if (handler->iconv_in != NULL) { | ^~ encoding.c:2691:31: error: assignment to ‘iconv_t’ {aka ‘long int’} from ‘void *’ makes integer from pointer without a cast [-Wint-conversion] 2691 | handler->iconv_in = NULL; | ^ make[4]: *** [Makefile:1147: libxml2_la-encoding.lo] Error 1 Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> --- .../0001-Fix-compilation-with-uclibc.patch | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 package/libxml2/0001-Fix-compilation-with-uclibc.patch