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, or several other build 25systems 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 (on) 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 (on) 57 --with-mem-debug memory debugging module (off) 58 --with-modules dynamic modules support (on) 59 --with-output serialization support (on) 60 --with-pattern xmlPattern selection interface (on) 61 --with-push push parser interfaces (on) 62 --with-python Python bindings (on) 63 --with-reader xmlReader parsing interface (on) 64 --with-regexps regular expressions support (on) 65 --with-run-debug runtime debugging module (off) 66 --with-sax1 older SAX1 interface (on) 67 --with-schemas XML Schemas 1.0 and RELAX NG support (on) 68 --with-schematron Schematron support (on) 69 --with-threads multithreading support (on) 70 --with-thread-alloc per-thread malloc hooks (off) 71 --with-tree DOM like tree manipulation APIs (on) 72 --with-valid DTD validation support (on) 73 --with-writer xmlWriter serialization interface (on) 74 --with-xinclude XInclude 1.0 support (on) 75 --with-xpath XPath 1.0 support (on) 76 --with-xptr XPointer support (on) 77 --with-zlib[=DIR] use libz in DIR (on) 78 79Other options: 80 81 --with-minimum build a minimally sized library (off) 82 --with-legacy maximum ABI compatibility (off) 83 84Note that by default, no optimization options are used. You have to 85enable them manually, for example with: 86 87 CFLAGS='-O2 -fno-semantic-interposition' ./configure 88 89Now you can run the test suite with: 90 91 make check 92 93Please report test failures to the mailing list or bug tracker. 94 95Then you can install the library: 96 97 make install 98 99At that point you may have to rerun ldconfig or a similar utility to 100update your list of installed shared libs. 101 102### CMake (mainly for Windows) 103 104Another option for compiling libxml is using CMake: 105 106 cmake -E tar xf libxml2-xxx.tar.gz 107 cmake -S libxml2-xxx -B libxml2-xxx-build [possible options] 108 cmake --build libxml2-xxx-build 109 cmake --install libxml2-xxx-build 110 111Common CMake options include: 112 113 -D BUILD_SHARED_LIBS=OFF # build static libraries 114 -D CMAKE_BUILD_TYPE=Release # specify build type 115 -D CMAKE_INSTALL_PREFIX=/usr/local # specify the install path 116 -D LIBXML2_WITH_ICONV=OFF # disable iconv 117 -D LIBXML2_WITH_LZMA=OFF # disable liblzma 118 -D LIBXML2_WITH_PYTHON=OFF # disable Python 119 -D LIBXML2_WITH_ZLIB=OFF # disable libz 120 121You can also open the libxml source directory with its CMakeLists.txt 122directly in various IDEs such as CLion, QtCreator, or Visual Studio. 123 124## Dependencies 125 126Libxml does not require any other libraries. A platform with somewhat 127recent POSIX support should be sufficient (please report any violation 128to this rule you may find). 129 130However, if found at configuration time, libxml will detect and use 131the following libraries: 132 133- [libz](https://zlib.net/), a highly portable and widely available 134 compression library. 135- [liblzma](https://tukaani.org/xz/), another compression library. 136- [libiconv](https://www.gnu.org/software/libiconv/), a character encoding 137 conversion library. The iconv function is part of POSIX.1-2001, so 138 libiconv isn't required on modern UNIX-like systems like Linux, BSD or 139 macOS. 140- [ICU](https://icu.unicode.org/), a Unicode library. Mainly useful as an 141 alternative to iconv on Windows. Unnecessary on most other systems. 142 143## Contributing 144 145The current version of the code can be found in GNOME's GitLab at 146at <https://gitlab.gnome.org/GNOME/libxml2>. The best way to get involved 147is by creating issues and merge requests on GitLab. Alternatively, you can 148start discussions and send patches to the mailing list. If you want to 149work with patches, please format them with git-format-patch and use plain 150text attachments. 151 152All code must conform to C89 and pass the GitLab CI tests. Add regression 153tests if possible. 154 155## Authors 156 157- Daniel Veillard 158- Bjorn Reese 159- William Brack 160- Igor Zlatkovic for the Windows port 161- Aleksey Sanin 162- Nick Wellnhofer 163 164