gettext: Fix build issue with system libxml2

The upstream fix is explicitly checking libxml2 version so it's not
practical to be turned into a sed.  But I don't want to upload another
patch just for such a "temporary" issue (as it'll be fixed for 0.23.1
anyway).  This alternative fix relies on:

1. The fact that the return type of xmlCtxtGetLastError and the arg type
   of xmlStructuredErrorFunc are changed in the same commit
   61034116d0a3 ("error: Make more xmlError structs constant").
2. GCC supports typeof(expr) to get the type of expr w/o really
   evaluating it.

So it should have the same effect as the upstream fix.

Tested with both --with-included-libxml2 and --without-included-libxml2
on BLFS.
This commit is contained in:
Xi Ruoyao 2024-12-18 10:48:14 +08:00
parent f8bdaa6ff3
commit e5955cd62a
No known key found for this signature in database
GPG Key ID: ACAAD20E19E710E3

View File

@ -43,6 +43,14 @@
<sect2 role="installation">
<title>Installation of Gettext</title>
<para>At first, fix an issue causing the package fail to build with
libxml-2.12 or later. The fix is optional for building LFS, but
required if rebuilding this package in BLFS with libxml
installed:</para>
<screen><userinput remap="pre">sed -e '/^structured/s/xmlError \*/typeof(xmlCtxtGetLastError(NULL)) /' \
-i gettext-tools/src/its.c</userinput></screen>
<para>Prepare Gettext for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \