• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..12-Nov-2020-

cmake/H12-Nov-2020-11398

conftools/H12-Nov-2020-547456

doc/H03-May-2022-615511

examples/H12-Nov-2020-258125

gennmtab/H12-Nov-2020-452406

lib/H12-Nov-2020-14,80011,643

win32/H03-May-2022-154131

xmlwf/H12-Nov-2020-2,6521,914

.clang-formatH A D07-Nov-20203.6 KiB128126

AUTHORSH A D07-Nov-2020142 119

CMake.READMEH A D07-Nov-20201.7 KiB4336

COPYINGH A D07-Nov-20201.1 KiB2218

ChangesH A D07-Nov-202038.4 KiB774720

ConfigureChecks.cmakeH A D07-Nov-20202.1 KiB6758

Makefile.amH A D07-Nov-20204.7 KiB155107

README.mdH A D07-Nov-20206.6 KiB189140

acinclude.m4H A D07-Nov-2020371 1310

apply-clang-format.shH A D07-Nov-20201.9 KiB5016

buildconf.shH A D07-Nov-202067 31

clean_coverage.shH A D07-Nov-2020149 103

configure-ac-style.mdH A D07-Nov-20201.5 KiB8663

configure.acH A D07-Nov-202011.5 KiB323279

coverage.shH A D07-Nov-20206.9 KiB289211

distribute.shH A D07-Nov-2020541 3018

expat.pc.inH A D07-Nov-2020251 1210

expat_config.h.cmakeH A D07-Nov-20203.3 KiB11679

fix-xmltest-log.shH A D07-Nov-20202.1 KiB4915

qa.shH A D07-Nov-20206 KiB276205

run.sh.inH A D07-Nov-2020181 138

test-driver-wrapper.shH A D07-Nov-20201.8 KiB4410

CMake.README

1== How to build expat with cmake (experimental) ==
2
3The cmake based buildsystem for expat works on Windows (cygwin, mingw, Visual
4Studio) and should work on all other platform cmake supports.
5
6Assuming ~/expat-2.2.9 is the source directory of expat, add a subdirectory
7build and change into that directory:
8~/expat-2.2.9$ mkdir build && cd build
9~/expat-2.2.9/build$
10
11From that directory, call cmake first, then call make, make test and
12make install in the usual way:
13~/expat-2.2.9/build$ cmake ..
14-- The C compiler identification is GNU
15-- The CXX compiler identification is GNU
16....
17-- Configuring done
18-- Generating done
19-- Build files have been written to: /home/patrick/expat-2.2.9/build
20
21If you want to specify the install location for your files, append
22-DCMAKE_INSTALL_PREFIX=/your/install/path to the cmake call.
23
24~/expat-2.2.9/build$ make && make test && make install
25Scanning dependencies of target expat
26[  5%] Building C object CMakeFiles/expat.dir/lib/xmlparse.c.o
27[ 11%] Building C object CMakeFiles/expat.dir/lib/xmlrole.c.o
28....
29-- Installing: /usr/local/lib/pkgconfig/expat.pc
30-- Installing: /usr/local/bin/xmlwf
31-- Installing: /usr/local/share/man/man1/xmlwf.1
32
33For Windows builds, you must make sure to call cmake from an environment where
34your compiler is reachable, that means either you call it from the
35Visual Studio Command Prompt or when using mingw, you must open a cmd.exe and
36make sure that gcc can be called. On Windows, you also might want to specify a
37special Generator for CMake:
38for Visual Studio builds do:
39cmake .. -G "Visual Studio 15 2017" && msbuild /m expat.sln
40for mingw builds do:
41cmake .. -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=D:\expat-install
42    && gmake && gmake install
43

README.md

1[![Travis CI Build Status](https://travis-ci.org/libexpat/libexpat.svg?branch=master)](https://travis-ci.org/libexpat/libexpat)
2[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/libexpat/libexpat?svg=true)](https://ci.appveyor.com/project/libexpat/libexpat)
3[![Packaging status](https://repology.org/badge/tiny-repos/expat.svg)](https://repology.org/metapackage/expat/versions)
4
5
6# Expat, Release 2.2.9
7
8This is Expat, a C library for parsing XML, started by
9[James Clark](https://en.wikipedia.org/wiki/James_Clark_(programmer)) in 1997.
10Expat is a stream-oriented XML parser.  This means that you register
11handlers with the parser before starting the parse.  These handlers
12are called when the parser discovers the associated structures in the
13document being parsed.  A start tag is an example of the kind of
14structures for which you may register handlers.
15
16Expat supports the following compilers:
17- GNU GCC >=4.5
18- LLVM Clang >=3.5
19- Microsoft Visual Studio >=8.0/2005
20
21Windows users should use the
22[`expat_win32` package](https://sourceforge.net/projects/expat/files/expat_win32/),
23which includes both precompiled libraries and executables, and source code for
24developers.
25
26Expat is [free software](https://www.gnu.org/philosophy/free-sw.en.html).
27You may copy, distribute, and modify it under the terms of the License
28contained in the file
29[`COPYING`](https://github.com/libexpat/libexpat/blob/master/expat/COPYING)
30distributed with this package.
31This license is the same as the MIT/X Consortium license.
32
33If you are building Expat from a check-out from the
34[Git repository](https://github.com/libexpat/libexpat/),
35you need to run a script that generates the configure script using the
36GNU autoconf and libtool tools.  To do this, you need to have
37autoconf 2.58 or newer. Run the script like this:
38
39```console
40./buildconf.sh
41```
42
43Once this has been done, follow the same instructions as for building
44from a source distribution.
45
46To build Expat from a source distribution, you first run the
47configuration shell script in the top level distribution directory:
48
49```console
50./configure
51```
52
53There are many options which you may provide to configure (which you
54can discover by running configure with the `--help` option).  But the
55one of most interest is the one that sets the installation directory.
56By default, the configure script will set things up to install
57libexpat into `/usr/local/lib`, `expat.h` into `/usr/local/include`, and
58`xmlwf` into `/usr/local/bin`.  If, for example, you'd prefer to install
59into `/home/me/mystuff/lib`, `/home/me/mystuff/include`, and
60`/home/me/mystuff/bin`, you can tell `configure` about that with:
61
62```console
63./configure --prefix=/home/me/mystuff
64```
65
66Another interesting option is to enable 64-bit integer support for
67line and column numbers and the over-all byte index:
68
69```console
70./configure CPPFLAGS=-DXML_LARGE_SIZE
71```
72
73However, such a modification would be a breaking change to the ABI
74and is therefore not recommended for general use — e.g. as part of
75a Linux distribution — but rather for builds with special requirements.
76
77After running the configure script, the `make` command will build
78things and `make install` will install things into their proper
79location.  Have a look at the `Makefile` to learn about additional
80`make` options.  Note that you need to have write permission into
81the directories into which things will be installed.
82
83If you are interested in building Expat to provide document
84information in UTF-16 encoding rather than the default UTF-8, follow
85these instructions (after having run `make distclean`).
86Please note that we configure with `--without-xmlwf` as xmlwf does not
87support this mode of compilation (yet):
88
891. Mass-patch `Makefile.am` files to use `libexpatw.la` for a library name:
90   <br/>
91   `find -name Makefile.am -exec sed
92       -e 's,libexpat\.la,libexpatw.la,'
93       -e 's,libexpat_la,libexpatw_la,'
94       -i {} +`
95
961. Run `automake` to re-write `Makefile.in` files:<br/>
97   `automake`
98
991. For UTF-16 output as unsigned short (and version/error strings as char),
100   run:<br/>
101   `./configure CPPFLAGS=-DXML_UNICODE --without-xmlwf`<br/>
102   For UTF-16 output as `wchar_t` (incl. version/error strings), run:<br/>
103   `./configure CFLAGS="-g -O2 -fshort-wchar" CPPFLAGS=-DXML_UNICODE_WCHAR_T
104       --without-xmlwf`
105   <br/>Note: The latter requires libc compiled with `-fshort-wchar`, as well.
106
1071. Run `make` (which excludes xmlwf).
108
1091. Run `make install` (again, excludes xmlwf).
110
111Using `DESTDIR` is supported.  It works as follows:
112
113```console
114make install DESTDIR=/path/to/image
115```
116
117overrides the in-makefile set `DESTDIR`, because variable-setting priority is
118
1191. commandline
1201. in-makefile
1211. environment
122
123Note: This only applies to the Expat library itself, building UTF-16 versions
124of xmlwf and the tests is currently not supported.
125
126When using Expat with a project using autoconf for configuration, you
127can use the probing macro in `conftools/expat.m4` to determine how to
128include Expat.  See the comments at the top of that file for more
129information.
130
131A reference manual is available in the file `doc/reference.html` in this
132distribution.
133
134
135The CMake build system is still *experimental* and will replace the primary
136build system based on GNU Autotools at some point when it is ready.
137For an idea of the available (non-advanced) options for building with CMake:
138
139```console
140# rm -f CMakeCache.txt ; cmake -D_EXPAT_HELP=ON -LH . | grep -B1 ':.*=' | sed 's,^--$,,'
141// Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel ...
142CMAKE_BUILD_TYPE:STRING=
143
144// Install path prefix, prepended onto install directories.
145CMAKE_INSTALL_PREFIX:PATH=/usr/local
146
147// Path to a program.
148DOCBOOK_TO_MAN:FILEPATH=/usr/bin/docbook2x-man
149
150// build man page for xmlwf
151EXPAT_BUILD_DOCS:BOOL=ON
152
153// build the examples for expat library
154EXPAT_BUILD_EXAMPLES:BOOL=ON
155
156// build fuzzers for the expat library
157EXPAT_BUILD_FUZZERS:BOOL=OFF
158
159// build the tests for expat library
160EXPAT_BUILD_TESTS:BOOL=ON
161
162// build the xmlwf tool for expat library
163EXPAT_BUILD_TOOLS:BOOL=ON
164
165// Character type to use (char|ushort|wchar_t) [default=char]
166EXPAT_CHAR_TYPE:STRING=char
167
168// install expat files in cmake install target
169EXPAT_ENABLE_INSTALL:BOOL=ON
170
171// Use /MT flag (static CRT) when compiling in MSVC
172EXPAT_MSVC_STATIC_CRT:BOOL=OFF
173
174// build a shared expat library
175EXPAT_SHARED_LIBS:BOOL=ON
176
177// Treat all compiler warnings as errors
178EXPAT_WARNINGS_AS_ERRORS:BOOL=OFF
179
180// Make use of getrandom function (ON|OFF|AUTO) [default=AUTO]
181EXPAT_WITH_GETRANDOM:STRING=AUTO
182
183// utilize libbsd (for arc4random_buf)
184EXPAT_WITH_LIBBSD:BOOL=OFF
185
186// Make use of syscall SYS_getrandom (ON|OFF|AUTO) [default=AUTO]
187EXPAT_WITH_SYS_GETRANDOM:STRING=AUTO
188```
189