summaryrefslogtreecommitdiff
path: root/libexpat
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-07-29 23:11:56 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-07-31 13:28:47 +0300
commitd7ed5335b90175300349669fd102c4d44b05c381 (patch)
tree700e84d023d25c82dd75931eae2b1a1312e96947 /libexpat
parent2a98ae9d1b795b398d53996e35ae50b63aba3774 (diff)
Add implementation
Diffstat (limited to 'libexpat')
-rw-r--r--libexpat/.gitignore20
l---------libexpat/COPYING1
-rw-r--r--libexpat/INSTALL7
-rw-r--r--libexpat/README21
-rw-r--r--libexpat/README-DEV44
-rw-r--r--libexpat/build/.gitignore3
-rw-r--r--libexpat/build/bootstrap.build27
-rw-r--r--libexpat/build/export.build9
-rw-r--r--libexpat/build/root.build13
-rw-r--r--libexpat/buildfile9
l---------libexpat/libexpat/ascii.h1
l---------libexpat/libexpat/asciitab.h1
-rw-r--r--libexpat/libexpat/buildfile79
l---------libexpat/libexpat/expat.h1
-rw-r--r--libexpat/libexpat/expat_config.h88
l---------libexpat/libexpat/expat_config.h.cmake.orig1
l---------libexpat/libexpat/expat_external.h1
l---------libexpat/libexpat/iasciitab.h1
l---------libexpat/libexpat/internal.h1
l---------libexpat/libexpat/latin1tab.h1
l---------libexpat/libexpat/libexpat.def1
l---------libexpat/libexpat/nametab.h1
l---------libexpat/libexpat/siphash.h1
l---------libexpat/libexpat/utf8tab.h1
l---------libexpat/libexpat/winconfig.h1
l---------libexpat/libexpat/xmlparse.c1
l---------libexpat/libexpat/xmlrole.c1
l---------libexpat/libexpat/xmlrole.h1
l---------libexpat/libexpat/xmltok.c1
l---------libexpat/libexpat/xmltok.h1
l---------libexpat/libexpat/xmltok_impl.c1
l---------libexpat/libexpat/xmltok_impl.h1
l---------libexpat/libexpat/xmltok_ns.c1
-rw-r--r--libexpat/manifest18
-rw-r--r--libexpat/tests/.gitignore8
-rw-r--r--libexpat/tests/basic/buildfile6
-rw-r--r--libexpat/tests/basic/driver.c21
-rw-r--r--libexpat/tests/basic/testscript6
-rw-r--r--libexpat/tests/build/.gitignore3
-rw-r--r--libexpat/tests/build/bootstrap.build8
-rw-r--r--libexpat/tests/build/root.build21
-rw-r--r--libexpat/tests/buildfile4
l---------libexpat/tests/regression/ascii.h1
-rw-r--r--libexpat/tests/regression/buildfile6
l---------libexpat/tests/regression/chardata.c1
l---------libexpat/tests/regression/chardata.h1
l---------libexpat/tests/regression/internal.h1
l---------libexpat/tests/regression/memcheck.c1
l---------libexpat/tests/regression/memcheck.h1
l---------libexpat/tests/regression/minicheck.c1
l---------libexpat/tests/regression/minicheck.h1
l---------libexpat/tests/regression/runtests.c1
l---------libexpat/tests/regression/siphash.h1
l---------libexpat/tests/regression/structdata.c1
l---------libexpat/tests/regression/structdata.h1
-rw-r--r--libexpat/tests/regression/testscript9
56 files changed, 464 insertions, 0 deletions
diff --git a/libexpat/.gitignore b/libexpat/.gitignore
new file mode 100644
index 0000000..4c4fec7
--- /dev/null
+++ b/libexpat/.gitignore
@@ -0,0 +1,20 @@
+# Compiler/linker output.
+#
+*.d
+*.t
+*.i
+*.ii
+*.o
+*.obj
+*.so
+*.so.*
+*.dll
+*.a
+*.lib
+*.exp
+*.pdb
+*.ilk
+*.exe
+*.exe.dlls/
+*.exe.manifest
+*.pc
diff --git a/libexpat/COPYING b/libexpat/COPYING
new file mode 120000
index 0000000..012065c
--- /dev/null
+++ b/libexpat/COPYING
@@ -0,0 +1 @@
+../COPYING \ No newline at end of file
diff --git a/libexpat/INSTALL b/libexpat/INSTALL
new file mode 100644
index 0000000..a835adc
--- /dev/null
+++ b/libexpat/INSTALL
@@ -0,0 +1,7 @@
+The aim of this package is to make reading the INSTALL file unnecessary. So
+next time try running:
+
+$ bpkg build libexpat
+
+But if you don't want to use the package manager, then you can also build this
+package manually using the standard build2 build system.
diff --git a/libexpat/README b/libexpat/README
new file mode 100644
index 0000000..b0b157d
--- /dev/null
+++ b/libexpat/README
@@ -0,0 +1,21 @@
+Expat is a stream-oriented XML parsing C library. This means that you register
+handlers with the parser before starting the parse. These handlers are called
+when the parser discovers the associated structures (start tag, etc) in the
+document being parsed. For more information see:
+
+https://libexpat.github.io/
+
+This package contains the original libexpat library source code overlaid with
+the build2-based build system and packaged for the build2 package manager
+(bpkg).
+
+See the INSTALL file for the prerequisites and installation instructions.
+
+Post questions, bug reports, or any other feedback about the library itself at
+https://github.com/libexpat/libexpat/issues. Send build system and
+packaging-related feedback to the packaging@build2.org mailing list (see
+https://lists.build2.org for posting guidelines, etc).
+
+The packaging of Expat for build2 is tracked in a Git repository at:
+
+https://git.build2.org/cgit/packaging/expat/
diff --git a/libexpat/README-DEV b/libexpat/README-DEV
new file mode 100644
index 0000000..32bd6d0
--- /dev/null
+++ b/libexpat/README-DEV
@@ -0,0 +1,44 @@
+This document describes how libexpat was packaged for build2. In particular,
+this understanding will be useful when upgrading to a new upstream version.
+See ../README-DEV for general notes on Expat packaging.
+
+Symlink the required upstream files:
+
+$ ln -s ../COPYING
+$ pushd libexpat
+$ ln -s ../../upstream/expat/lib/{*.{c,h},libexpat.def} ./
+$ ln -s ../../upstream/expat/expat_config.h.cmake expat_config.h.cmake.orig
+$ popd
+
+Use some of the upstream's tests for testing:
+
+$ pushd tests/regression/
+$ ln -s ../../../upstream/expat/tests/*.{c,h} ./
+$ ln -s ../../../upstream/expat/lib/{internal,siphash,ascii}.h ./
+$ popd
+
+Create libexpat/expat_config.h using as a base the upstream's auto-generated
+header, winconfig.h, and/or configure.ac.
+
+Re-creating libexpat/expat_config.h from scratch every time we upgrade to a
+new upstream version would be a pain. Instead we can only (un)define the newly
+introduced macros, comparing the already defined and currently used macro
+sets. Note that we can use this approach to also deduce the initial set of
+macros running the above commands for the upstream's auto-generated
+expat_config.h:
+
+$ ln -s ../../upstream/expat/expat_config.h.cmake libexpat/expat_config.h.cmake.orig
+
+$ for m in `cat libexpat/expat_config.h.cmake.orig libexpat/winconfig.h.orig | \
+ sed -n 's/.*#\s*\(define\|cmakedefine\)\s\{1,\}\([_a-zA-Z0-9]\{1,\}\)\(\s.*\)\{0,1\}$/\2/p' | sort -u`; do
+ if grep -q -e "\b$m\b" `find -L . -type f -not -path "./tests/*" -a \( -name '*.h' -a ! -name expat_config.h -o -name '*.c' \)`; then
+ echo "$m"
+ fi
+ done >used-macros
+
+$ cat libexpat/expat_config.h | \
+ sed -n 's/^#\s*\(define\|undef\)\s\{1,\}\([_a-z_A-Z0-9]\{1,\}\)\(\s.*\)\{0,1\}$/\2/p' | \
+ sort -u >defined-macros
+
+$ diff defined-macros used-macros | grep '<' >remove-macros
+$ diff defined-macros used-macros | grep '>' >add-macros
diff --git a/libexpat/build/.gitignore b/libexpat/build/.gitignore
new file mode 100644
index 0000000..4a730a3
--- /dev/null
+++ b/libexpat/build/.gitignore
@@ -0,0 +1,3 @@
+config.build
+root/
+bootstrap/
diff --git a/libexpat/build/bootstrap.build b/libexpat/build/bootstrap.build
new file mode 100644
index 0000000..eb0c50f
--- /dev/null
+++ b/libexpat/build/bootstrap.build
@@ -0,0 +1,27 @@
+# file : build/bootstrap.build
+# license : MIT; see accompanying COPYING file
+
+project = libexpat
+
+using version
+using config
+using dist
+using test
+using install
+
+# The Expat version has the <major>.<minor>.<micro> form and follows the
+# semver semantics, according to the documentation in expat/lib/expat.h.
+#
+# The ABI version doesn't correlate with the release version and is assigned
+# via the libtool's -version-info <current>:<revision>:<age> option
+# (LIBCURRENT, LIBREVISION, and LIBAGE in expat/configure.ac). As it follows
+# from the comment in expat/configure.ac, the major version (current - age) is
+# incremented for backwards-incompatible ABI changes.
+#
+if ($version.major == 2 && $version.minor == 2 && $version.patch == 9)
+{
+ abi_version_major = 1
+ abi_version = "$abi_version_major.6.11" # <current - age>.<age>.<revision>
+}
+else
+ fail 'increment the ABI version?'
diff --git a/libexpat/build/export.build b/libexpat/build/export.build
new file mode 100644
index 0000000..f1302a1
--- /dev/null
+++ b/libexpat/build/export.build
@@ -0,0 +1,9 @@
+# file : build/export.build
+# license : MIT; see accompanying COPYING file
+
+$out_root/
+{
+ include libexpat/
+}
+
+export $out_root/libexpat/lib{expat}
diff --git a/libexpat/build/root.build b/libexpat/build/root.build
new file mode 100644
index 0000000..070d5ec
--- /dev/null
+++ b/libexpat/build/root.build
@@ -0,0 +1,13 @@
+# file : build/root.build
+# license : MIT; see accompanying COPYING file
+
+using c
+
+h{*}: extension = h
+c{*}: extension = c
+
+if ($c.target.system == 'win32-msvc')
+ c.poptions += -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS
+
+if ($c.class == 'msvc')
+ c.coptions += /wd4251 /wd4275 /wd4800
diff --git a/libexpat/buildfile b/libexpat/buildfile
new file mode 100644
index 0000000..6d3efdd
--- /dev/null
+++ b/libexpat/buildfile
@@ -0,0 +1,9 @@
+# file : buildfile
+# license : MIT; see accompanying COPYING file
+
+./: {*/ -build/} doc{INSTALL README} legal{COPYING} manifest
+
+# Don't install tests or the INSTALL file.
+#
+tests/: install = false
+doc{INSTALL}@./: install = false
diff --git a/libexpat/libexpat/ascii.h b/libexpat/libexpat/ascii.h
new file mode 120000
index 0000000..ad11588
--- /dev/null
+++ b/libexpat/libexpat/ascii.h
@@ -0,0 +1 @@
+../../upstream/expat/lib/ascii.h \ No newline at end of file
diff --git a/libexpat/libexpat/asciitab.h b/libexpat/libexpat/asciitab.h
new file mode 120000
index 0000000..1336131
--- /dev/null
+++ b/libexpat/libexpat/asciitab.h
@@ -0,0 +1 @@
+../../upstream/expat/lib/asciitab.h \ No newline at end of file
diff --git a/libexpat/libexpat/buildfile b/libexpat/libexpat/buildfile
new file mode 100644
index 0000000..ef06a2e
--- /dev/null
+++ b/libexpat/libexpat/buildfile
@@ -0,0 +1,79 @@
+# file : libexpat/buildfile
+# license : MIT; see accompanying COPYING file
+
+# xmltok_{impl,nc}.c files are included into xmltok.c, so exclude them from
+# the compilation.
+#
+lib{expat}: h{*} c{* -xmltok_impl -xmltok_ns}
+lib{expat}: c{xmltok_impl xmltok_ns}: include = false
+
+tclass = $c.target.class
+
+msvc_runtime = ($c.target.system == 'win32-msvc')
+
+# Symbol exporting for MSVC and Clang targeting MSVC is done via the .def
+# file.
+#
+# Note that for MinGW it's done the same way as for POSIX via the visibility
+# function attribute.
+#
+libs{expat}: def{libexpat}: include = $msvc_runtime
+
+# Build options.
+#
+c.poptions += -DHAVE_EXPAT_CONFIG_H
+
+if! $msvc_runtime
+ c.poptions += -DXML_ENABLE_VISIBILITY=1
+
+c.poptions =+ "-I$src_base"
+
+if ($c.class == 'gcc')
+{
+ c.coptions += -fexceptions -fno-strict-aliasing
+
+ if! $msvc_runtime
+ c.coptions += -fvisibility=hidden
+
+ # Disable warnings that pop up with -Wall -Wextra.
+ #
+ # Note that -Wno-implicit-fallthrough is only supported starting from GCC 7
+ # and Clang 3.9. However, we don't check for the compiler version since the
+ # earlier compiler versions do not complain about unknown -Wno-* options,
+ # unless some other diagnostics is issued.
+ #
+ # Also note that these warnings can be build2-specific due to the
+ # intermediate translation unit pre-processing phase, which wipes the `fall
+ # through` comments from the macro definitions.
+ #
+ c.coptions += -Wno-implicit-fallthrough
+}
+
+switch $tclass
+{
+ case 'linux' | 'bsd'
+ {
+ # Make sure all symbols are resolvable.
+ #
+ c.loptions += -Wl,--no-undefined
+ }
+}
+
+# Export options.
+#
+lib{expat}: cc.export.poptions = "-I$src_base"
+liba{expat}: cc.export.poptions += -DXML_STATIC
+
+# See bootstrap.build for details.
+#
+if $version.pre_release
+ lib{expat}: bin.lib.version = @"-$version.project_id"
+else
+ lib{expat}: bin.lib.version = @"-$abi_version_major" linux@"$abi_version"
+
+# Install the bare minimum of headers (note: not recreating subdirectories).
+#
+h{*}: install = false
+
+for h: expat expat_external expat_config
+ h{$h}@./: install = include/
diff --git a/libexpat/libexpat/expat.h b/libexpat/libexpat/expat.h
new file mode 120000
index 0000000..d130deb
--- /dev/null
+++ b/libexpat/libexpat/expat.h
@@ -0,0 +1 @@
+../../upstream/expat/lib/expat.h \ No newline at end of file
diff --git a/libexpat/libexpat/expat_config.h b/libexpat/libexpat/expat_config.h
new file mode 100644
index 0000000..38ae39b
--- /dev/null
+++ b/libexpat/libexpat/expat_config.h
@@ -0,0 +1,88 @@
+/* file : libexpat/expat_config.h -*- C -*-
+ * license : MIT; see accompanying COPYING file
+ */
+
+#ifndef LIBEXPAT_EXPAT_CONFIG_H
+#define LIBEXPAT_EXPAT_CONFIG_H
+
+/* Note that on Windows the library source files include winconfig.h that
+ * includes this header, additionally adding the Windows-specific definitions.
+ */
+
+/* Endianess.
+ */
+#ifdef __FreeBSD__
+# include <sys/endian.h> /* BYTE_ORDER */
+#else
+# if defined(_WIN32)
+# ifndef BYTE_ORDER
+# define BIG_ENDIAN 4321
+# define LITTLE_ENDIAN 1234
+# define BYTE_ORDER LITTLE_ENDIAN
+# endif
+# else
+# include <sys/param.h> /* BYTE_ORDER/__BYTE_ORDER */
+# ifndef BYTE_ORDER
+# ifdef __BYTE_ORDER
+# define BYTE_ORDER __BYTE_ORDER
+# define BIG_ENDIAN __BIG_ENDIAN
+# define LITTLE_ENDIAN __LITTLE_ENDIAN
+# else
+# error no BYTE_ORDER/__BYTE_ORDER define
+# endif
+# endif
+# endif
+#endif
+
+#if BYTE_ORDER == BIG_ENDIAN
+# define BYTEORDER 4321
+#else
+# define BYTEORDER 1234
+#endif
+
+#define UNUSED(x) (void)x;
+
+/* Specific for FreeBSD.
+ */
+#if defined(__FreeBSD__)
+
+/* Note that sys/random.h is not available for older versions of glibc. Thus,
+ * we don't define this macro on Linux.
+ */
+# define HAVE_GETRANDOM 1
+
+/* Note that the getrandom system call is not available in older Linux
+ * kernels. Thus, we don't define this macro on Linux.
+ */
+# define HAVE_SYSCALL_GETRANDOM 1
+#endif
+
+/* Specific for FreeBSD and Mac OS.
+ */
+#if defined(__FreeBSD__) || defined(__APPLE__)
+# define HAVE_ARC4RANDOM_BUF 1
+#endif
+
+/* Specific for (non-) VC.
+ */
+#ifndef _MSC_VER
+# define XML_DEV_URANDOM 1
+#endif
+
+/* Common for all supported OSes/compilers.
+ */
+#define XML_NS 1
+#define XML_DTD 1
+#define XML_CONTEXT_BYTES 1024
+
+#undef XML_ATTR_INFO
+#undef HAVE_LIBBSD
+#undef HAVE_ARC4RANDOM
+
+/* We can probably assume that on platforms we build for, these keywords/types
+ * don't require definition.
+
+#undef size_t
+*/
+
+#endif /* LIBEXPAT_EXPAT_CONFIG_H */
diff --git a/libexpat/libexpat/expat_config.h.cmake.orig b/libexpat/libexpat/expat_config.h.cmake.orig
new file mode 120000
index 0000000..64776b5
--- /dev/null
+++ b/libexpat/libexpat/expat_config.h.cmake.orig
@@ -0,0 +1 @@
+../../upstream/expat/expat_config.h.cmake \ No newline at end of file
diff --git a/libexpat/libexpat/expat_external.h b/libexpat/libexpat/expat_external.h
new file mode 120000
index 0000000..04ec915
--- /dev/null
+++ b/libexpat/libexpat/expat_external.h
@@ -0,0 +1 @@
+../../upstream/expat/lib/expat_external.h \ No newline at end of file
diff --git a/libexpat/libexpat/iasciitab.h b/libexpat/libexpat/iasciitab.h
new file mode 120000
index 0000000..0c6ca4a
--- /dev/null
+++ b/libexpat/libexpat/iasciitab.h
@@ -0,0 +1 @@
+../../upstream/expat/lib/iasciitab.h \ No newline at end of file
diff --git a/libexpat/libexpat/internal.h b/libexpat/libexpat/internal.h
new file mode 120000
index 0000000..f24b340
--- /dev/null
+++ b/libexpat/libexpat/internal.h
@@ -0,0 +1 @@
+../../upstream/expat/lib/internal.h \ No newline at end of file
diff --git a/libexpat/libexpat/latin1tab.h b/libexpat/libexpat/latin1tab.h
new file mode 120000
index 0000000..380f82f
--- /dev/null
+++ b/libexpat/libexpat/latin1tab.h
@@ -0,0 +1 @@
+../../upstream/expat/lib/latin1tab.h \ No newline at end of file
diff --git a/libexpat/libexpat/libexpat.def b/libexpat/libexpat/libexpat.def
new file mode 120000
index 0000000..7f3cd3c
--- /dev/null
+++ b/libexpat/libexpat/libexpat.def
@@ -0,0 +1 @@
+../../upstream/expat/lib/libexpat.def \ No newline at end of file
diff --git a/libexpat/libexpat/nametab.h b/libexpat/libexpat/nametab.h
new file mode 120000
index 0000000..da05055
--- /dev/null
+++ b/libexpat/libexpat/nametab.h
@@ -0,0 +1 @@
+../../upstream/expat/lib/nametab.h \ No newline at end of file
diff --git a/libexpat/libexpat/siphash.h b/libexpat/libexpat/siphash.h
new file mode 120000
index 0000000..641ae09
--- /dev/null
+++ b/libexpat/libexpat/siphash.h
@@ -0,0 +1 @@
+../../upstream/expat/lib/siphash.h \ No newline at end of file
diff --git a/libexpat/libexpat/utf8tab.h b/libexpat/libexpat/utf8tab.h
new file mode 120000
index 0000000..ea15fd9
--- /dev/null
+++ b/libexpat/libexpat/utf8tab.h
@@ -0,0 +1 @@
+../../upstream/expat/lib/utf8tab.h \ No newline at end of file
diff --git a/libexpat/libexpat/winconfig.h b/libexpat/libexpat/winconfig.h
new file mode 120000
index 0000000..b043f6b
--- /dev/null
+++ b/libexpat/libexpat/winconfig.h
@@ -0,0 +1 @@
+../../upstream/expat/lib/winconfig.h \ No newline at end of file
diff --git a/libexpat/libexpat/xmlparse.c b/libexpat/libexpat/xmlparse.c
new file mode 120000
index 0000000..2e8e67f
--- /dev/null
+++ b/libexpat/libexpat/xmlparse.c
@@ -0,0 +1 @@
+../../upstream/expat/lib/xmlparse.c \ No newline at end of file
diff --git a/libexpat/libexpat/xmlrole.c b/libexpat/libexpat/xmlrole.c
new file mode 120000
index 0000000..1842f74
--- /dev/null
+++ b/libexpat/libexpat/xmlrole.c
@@ -0,0 +1 @@
+../../upstream/expat/lib/xmlrole.c \ No newline at end of file
diff --git a/libexpat/libexpat/xmlrole.h b/libexpat/libexpat/xmlrole.h
new file mode 120000
index 0000000..d6840a4
--- /dev/null
+++ b/libexpat/libexpat/xmlrole.h
@@ -0,0 +1 @@
+../../upstream/expat/lib/xmlrole.h \ No newline at end of file
diff --git a/libexpat/libexpat/xmltok.c b/libexpat/libexpat/xmltok.c
new file mode 120000
index 0000000..71e09c6
--- /dev/null
+++ b/libexpat/libexpat/xmltok.c
@@ -0,0 +1 @@
+../../upstream/expat/lib/xmltok.c \ No newline at end of file
diff --git a/libexpat/libexpat/xmltok.h b/libexpat/libexpat/xmltok.h
new file mode 120000
index 0000000..7d364ab
--- /dev/null
+++ b/libexpat/libexpat/xmltok.h
@@ -0,0 +1 @@
+../../upstream/expat/lib/xmltok.h \ No newline at end of file
diff --git a/libexpat/libexpat/xmltok_impl.c b/libexpat/libexpat/xmltok_impl.c
new file mode 120000
index 0000000..d43e690
--- /dev/null
+++ b/libexpat/libexpat/xmltok_impl.c
@@ -0,0 +1 @@
+../../upstream/expat/lib/xmltok_impl.c \ No newline at end of file
diff --git a/libexpat/libexpat/xmltok_impl.h b/libexpat/libexpat/xmltok_impl.h
new file mode 120000
index 0000000..62df0da
--- /dev/null
+++ b/libexpat/libexpat/xmltok_impl.h
@@ -0,0 +1 @@
+../../upstream/expat/lib/xmltok_impl.h \ No newline at end of file
diff --git a/libexpat/libexpat/xmltok_ns.c b/libexpat/libexpat/xmltok_ns.c
new file mode 120000
index 0000000..607cbbc
--- /dev/null
+++ b/libexpat/libexpat/xmltok_ns.c
@@ -0,0 +1 @@
+../../upstream/expat/lib/xmltok_ns.c \ No newline at end of file
diff --git a/libexpat/manifest b/libexpat/manifest
new file mode 100644
index 0000000..9863516
--- /dev/null
+++ b/libexpat/manifest
@@ -0,0 +1,18 @@
+: 1
+name: libexpat
+version: 2.2.9-a.0.z
+project: expat
+summary: Stream-oriented XML parsing C library
+license: MIT
+topics: Expat, C, XML parser, streaming
+description-file: README
+url: https://libexpat.github.io/
+doc-url: https://libexpat.github.io/doc/
+src-url: https://git.build2.org/cgit/packaging/expat/expat/tree/libexpat/
+package-url: https://git.build2.org/cgit/packaging/expat/
+email: packaging@build2.org ; Report issues at https://github.com/libexpat/libexpat/issues.
+package-email: packaging@build2.org ; Mailing list.
+build-warning-email: builds@build2.org
+builds: all
+depends: * build2 >= 0.13.0
+depends: * bpkg >= 0.13.0
diff --git a/libexpat/tests/.gitignore b/libexpat/tests/.gitignore
new file mode 100644
index 0000000..662178d
--- /dev/null
+++ b/libexpat/tests/.gitignore
@@ -0,0 +1,8 @@
+# Test executables.
+#
+driver
+
+# Testscript output directories (can be symlinks).
+#
+test
+test-*
diff --git a/libexpat/tests/basic/buildfile b/libexpat/tests/basic/buildfile
new file mode 100644
index 0000000..b64f25a
--- /dev/null
+++ b/libexpat/tests/basic/buildfile
@@ -0,0 +1,6 @@
+# file : tests/basic/buildfile
+# license : MIT; see accompanying COPYING file
+
+import libs = libexpat%lib{expat}
+
+exe{driver}: {h c}{**} $libs testscript
diff --git a/libexpat/tests/basic/driver.c b/libexpat/tests/basic/driver.c
new file mode 100644
index 0000000..067b96b
--- /dev/null
+++ b/libexpat/tests/basic/driver.c
@@ -0,0 +1,21 @@
+/* file : tests/basic/driver.c
+ * license : MIT; see accompanying COPYING file
+ */
+
+#include <stdio.h>
+#include <assert.h>
+
+#include <expat.h>
+
+int
+main ()
+{
+ XML_Expat_Version v = XML_ExpatVersionInfo ();
+
+ assert (v.major == XML_MAJOR_VERSION &&
+ v.minor == XML_MINOR_VERSION &&
+ v.micro == XML_MICRO_VERSION);
+
+ printf ("version: %d.%d.%d\n", v.major, v.minor, v.micro);
+ return 0;
+}
diff --git a/libexpat/tests/basic/testscript b/libexpat/tests/basic/testscript
new file mode 100644
index 0000000..d9037da
--- /dev/null
+++ b/libexpat/tests/basic/testscript
@@ -0,0 +1,6 @@
+# file : tests/basic/testscript
+# license : MIT; see accompanying COPYING file
+
+: version
+:
+$* >~'%version: \d+.\d+.\d+%d'
diff --git a/libexpat/tests/build/.gitignore b/libexpat/tests/build/.gitignore
new file mode 100644
index 0000000..4a730a3
--- /dev/null
+++ b/libexpat/tests/build/.gitignore
@@ -0,0 +1,3 @@
+config.build
+root/
+bootstrap/
diff --git a/libexpat/tests/build/bootstrap.build b/libexpat/tests/build/bootstrap.build
new file mode 100644
index 0000000..d7f6bee
--- /dev/null
+++ b/libexpat/tests/build/bootstrap.build
@@ -0,0 +1,8 @@
+# file : tests/build/bootstrap.build
+# license : MIT; see accompanying COPYING file
+
+project = # Unnamed tests subproject.
+
+using config
+using test
+using dist
diff --git a/libexpat/tests/build/root.build b/libexpat/tests/build/root.build
new file mode 100644
index 0000000..2d95750
--- /dev/null
+++ b/libexpat/tests/build/root.build
@@ -0,0 +1,21 @@
+# file : tests/build/root.build
+# license : MIT; see accompanying COPYING file
+
+using c
+
+h{*}: extension = h
+c{*}: extension = c
+
+if ($c.target.system == 'win32-msvc')
+ c.poptions += -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS
+
+if ($c.class == 'msvc')
+ c.coptions += /wd4251 /wd4275 /wd4800
+
+# Every exe{} in this subproject is by default a test.
+#
+exe{*}: test = true
+
+# The test target for cross-testing (running tests under Wine, etc).
+#
+test.target = $c.target
diff --git a/libexpat/tests/buildfile b/libexpat/tests/buildfile
new file mode 100644
index 0000000..52f7ade
--- /dev/null
+++ b/libexpat/tests/buildfile
@@ -0,0 +1,4 @@
+# file : tests/buildfile
+# license : MIT; see accompanying COPYING file
+
+./: {*/ -build/}
diff --git a/libexpat/tests/regression/ascii.h b/libexpat/tests/regression/ascii.h
new file mode 120000
index 0000000..0ad0b66
--- /dev/null
+++ b/libexpat/tests/regression/ascii.h
@@ -0,0 +1 @@
+../../../upstream/expat/lib/ascii.h \ No newline at end of file
diff --git a/libexpat/tests/regression/buildfile b/libexpat/tests/regression/buildfile
new file mode 100644
index 0000000..f3ed442
--- /dev/null
+++ b/libexpat/tests/regression/buildfile
@@ -0,0 +1,6 @@
+# file : tests/regression/buildfile
+# license : MIT; see accompanying COPYING file
+
+import libs = libexpat%lib{expat}
+
+exe{driver}: {h c}{**} $libs testscript
diff --git a/libexpat/tests/regression/chardata.c b/libexpat/tests/regression/chardata.c
new file mode 120000
index 0000000..321a5e8
--- /dev/null
+++ b/libexpat/tests/regression/chardata.c
@@ -0,0 +1 @@
+../../../upstream/expat/tests/chardata.c \ No newline at end of file
diff --git a/libexpat/tests/regression/chardata.h b/libexpat/tests/regression/chardata.h
new file mode 120000
index 0000000..fe51175
--- /dev/null
+++ b/libexpat/tests/regression/chardata.h
@@ -0,0 +1 @@
+../../../upstream/expat/tests/chardata.h \ No newline at end of file
diff --git a/libexpat/tests/regression/internal.h b/libexpat/tests/regression/internal.h
new file mode 120000
index 0000000..d23a734
--- /dev/null
+++ b/libexpat/tests/regression/internal.h
@@ -0,0 +1 @@
+../../../upstream/expat/lib/internal.h \ No newline at end of file
diff --git a/libexpat/tests/regression/memcheck.c b/libexpat/tests/regression/memcheck.c
new file mode 120000
index 0000000..c59d54a
--- /dev/null
+++ b/libexpat/tests/regression/memcheck.c
@@ -0,0 +1 @@
+../../../upstream/expat/tests/memcheck.c \ No newline at end of file
diff --git a/libexpat/tests/regression/memcheck.h b/libexpat/tests/regression/memcheck.h
new file mode 120000
index 0000000..3b9545f
--- /dev/null
+++ b/libexpat/tests/regression/memcheck.h
@@ -0,0 +1 @@
+../../../upstream/expat/tests/memcheck.h \ No newline at end of file
diff --git a/libexpat/tests/regression/minicheck.c b/libexpat/tests/regression/minicheck.c
new file mode 120000
index 0000000..abcc94a
--- /dev/null
+++ b/libexpat/tests/regression/minicheck.c
@@ -0,0 +1 @@
+../../../upstream/expat/tests/minicheck.c \ No newline at end of file
diff --git a/libexpat/tests/regression/minicheck.h b/libexpat/tests/regression/minicheck.h
new file mode 120000
index 0000000..c499235
--- /dev/null
+++ b/libexpat/tests/regression/minicheck.h
@@ -0,0 +1 @@
+../../../upstream/expat/tests/minicheck.h \ No newline at end of file
diff --git a/libexpat/tests/regression/runtests.c b/libexpat/tests/regression/runtests.c
new file mode 120000
index 0000000..7753f85
--- /dev/null
+++ b/libexpat/tests/regression/runtests.c
@@ -0,0 +1 @@
+../../../upstream/expat/tests/runtests.c \ No newline at end of file
diff --git a/libexpat/tests/regression/siphash.h b/libexpat/tests/regression/siphash.h
new file mode 120000
index 0000000..af2eb7e
--- /dev/null
+++ b/libexpat/tests/regression/siphash.h
@@ -0,0 +1 @@
+../../../upstream/expat/lib/siphash.h \ No newline at end of file
diff --git a/libexpat/tests/regression/structdata.c b/libexpat/tests/regression/structdata.c
new file mode 120000
index 0000000..69aaeb7
--- /dev/null
+++ b/libexpat/tests/regression/structdata.c
@@ -0,0 +1 @@
+../../../upstream/expat/tests/structdata.c \ No newline at end of file
diff --git a/libexpat/tests/regression/structdata.h b/libexpat/tests/regression/structdata.h
new file mode 120000
index 0000000..f6f572d
--- /dev/null
+++ b/libexpat/tests/regression/structdata.h
@@ -0,0 +1 @@
+../../../upstream/expat/tests/structdata.h \ No newline at end of file
diff --git a/libexpat/tests/regression/testscript b/libexpat/tests/regression/testscript
new file mode 100644
index 0000000..d2af7af
--- /dev/null
+++ b/libexpat/tests/regression/testscript
@@ -0,0 +1,9 @@
+# file : tests/regression/testscript
+# license : MIT; see accompanying COPYING file
+
+: check
+:
+$* >>~/EOE/
+ /Expat version: expat_\d+.\d+.\d+/d
+ /100%: Checks: .+, Failed: 0/
+ EOE