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 and shell (on) 49 --with-history history support for shell (off) 50 --with-readline[=DIR] use readline in DIR (for shell history) 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 126meson setup builddir 127ninja -C builddir 128 129To add options, see the meson_options.txt file. For example: 130 131meson setup -Dprefix=$prefix -Dftp=true -Dhistory=true -Dicu=true -Dhttp=true builddir 132 133To install libxml: 134 135ninja -C builddir install 136 137To launch tests: 138 139meson test -C builddir 140 141## Dependencies 142 143Libxml does not require any other libraries. A platform with somewhat 144recent POSIX support should be sufficient (please report any violation 145to this rule you may find). 146 147The iconv function is required for conversion of character encodings. 148This function is part of POSIX.1-2001. If your platform doesn't provide 149iconv, you need an external libiconv library, for example 150[GNU libiconv](https://www.gnu.org/software/libiconv/). Alternatively, 151you can use [ICU](https://icu.unicode.org/). 152 153If enabled, libxml uses [libz](https://zlib.net/) or 154[liblzma](https://tukaani.org/xz/) to support reading compressed files. 155Use of this feature is discouraged. 156 157## Contributing 158 159The current version of the code can be found in GNOME's GitLab at 160at <https://gitlab.gnome.org/GNOME/libxml2>. The best way to get involved 161is by creating issues and merge requests on GitLab. 162 163All code must conform to C89 and pass the GitLab CI tests. Add regression 164tests if possible. 165 166## Authors 167 168- Daniel Veillard 169- Bjorn Reese 170- William Brack 171- Igor Zlatkovic for the Windows port 172- Aleksey Sanin 173- Nick Wellnhofer 174 175