1*7c568831SAndroid Build Coastguard Worker# libxml2 2*7c568831SAndroid Build Coastguard Worker 3*7c568831SAndroid Build Coastguard Workerlibxml2 is an XML toolkit implemented in C, originally developed for 4*7c568831SAndroid Build Coastguard Workerthe GNOME Project. 5*7c568831SAndroid Build Coastguard Worker 6*7c568831SAndroid Build Coastguard WorkerOfficial releases can be downloaded from 7*7c568831SAndroid Build Coastguard Worker<https://download.gnome.org/sources/libxml2/> 8*7c568831SAndroid Build Coastguard Worker 9*7c568831SAndroid Build Coastguard WorkerThe git repository is hosted on GNOME's GitLab server: 10*7c568831SAndroid Build Coastguard Worker<https://gitlab.gnome.org/GNOME/libxml2> 11*7c568831SAndroid Build Coastguard Worker 12*7c568831SAndroid Build Coastguard WorkerBugs should be reported at 13*7c568831SAndroid Build Coastguard Worker<https://gitlab.gnome.org/GNOME/libxml2/-/issues> 14*7c568831SAndroid Build Coastguard Worker 15*7c568831SAndroid Build Coastguard WorkerDocumentation is available at 16*7c568831SAndroid Build Coastguard Worker<https://gitlab.gnome.org/GNOME/libxml2/-/wikis> 17*7c568831SAndroid Build Coastguard Worker 18*7c568831SAndroid Build Coastguard Worker## License 19*7c568831SAndroid Build Coastguard Worker 20*7c568831SAndroid Build Coastguard WorkerThis code is released under the MIT License, see the Copyright file. 21*7c568831SAndroid Build Coastguard Worker 22*7c568831SAndroid Build Coastguard Worker## Build instructions 23*7c568831SAndroid Build Coastguard Worker 24*7c568831SAndroid Build Coastguard Workerlibxml2 can be built with GNU Autotools, CMake, meson or several other 25*7c568831SAndroid Build Coastguard Workerbuild systems in platform-specific subdirectories. 26*7c568831SAndroid Build Coastguard Worker 27*7c568831SAndroid Build Coastguard Worker### Autotools (for POSIX systems like Linux, BSD, macOS) 28*7c568831SAndroid Build Coastguard Worker 29*7c568831SAndroid Build Coastguard WorkerIf you build from a Git tree, you have to install Autotools and start 30*7c568831SAndroid Build Coastguard Workerby generating the configuration files with: 31*7c568831SAndroid Build Coastguard Worker 32*7c568831SAndroid Build Coastguard Worker ./autogen.sh [configuration options] 33*7c568831SAndroid Build Coastguard Worker 34*7c568831SAndroid Build Coastguard WorkerIf you build from a source tarball, extract the archive with: 35*7c568831SAndroid Build Coastguard Worker 36*7c568831SAndroid Build Coastguard Worker tar xf libxml2-xxx.tar.gz 37*7c568831SAndroid Build Coastguard Worker cd libxml2-xxx 38*7c568831SAndroid Build Coastguard Worker 39*7c568831SAndroid Build Coastguard WorkerThen you can configure and build the library: 40*7c568831SAndroid Build Coastguard Worker 41*7c568831SAndroid Build Coastguard Worker ./configure [configuration options] 42*7c568831SAndroid Build Coastguard Worker make 43*7c568831SAndroid Build Coastguard Worker 44*7c568831SAndroid Build Coastguard WorkerThe following options disable or enable code modules and relevant symbols: 45*7c568831SAndroid Build Coastguard Worker 46*7c568831SAndroid Build Coastguard Worker --with-c14n Canonical XML 1.0 support (on) 47*7c568831SAndroid Build Coastguard Worker --with-catalog XML Catalogs support (on) 48*7c568831SAndroid Build Coastguard Worker --with-debug debugging module (on) 49*7c568831SAndroid Build Coastguard Worker --with-history history support for xmllint shell (off) 50*7c568831SAndroid Build Coastguard Worker --with-readline[=DIR] use readline in DIR for shell (off) 51*7c568831SAndroid Build Coastguard Worker --with-html HTML parser (on) 52*7c568831SAndroid Build Coastguard Worker --with-http HTTP support (off) 53*7c568831SAndroid Build Coastguard Worker --with-iconv[=DIR] iconv support (on) 54*7c568831SAndroid Build Coastguard Worker --with-icu ICU support (off) 55*7c568831SAndroid Build Coastguard Worker --with-iso8859x ISO-8859-X support if no iconv (on) 56*7c568831SAndroid Build Coastguard Worker --with-lzma[=DIR] use liblzma in DIR (off) 57*7c568831SAndroid Build Coastguard Worker --with-modules dynamic modules support (on) 58*7c568831SAndroid Build Coastguard Worker --with-output serialization support (on) 59*7c568831SAndroid Build Coastguard Worker --with-pattern xmlPattern selection interface (on) 60*7c568831SAndroid Build Coastguard Worker --with-push push parser interfaces (on) 61*7c568831SAndroid Build Coastguard Worker --with-python Python bindings (on) 62*7c568831SAndroid Build Coastguard Worker --with-reader xmlReader parsing interface (on) 63*7c568831SAndroid Build Coastguard Worker --with-regexps regular expressions support (on) 64*7c568831SAndroid Build Coastguard Worker --with-sax1 older SAX1 interface (on) 65*7c568831SAndroid Build Coastguard Worker --with-schemas XML Schemas 1.0 and RELAX NG support (on) 66*7c568831SAndroid Build Coastguard Worker --with-schematron Schematron support (on) 67*7c568831SAndroid Build Coastguard Worker --with-threads multithreading support (on) 68*7c568831SAndroid Build Coastguard Worker --with-thread-alloc per-thread malloc hooks (off) 69*7c568831SAndroid Build Coastguard Worker --with-tree DOM like tree manipulation APIs (on) 70*7c568831SAndroid Build Coastguard Worker --with-valid DTD validation support (on) 71*7c568831SAndroid Build Coastguard Worker --with-writer xmlWriter serialization interface (on) 72*7c568831SAndroid Build Coastguard Worker --with-xinclude XInclude 1.0 support (on) 73*7c568831SAndroid Build Coastguard Worker --with-xpath XPath 1.0 support (on) 74*7c568831SAndroid Build Coastguard Worker --with-xptr XPointer support (on) 75*7c568831SAndroid Build Coastguard Worker --with-zlib[=DIR] use libz in DIR (off) 76*7c568831SAndroid Build Coastguard Worker 77*7c568831SAndroid Build Coastguard WorkerOther options: 78*7c568831SAndroid Build Coastguard Worker 79*7c568831SAndroid Build Coastguard Worker --with-minimum build a minimally sized library (off) 80*7c568831SAndroid Build Coastguard Worker --with-legacy maximum ABI compatibility (off) 81*7c568831SAndroid Build Coastguard Worker 82*7c568831SAndroid Build Coastguard WorkerNote that by default, no optimization options are used. You have to 83*7c568831SAndroid Build Coastguard Workerenable them manually, for example with: 84*7c568831SAndroid Build Coastguard Worker 85*7c568831SAndroid Build Coastguard Worker CFLAGS='-O2 -fno-semantic-interposition' ./configure 86*7c568831SAndroid Build Coastguard Worker 87*7c568831SAndroid Build Coastguard WorkerNow you can run the test suite with: 88*7c568831SAndroid Build Coastguard Worker 89*7c568831SAndroid Build Coastguard Worker make check 90*7c568831SAndroid Build Coastguard Worker 91*7c568831SAndroid Build Coastguard WorkerPlease report test failures to the bug tracker. 92*7c568831SAndroid Build Coastguard Worker 93*7c568831SAndroid Build Coastguard WorkerThen you can install the library: 94*7c568831SAndroid Build Coastguard Worker 95*7c568831SAndroid Build Coastguard Worker make install 96*7c568831SAndroid Build Coastguard Worker 97*7c568831SAndroid Build Coastguard WorkerAt that point you may have to rerun ldconfig or a similar utility to 98*7c568831SAndroid Build Coastguard Workerupdate your list of installed shared libs. 99*7c568831SAndroid Build Coastguard Worker 100*7c568831SAndroid Build Coastguard Worker### CMake (mainly for Windows) 101*7c568831SAndroid Build Coastguard Worker 102*7c568831SAndroid Build Coastguard WorkerAnother option for compiling libxml is using CMake: 103*7c568831SAndroid Build Coastguard Worker 104*7c568831SAndroid Build Coastguard Worker cmake -E tar xf libxml2-xxx.tar.gz 105*7c568831SAndroid Build Coastguard Worker cmake -S libxml2-xxx -B libxml2-xxx-build [possible options] 106*7c568831SAndroid Build Coastguard Worker cmake --build libxml2-xxx-build 107*7c568831SAndroid Build Coastguard Worker cmake --install libxml2-xxx-build 108*7c568831SAndroid Build Coastguard Worker 109*7c568831SAndroid Build Coastguard WorkerCommon CMake options include: 110*7c568831SAndroid Build Coastguard Worker 111*7c568831SAndroid Build Coastguard Worker -D BUILD_SHARED_LIBS=OFF # build static libraries 112*7c568831SAndroid Build Coastguard Worker -D CMAKE_BUILD_TYPE=Release # specify build type 113*7c568831SAndroid Build Coastguard Worker -D CMAKE_INSTALL_PREFIX=/usr/local # specify the install path 114*7c568831SAndroid Build Coastguard Worker -D LIBXML2_WITH_ICONV=OFF # disable iconv 115*7c568831SAndroid Build Coastguard Worker -D LIBXML2_WITH_LZMA=OFF # disable liblzma 116*7c568831SAndroid Build Coastguard Worker -D LIBXML2_WITH_PYTHON=OFF # disable Python 117*7c568831SAndroid Build Coastguard Worker -D LIBXML2_WITH_ZLIB=OFF # disable libz 118*7c568831SAndroid Build Coastguard Worker 119*7c568831SAndroid Build Coastguard WorkerYou can also open the libxml source directory with its CMakeLists.txt 120*7c568831SAndroid Build Coastguard Workerdirectly in various IDEs such as CLion, QtCreator, or Visual Studio. 121*7c568831SAndroid Build Coastguard Worker 122*7c568831SAndroid Build Coastguard Worker### Meson 123*7c568831SAndroid Build Coastguard Worker 124*7c568831SAndroid Build Coastguard WorkerLibxml can also be built with meson. Without option, simply call 125*7c568831SAndroid Build Coastguard Worker 126*7c568831SAndroid Build Coastguard Worker meson setup builddir 127*7c568831SAndroid Build Coastguard Worker ninja -C builddir 128*7c568831SAndroid Build Coastguard Worker 129*7c568831SAndroid Build Coastguard WorkerTo add options, see the meson_options.txt file. For example: 130*7c568831SAndroid Build Coastguard Worker 131*7c568831SAndroid Build Coastguard Worker meson setup \ 132*7c568831SAndroid Build Coastguard Worker -Dprefix=$prefix \ 133*7c568831SAndroid Build Coastguard Worker -Dhistory=enabled \ 134*7c568831SAndroid Build Coastguard Worker -Dhttp=enabled \ 135*7c568831SAndroid Build Coastguard Worker -Dschematron=disabled \ 136*7c568831SAndroid Build Coastguard Worker -Dzlib=enabled \ 137*7c568831SAndroid Build Coastguard Worker builddir 138*7c568831SAndroid Build Coastguard Worker 139*7c568831SAndroid Build Coastguard WorkerTo install libxml: 140*7c568831SAndroid Build Coastguard Worker 141*7c568831SAndroid Build Coastguard Worker ninja -C builddir install 142*7c568831SAndroid Build Coastguard Worker 143*7c568831SAndroid Build Coastguard WorkerTo launch tests: 144*7c568831SAndroid Build Coastguard Worker 145*7c568831SAndroid Build Coastguard Worker meson test -C builddir 146*7c568831SAndroid Build Coastguard Worker 147*7c568831SAndroid Build Coastguard Worker## Dependencies 148*7c568831SAndroid Build Coastguard Worker 149*7c568831SAndroid Build Coastguard WorkerLibxml does not require any other libraries. A platform with somewhat 150*7c568831SAndroid Build Coastguard Workerrecent POSIX support should be sufficient (please report any violation 151*7c568831SAndroid Build Coastguard Workerto this rule you may find). 152*7c568831SAndroid Build Coastguard Worker 153*7c568831SAndroid Build Coastguard WorkerThe iconv function is required for conversion of character encodings. 154*7c568831SAndroid Build Coastguard WorkerThis function is part of POSIX.1-2001. If your platform doesn't provide 155*7c568831SAndroid Build Coastguard Workericonv, you need an external libiconv library, for example 156*7c568831SAndroid Build Coastguard Worker[GNU libiconv](https://www.gnu.org/software/libiconv/). Alternatively, 157*7c568831SAndroid Build Coastguard Workeryou can use [ICU](https://icu.unicode.org/). 158*7c568831SAndroid Build Coastguard Worker 159*7c568831SAndroid Build Coastguard WorkerIf enabled, libxml uses [libz](https://zlib.net/) or 160*7c568831SAndroid Build Coastguard Worker[liblzma](https://tukaani.org/xz/) to support reading compressed files. 161*7c568831SAndroid Build Coastguard WorkerUse of this feature is discouraged. 162*7c568831SAndroid Build Coastguard Worker 163*7c568831SAndroid Build Coastguard Worker## Contributing 164*7c568831SAndroid Build Coastguard Worker 165*7c568831SAndroid Build Coastguard WorkerThe current version of the code can be found in GNOME's GitLab at 166*7c568831SAndroid Build Coastguard Workerat <https://gitlab.gnome.org/GNOME/libxml2>. The best way to get involved 167*7c568831SAndroid Build Coastguard Workeris by creating issues and merge requests on GitLab. 168*7c568831SAndroid Build Coastguard Worker 169*7c568831SAndroid Build Coastguard WorkerAll code must conform to C89 and pass the GitLab CI tests. Add regression 170*7c568831SAndroid Build Coastguard Workertests if possible. 171*7c568831SAndroid Build Coastguard Worker 172*7c568831SAndroid Build Coastguard Worker## Authors 173*7c568831SAndroid Build Coastguard Worker 174*7c568831SAndroid Build Coastguard Worker- Daniel Veillard 175*7c568831SAndroid Build Coastguard Worker- Bjorn Reese 176*7c568831SAndroid Build Coastguard Worker- William Brack 177*7c568831SAndroid Build Coastguard Worker- Igor Zlatkovic for the Windows port 178*7c568831SAndroid Build Coastguard Worker- Aleksey Sanin 179*7c568831SAndroid Build Coastguard Worker- Nick Wellnhofer 180*7c568831SAndroid Build Coastguard Worker 181