]> wimlib.net Git - wimlib/commit - configure.ac
Eliminate the dependency on libxml2
authorEric Biggers <ebiggers3@gmail.com>
Mon, 27 Mar 2023 00:25:46 +0000 (17:25 -0700)
committerEric Biggers <ebiggers3@gmail.com>
Mon, 27 Mar 2023 00:25:46 +0000 (17:25 -0700)
commitcd9959b4f62adfc4a60810e11d253b62b75418de
tree20348e3cf2f7d44d3b7ad5bc9094d6b652d1244f
parentc603efd517dd6f840e021813e671b3588dd02a0c
Eliminate the dependency on libxml2

libxml2 is the only remaining third-party library that Windows builds of
wimlib need.  It's a bit of a pain to have to download it, build it, and
trick libtool into linking it into the resulting DLL.  It then
constitutes a significant part of the size of the resulting DLL, even
with the minimal libxml2 configuration options being used.

In reality, WIM files only use a small subset of XML containing the most
commonly used XML features.  Using a full-featured XML library (that
supports "features" like External Entities that we have to remember to
disable) is a bit dangerous and not actually necessary.  7-Zip's WIM
support, for example, just uses a very minimal home-brew XML processor.

Another issue is that the libxml2 API always uses UTF-8, which causes
the conversion UTF-16LE => UTF-8 => UTF-16LE to be needed on Windows.
This isn't really an "issue", per se, but it shouldn't be necessary.

Finally, wimlib was integrating with libxml2 at a low level via the tree
API, and it overlooked some things.  For example, libxml2 trees have
separate CDATA and TEXT nodes, but wimlib was only looking at TEXT, so
CDATA was ignored.  It was also possible for wimlib to create a document
containing control characters, which is not valid XML so it could not be
read.  These weren't very important issues, but the point is, just using
an XML library doesn't solve quite as many problems as one would hope...

Therefore, just add a simple XML 1.0 processor directly in the source
code.  It handles all XML features that are used in WIM files, plus a
bit more for futureproofing.  It's also faster than libxml2.
19 files changed:
.github/workflows/ci.yml
.gitignore
Makefile.am
NEWS
README
README.WINDOWS
configure.ac
include/wimlib/test_support.h
include/wimlib/xml.h
include/wimlib/xmlproc.h [new file with mode: 0644]
include/wimlib_tchar.h
src/util.c
src/wim.c
src/xml.c
src/xmlproc.c [new file with mode: 0644]
tools/make-windows-release
tools/run-sparse
tools/windeps/Makefile [deleted file]
tools/windeps/sha256sums [deleted file]