Skip to content

Commit 684ed1d

Browse files
authored
Merge pull request #3858 from masatake/lxpath--newer-libxml2-API
build-sys: don't use libxml-2 if its CRLF handling is broken
2 parents bcd621e + 600075f commit 684ed1d

File tree

8 files changed

+188
-31
lines changed

8 files changed

+188
-31
lines changed

.github/workflows/testing-msys2.yml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ jobs:
1111
runs-on: windows-latest
1212

1313
strategy:
14+
fail-fast: false
1415
matrix:
15-
msystem: [MSYS, MINGW32, MINGW64]
16+
msystem: [MINGW32, MINGW64, CLANG32, CLANG64]
1617

1718
defaults:
1819
run:
@@ -23,22 +24,12 @@ jobs:
2324
with:
2425
msystem: ${{ matrix.msystem }}
2526
update: true
26-
install: git make automake1.16 autoconf
27-
28-
- if: matrix.msystem == 'MSYS'
29-
run: pacman -S --noconfirm gcc libiconv-devel pkg-config python dos2unix
30-
31-
- if: matrix.msystem == 'MINGW32'
32-
run: pacman -S --noconfirm mingw-w64-i686-toolchain python dos2unix
33-
34-
- if: matrix.msystem == 'MINGW64'
35-
run: pacman -S --noconfirm mingw-w64-x86_64-toolchain python dos2unix
36-
37-
- run: ln -s /usr/bin/automake-1.16 /usr/bin/automake
38-
- run: ln -s /usr/bin/aclocal-1.16 /usr/bin/aclocal
27+
install: automake autoconf make dos2unix
28+
pacboy: toolchain:p python3-sphinx:p jansson:p libxml2:p libyaml:p pcre2:p
3929

4030
- run: git config --global core.autocrlf input
4131
shell: bash
32+
4233
- uses: actions/checkout@v4
4334

4435
- run: ./autogen.sh
@@ -52,8 +43,7 @@ jobs:
5243

5344
# FAILED: "./readtags.exe" -t "/d/a/ctags2/ctags2/Units/parser-asciidoc.r/utf8-asciidoc.d/expected.tags" - "@Ѐ–𐀀"
5445
# The raw tag name was "@Ѐ–𐀀"
55-
- if: matrix.msystem == 'MSYS'
56-
run: make roundtrip
46+
#- run: make roundtrip
5747

5848
- run: make tmain
5949
- run: make units
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--language-force=ant
2+
--extras=+r
3+
--fields=+rln
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
MyProject input.xml /^<project name="MyProject" default="deploy" basedir=".">$/;" p line:3 language:Ant roles:def
2+
another.ant input.xml /^ <import file="another.ant"\/>$/;" i line:4 language:Ant project:MyProject roles:imported
3+
base.classpath input.xml /^ <path id="base.classpath">$/;" i line:11 language:XML roles:def
4+
clean input.xml /^ <target name="clean" depends="init">$/;" t line:16 language:Ant project:MyProject roles:def
5+
compile_something input.xml /^ <target name="compile_something" depends="init">$/;" t line:23 language:Ant project:MyProject roles:def
6+
deploy input.xml /^ <target name="deploy" depends="compile_something, generate_h_from_java">$/;" t line:68 language:Ant project:MyProject roles:def
7+
generate_h_from_java input.xml /^ <target name="generate_h_from_java" depends="compile_something">$/;" t line:47 language:Ant project:MyProject roles:def
8+
init input.xml /^ <target name="init">$/;" t line:6 language:Ant project:MyProject roles:def
9+
javadoc input.xml /^ <target name="javadoc">$/;" t line:52 language:Ant project:MyProject roles:def
10+
x input.xml /^ <property name="x" value="y" \/>$/;" P line:5 language:Ant project:MyProject roles:def
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
xpath
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
3+
<project name="MyProject" default="deploy" basedir=".">
4+
<import file="another.ant"/>
5+
<property name="x" value="y" />
6+
<target name="init">
7+
<property environment="envvars" />
8+
<property name="rootDir" value="." />
9+
<property name="srcDir" value="${rootDir}/src" />
10+
11+
<path id="base.classpath">
12+
<pathelement location="${buildDir}" />
13+
</path>
14+
</target>
15+
16+
<target name="clean" depends="init">
17+
<delete dir="${buildDir}"
18+
verbose="false"
19+
quiet="false"
20+
/>
21+
</target>
22+
23+
<target name="compile_something" depends="init">
24+
<mkdir dir="${buildDir}" />
25+
<mkdir dir="${buildDir}/images" />
26+
<javac srcdir="${javaDir}"
27+
destdir="${buildDir}"
28+
debug="on"
29+
optimize="off"
30+
verbose="no"
31+
listfiles="yes"
32+
deprecation="no"
33+
classpathref="base.classpath"
34+
/>
35+
36+
<copy toDir="${buildDir}/images">
37+
<fileset dir="${javaImagesDir}" includes="*.*" />
38+
</copy>
39+
40+
</target>
41+
42+
<!--target name="generate_h_from_java" depends="compile_something">
43+
<exec executable="javah" dir="${buildDir}">
44+
</exec>
45+
</target-->
46+
47+
<target name="generate_h_from_java" depends="compile_something">
48+
<javah destdir="${ulgateDir}" classpath="${buildDir}">
49+
</javah>
50+
</target>
51+
52+
<target name="javadoc">
53+
<delete dir="${javaDocDir}"
54+
verbose="false"
55+
quiet="false"
56+
/>
57+
<mkdir dir="${javaDocDir}" />
58+
<javadoc destdir="${javaDocDir}"
59+
classpathref="base.classpath"
60+
link="http://java.sun.com/j2se/1.4.1/docs/api/"
61+
verbose="no"
62+
additionalparam="-breakiterator"
63+
>
64+
<fileset dir="${javaDir}" />
65+
</javadoc>
66+
</target>
67+
68+
<target name="deploy" depends="compile_something, generate_h_from_java">
69+
70+
<delete dir="${deployDir}"
71+
verbose="false"
72+
quiet="false"
73+
/>
74+
<mkdir dir="${deployDir}" />
75+
<mkdir dir="${deployDir}/client" />
76+
<mkdir dir="${deployDir}/server" />
77+
78+
<jar jarfile="${deployDir}/server/something.jar">
79+
<fileset dir="${buildDir}"
80+
includes="images/**"
81+
/>
82+
</jar>
83+
84+
<copy toDir="${deployDir}/client" verbose="Yes" >
85+
<fileset dir="${binDir}" includes="startClient.cmd" />
86+
<fileset dir="${binDir}" includes="killProcess.vbs" />
87+
</copy>
88+
89+
<copy toDir="${deployDir}/server/sql" verbose="Yes" >
90+
<fileset dir="${sqlDir}" includes="*.sql" />
91+
</copy>
92+
93+
<copy toDir="${deployDir}/server/samples">
94+
<fileset dir="${samplesDir}" includes="**/*.*" />
95+
</copy>
96+
97+
<copy toDir="${deployDir}/doc">
98+
<fileset dir="${docDir}" includes="**/*.*" />
99+
</copy>
100+
101+
</target>
102+
103+
</project>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
--language-force=ant
22
--extras=+r
3-
--fields=+rl
3+
--fields=+rln
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
MyProject input.xml /^<project name="MyProject" default="deploy" basedir=".">$/;" p language:Ant roles:def
2-
another.ant input.xml /^ <import file="another.ant"\/>$/;" i language:Ant project:MyProject roles:imported
3-
base.classpath input.xml /^ <path id="base.classpath">$/;" i language:XML roles:def
4-
clean input.xml /^ <target name="clean" depends="init">$/;" t language:Ant project:MyProject roles:def
5-
compile_something input.xml /^ <target name="compile_something" depends="init">$/;" t language:Ant project:MyProject roles:def
6-
deploy input.xml /^ <target name="deploy" depends="compile_something, generate_h_from_java">$/;" t language:Ant project:MyProject roles:def
7-
generate_h_from_java input.xml /^ <target name="generate_h_from_java" depends="compile_something">$/;" t language:Ant project:MyProject roles:def
8-
init input.xml /^ <target name="init">$/;" t language:Ant project:MyProject roles:def
9-
javadoc input.xml /^ <target name="javadoc">$/;" t language:Ant project:MyProject roles:def
10-
x input.xml /^ <property name="x" value="y" \/>$/;" P language:Ant project:MyProject roles:def
1+
MyProject input.xml /^<project name="MyProject" default="deploy" basedir=".">$/;" p line:3 language:Ant roles:def
2+
another.ant input.xml /^ <import file="another.ant"\/>$/;" i line:4 language:Ant project:MyProject roles:imported
3+
base.classpath input.xml /^ <path id="base.classpath">$/;" i line:11 language:XML roles:def
4+
clean input.xml /^ <target name="clean" depends="init">$/;" t line:16 language:Ant project:MyProject roles:def
5+
compile_something input.xml /^ <target name="compile_something" depends="init">$/;" t line:23 language:Ant project:MyProject roles:def
6+
deploy input.xml /^ <target name="deploy" depends="compile_something, generate_h_from_java">$/;" t line:68 language:Ant project:MyProject roles:def
7+
generate_h_from_java input.xml /^ <target name="generate_h_from_java" depends="compile_something">$/;" t line:47 language:Ant project:MyProject roles:def
8+
init input.xml /^ <target name="init">$/;" t line:6 language:Ant project:MyProject roles:def
9+
javadoc input.xml /^ <target name="javadoc">$/;" t line:52 language:Ant project:MyProject roles:def
10+
x input.xml /^ <property name="x" value="y" \/>$/;" P line:5 language:Ant project:MyProject roles:def

configure.ac

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -654,11 +654,61 @@ dnl About the condition of version
654654
dnl see https://mail.gnome.org/archives/xml/2010-February/msg00008.html
655655
AS_IF([test "x$enable_xml" != "xno"], [
656656
PKG_CHECK_MODULES(LIBXML, [libxml-2.0 >= 2.7.7],
657-
[have_libxml=yes
658-
AC_DEFINE(HAVE_LIBXML)],
659-
[AS_IF([test "x$enable_xml" = "xyes"], [
660-
AC_MSG_ERROR([libxml2 not found])])])
657+
[AC_MSG_CHECKING([libxml-2.0 CRLF handling bug])
658+
ORIGINAL_CFLAGS=$CFLAGS
659+
ORIGINAL_LIBS=$LIBS
660+
CFLAGS="$CFLAGS $LIBXML_CFLAGS"
661+
LIBS="$LIBS $LIBXML_LIBS"
662+
AC_RUN_IFELSE([AC_LANG_SOURCE([[
663+
#include <libxml/parser.h>
664+
#include <libxml/tree.h>
665+
#include <string.h>
666+
667+
#define CRLF "\r\n"
668+
#define __LF " \n"
669+
670+
const char * crlf = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><root><!---->"CRLF CRLF"<target/></root>";
671+
const char * __lf = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><root><!---->"__LF __LF"<target/></root>";
672+
673+
static int run(const char *input)
674+
{
675+
xmlDocPtr doc = xmlParseMemory(input, strlen(input));
676+
xmlNode *root = xmlDocGetRootElement(doc);
677+
xmlNode *node = root->children->next->next;
678+
return node->line;
679+
}
680+
681+
int main(void)
682+
{
683+
xmlLineNumbersDefault (1);
684+
return run(crlf) == run(__lf)? 0: 1;
685+
}]])],[AC_MSG_RESULT([good])
686+
have_libxml=yes
687+
CFLAGS=$ORIGINAL_CFLAGS
688+
LIBS=$ORIGINAL_LIBS
689+
AC_DEFINE(HAVE_LIBXML)],
690+
[AC_MSG_RESULT([bad])
691+
AC_MSG_WARN([Xpath feature is disabled because the way of handling CRLF in libxml2 is broken.
692+
See https://gitlab.gnome.org/GNOME/libxml2/-/commit/43b511fa714df875dc4f40d108061eede0d4d76b])],
693+
dnl In a context of cross-compiling: We can not do try-run.
694+
dnl Instead, we check the version number only.
695+
[PKG_CHECK_MODULES(LIBXML12d0, [libxml-2.0 = 2.12.0],
696+
[AC_MSG_WARN([Xpath feature is disabled because the way of handling CRLF in libxml2 2.12.0 may be broken.
697+
See https://gitlab.gnome.org/GNOME/libxml2/-/commit/43b511fa714df875dc4f40d108061eede0d4d76b])
698+
have_libxml=no],[
699+
PKG_CHECK_MODULES(LIBXML12d1, [libxml-2.0 = 2.12.1],
700+
[AC_MSG_WARN([Xpath feature is disabled because the way of handling CRLF in libxml2 2.12.1 may be broken.
701+
See https://gitlab.gnome.org/GNOME/libxml2/-/commit/43b511fa714df875dc4f40d108061eede0d4d76b])
702+
have_libxml=no],
703+
dnl The available libxml-2.0 is not 2.12.[01].
704+
[have_libxml=yes
705+
AC_DEFINE(HAVE_LIBXML)
706+
])])]
707+
)],
708+
[AS_IF([test "x$enable_xml" = "xyes"], [
709+
AC_MSG_ERROR([libxml2 not found])])])
661710
])
711+
662712
AM_CONDITIONAL(HAVE_LIBXML, test "x$have_libxml" = xyes)
663713

664714
if test "${enable_static}" = "yes"; then

0 commit comments

Comments
 (0)