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