|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| cmake/ | | 03-May-2024 | - | 322 | 272 |
| conftools/ | | 03-May-2024 | - | 17,662 | 13,303 |
| doc/ | | 03-May-2024 | - | 3,952 | 3,451 |
| examples/ | | 03-May-2024 | - | 929 | 678 |
| lib/ | | 03-May-2024 | - | 15,621 | 12,333 |
| m4/ | | 03-May-2024 | - | 9,075 | 8,202 |
| patches/ | | 03-May-2024 | - | 42 | 34 |
| tests/ | | 03-May-2024 | - | 15,091 | 12,139 |
| win32/ | | 03-May-2024 | - | 242 | 194 |
| xmlwf/ | | 03-May-2024 | - | 3,493 | 2,623 |
| .gitignore | D | 03-May-2024 | 360 | 38 | 37 |
| AUTHORS | D | 03-May-2024 | 142 | 11 | 9 |
| Android.bp | D | 03-May-2024 | 2.5 KiB | 90 | 81 |
| CMake.README | D | 03-May-2024 | 1.7 KiB | 43 | 36 |
| CMakeLists.txt | D | 03-May-2024 | 24.8 KiB | 721 | 649 |
| COPYING | D | 03-May-2024 | 1.1 KiB | 22 | 18 |
| Changes | D | 03-May-2024 | 43.3 KiB | 867 | 808 |
| ConfigureChecks.cmake | D | 03-May-2024 | 2.1 KiB | 67 | 58 |
| LICENSE | D | 03-May-2024 | 1.1 KiB | 22 | 18 |
| METADATA | D | 03-May-2024 | 584 | 23 | 22 |
| MODULE_LICENSE_MIT | D | 03-May-2024 | 0 | | |
| Makefile.am | D | 03-May-2024 | 4.9 KiB | 166 | 114 |
| Makefile.in | D | 03-May-2024 | 36.9 KiB | 1,127 | 984 |
| NOTICE | D | 03-May-2024 | 1.1 KiB | 22 | 18 |
| OWNERS | D | 03-May-2024 | 46 | 2 | 1 |
| README.md | D | 03-May-2024 | 8.2 KiB | 263 | 183 |
| acinclude.m4 | D | 03-May-2024 | 371 | 13 | 10 |
| aclocal.m4 | D | 03-May-2024 | 43.1 KiB | 1,199 | 1,090 |
| configure | D | 03-May-2024 | 652.1 KiB | 21,979 | 18,612 |
| configure.ac | D | 03-May-2024 | 13.8 KiB | 394 | 341 |
| expat.pc.in | D | 03-May-2024 | 261 | 12 | 10 |
| expat_config.h | D | 03-May-2024 | 4.1 KiB | 146 | 51 |
| expat_config.h.cmake | D | 03-May-2024 | 3.3 KiB | 116 | 79 |
| expat_config.h.in | D | 03-May-2024 | 3.6 KiB | 135 | 94 |
| fix-xmltest-log.sh | D | 03-May-2024 | 2.1 KiB | 49 | 15 |
| run.sh.in | D | 03-May-2024 | 181 | 13 | 8 |
| test-driver-wrapper.sh | D | 03-May-2024 | 1.8 KiB | 44 | 10 |
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.3.0 is the source directory of expat, add a subdirectory
7build and change into that directory:
8~/expat-2.3.0$ mkdir build && cd build
9~/expat-2.3.0/build$
10
11From that directory, call cmake first, then call make, make test and
12make install in the usual way:
13~/expat-2.3.0/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.3.0/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.3.0/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[![Run Linux Travis CI tasks](https://github.com/libexpat/libexpat/actions/workflows/linux.yml/badge.svg)](https://github.com/libexpat/libexpat/actions/workflows/linux.yml)
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.3.0
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
18- GNU GCC >=4.5
19- LLVM Clang >=3.5
20- Microsoft Visual Studio >=15.0/2017 (rolling `${today} minus 5 years`)
21
22Windows users can use the
23[`expat-win32bin-*.*.*.exe` installer download](https://github.com/libexpat/libexpat/releases),
24which includes both pre-compiled libraries and executables, and source code for
25developers.
26
27Expat is [free software](https://www.gnu.org/philosophy/free-sw.en.html).
28You may copy, distribute, and modify it under the terms of the License
29contained in the file
30[`COPYING`](https://github.com/libexpat/libexpat/blob/master/expat/COPYING)
31distributed with this package.
32This license is the same as the MIT/X Consortium license.
33
34
35## Using libexpat in your CMake-Based Project
36
37There are two ways of using libexpat with CMake:
38
39### a) Module Mode
40
41This approach leverages CMake's own [module `FindEXPAT`](https://cmake.org/cmake/help/latest/module/FindEXPAT.html).
42
43Notice the uppercase `EXPAT` in the following example:
44
45```cmake
46cmake_minimum_required(VERSION 3.0)
47
48project(hello VERSION 1.0.0)
49
50find_package(EXPAT 2.2.8 MODULE REQUIRED)
51
52add_executable(hello
53 hello.c
54)
55
56if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.10")
57 target_link_libraries(hello PUBLIC EXPAT::EXPAT)
58else()
59 target_include_directories(hello PRIVATE ${EXPAT_INCLUDE_DIRS})
60 target_link_libraries(hello PUBLIC ${EXPAT_LIBRARIES})
61endif()
62```
63
64### b) Config Mode
65
66This approach requires files from
67libexpat >=2.2.8 where packaging uses the CMake build system
68or
69libexpat >=2.3.0 where packaging uses the GNU Autotools build system.
70
71Notice the lowercase `expat` in the following example:
72
73```cmake
74cmake_minimum_required(VERSION 3.0)
75
76project(hello VERSION 1.0.0)
77
78find_package(expat 2.2.8 CONFIG REQUIRED char dtd ns)
79
80add_executable(hello
81 hello.c
82)
83
84target_link_libraries(hello PUBLIC expat::expat)
85```
86
87
88## Buildung from a Git Clone
89
90If you are building Expat from a check-out from the
91[Git repository](https://github.com/libexpat/libexpat/),
92you need to run a script that generates the configure script using the
93GNU autoconf and libtool tools. To do this, you need to have
94autoconf 2.58 or newer. Run the script like this:
95
96```console
97./buildconf.sh
98```
99
100Once this has been done, follow the same instructions as for building
101from a source distribution.
102
103
104## Buildung from a Source Distribution
105
106### a) Building with the configure script (i.e. GNU Autotools)
107
108To build Expat from a source distribution, you first run the
109configuration shell script in the top level distribution directory:
110
111```console
112./configure
113```
114
115There are many options which you may provide to configure (which you
116can discover by running configure with the `--help` option). But the
117one of most interest is the one that sets the installation directory.
118By default, the configure script will set things up to install
119libexpat into `/usr/local/lib`, `expat.h` into `/usr/local/include`, and
120`xmlwf` into `/usr/local/bin`. If, for example, you'd prefer to install
121into `/home/me/mystuff/lib`, `/home/me/mystuff/include`, and
122`/home/me/mystuff/bin`, you can tell `configure` about that with:
123
124```console
125./configure --prefix=/home/me/mystuff
126```
127
128Another interesting option is to enable 64-bit integer support for
129line and column numbers and the over-all byte index:
130
131```console
132./configure CPPFLAGS=-DXML_LARGE_SIZE
133```
134
135However, such a modification would be a breaking change to the ABI
136and is therefore not recommended for general use — e.g. as part of
137a Linux distribution — but rather for builds with special requirements.
138
139After running the configure script, the `make` command will build
140things and `make install` will install things into their proper
141location. Have a look at the `Makefile` to learn about additional
142`make` options. Note that you need to have write permission into
143the directories into which things will be installed.
144
145If you are interested in building Expat to provide document
146information in UTF-16 encoding rather than the default UTF-8, follow
147these instructions (after having run `make distclean`).
148Please note that we configure with `--without-xmlwf` as xmlwf does not
149support this mode of compilation (yet):
150
1511. Mass-patch `Makefile.am` files to use `libexpatw.la` for a library name:
152 <br/>
153 `find -name Makefile.am -exec sed
154 -e 's,libexpat\.la,libexpatw.la,'
155 -e 's,libexpat_la,libexpatw_la,'
156 -i {} +`
157
1581. Run `automake` to re-write `Makefile.in` files:<br/>
159 `automake`
160
1611. For UTF-16 output as unsigned short (and version/error strings as char),
162 run:<br/>
163 `./configure CPPFLAGS=-DXML_UNICODE --without-xmlwf`<br/>
164 For UTF-16 output as `wchar_t` (incl. version/error strings), run:<br/>
165 `./configure CFLAGS="-g -O2 -fshort-wchar" CPPFLAGS=-DXML_UNICODE_WCHAR_T
166 --without-xmlwf`
167 <br/>Note: The latter requires libc compiled with `-fshort-wchar`, as well.
168
1691. Run `make` (which excludes xmlwf).
170
1711. Run `make install` (again, excludes xmlwf).
172
173Using `DESTDIR` is supported. It works as follows:
174
175```console
176make install DESTDIR=/path/to/image
177```
178
179overrides the in-makefile set `DESTDIR`, because variable-setting priority is
180
1811. commandline
1821. in-makefile
1831. environment
184
185Note: This only applies to the Expat library itself, building UTF-16 versions
186of xmlwf and the tests is currently not supported.
187
188When using Expat with a project using autoconf for configuration, you
189can use the probing macro in `conftools/expat.m4` to determine how to
190include Expat. See the comments at the top of that file for more
191information.
192
193A reference manual is available in the file `doc/reference.html` in this
194distribution.
195
196
197### b) Building with CMake
198
199The CMake build system is still *experimental* and may replace the primary
200build system based on GNU Autotools at some point when it is ready.
201
202
203#### Available Options
204
205For an idea of the available (non-advanced) options for building with CMake:
206
207```console
208# rm -f CMakeCache.txt ; cmake -D_EXPAT_HELP=ON -LH . | grep -B1 ':.*=' | sed 's,^--$,,'
209// Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel ...
210CMAKE_BUILD_TYPE:STRING=
211
212// Install path prefix, prepended onto install directories.
213CMAKE_INSTALL_PREFIX:PATH=/usr/local
214
215// Path to a program.
216DOCBOOK_TO_MAN:FILEPATH=/usr/bin/docbook2x-man
217
218// build man page for xmlwf
219EXPAT_BUILD_DOCS:BOOL=ON
220
221// build the examples for expat library
222EXPAT_BUILD_EXAMPLES:BOOL=ON
223
224// build fuzzers for the expat library
225EXPAT_BUILD_FUZZERS:BOOL=OFF
226
227// build pkg-config file
228EXPAT_BUILD_PKGCONFIG:BOOL=ON
229
230// build the tests for expat library
231EXPAT_BUILD_TESTS:BOOL=ON
232
233// build the xmlwf tool for expat library
234EXPAT_BUILD_TOOLS:BOOL=ON
235
236// Character type to use (char|ushort|wchar_t) [default=char]
237EXPAT_CHAR_TYPE:STRING=char
238
239// install expat files in cmake install target
240EXPAT_ENABLE_INSTALL:BOOL=ON
241
242// Use /MT flag (static CRT) when compiling in MSVC
243EXPAT_MSVC_STATIC_CRT:BOOL=OFF
244
245// build fuzzers via ossfuzz for the expat library
246EXPAT_OSSFUZZ_BUILD:BOOL=OFF
247
248// build a shared expat library
249EXPAT_SHARED_LIBS:BOOL=ON
250
251// Treat all compiler warnings as errors
252EXPAT_WARNINGS_AS_ERRORS:BOOL=OFF
253
254// Make use of getrandom function (ON|OFF|AUTO) [default=AUTO]
255EXPAT_WITH_GETRANDOM:STRING=AUTO
256
257// utilize libbsd (for arc4random_buf)
258EXPAT_WITH_LIBBSD:BOOL=OFF
259
260// Make use of syscall SYS_getrandom (ON|OFF|AUTO) [default=AUTO]
261EXPAT_WITH_SYS_GETRANDOM:STRING=AUTO
262```
263