Skip to content

Commit 87178a0

Browse files
committed
expat test
Signed-off-by: Rosen Penev <[email protected]>
1 parent 66c3cda commit 87178a0

File tree

3 files changed

+236
-9
lines changed

3 files changed

+236
-9
lines changed

Diff for: subprojects/expat.wrap

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
[wrap-file]
2-
directory = expat-2.6.0
3-
source_url = https://github.com/libexpat/libexpat/releases/download/R_2_6_0/expat-2.6.0.tar.xz
4-
source_filename = expat-2.6.0.tar.bz2
5-
source_hash = cb5f5a8ea211e1cabd59be0a933a52e3c02cc326e86a4d387d8d218e7ee47a3e
6-
patch_filename = expat_2.6.0-1_patch.zip
7-
patch_url = https://wrapdb.mesonbuild.com/v2/expat_2.6.0-1/get_patch
8-
patch_hash = 7452665b0cf413f87fae1dc4d5c779bc2c8f0ccf3ba637140c9d46eacf521604
9-
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/expat_2.6.0-1/expat-2.6.0.tar.bz2
10-
wrapdb_version = 2.6.0-1
2+
directory = expat-2.6.3
3+
source_url = https://github.com/libexpat/libexpat/releases/download/R_2_6_3/expat-2.6.3.tar.xz
4+
source_filename = expat-2.6.3.tar.bz2
5+
source_hash = 274db254a6979bde5aad404763a704956940e465843f2a9bd9ed7af22e2c0efc
6+
patch_directory = expat
117

128
[provide]
139
expat = expat_dep

Diff for: subprojects/packagefiles/expat/meson.build

+174
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
# Copyright © 2018 Dylan Baker
2+
# Copyright © 2018,2020 Intel Corporation
3+
4+
# Permission is hereby granted, free of charge, to any person obtaining a copy
5+
# of this software and associated documentation files (the "Software"), to deal
6+
# in the Software without restriction, including without limitation the rights
7+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
# copies of the Software, and to permit persons to whom the Software is
9+
# furnished to do so, subject to the following conditions:
10+
11+
# The above copyright notice and this permission notice shall be included in
12+
# all copies or substantial portions of the Software.
13+
14+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
# SOFTWARE.
21+
22+
project(
23+
'expat',
24+
'c',
25+
license: 'MIT',
26+
version: '2.6.3',
27+
meson_version: '>= 0.54.1',
28+
)
29+
30+
config = configuration_data()
31+
cc = meson.get_compiler('c')
32+
33+
config.set('PACKAGE_NAME', meson.project_name())
34+
config.set('PACKAGE_TARNAME', meson.project_name())
35+
config.set('PACKAGE_VERSION', meson.project_version())
36+
config.set('PACKAGE_BUGREPORT', '[email protected]')
37+
config.set('PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), meson.project_version()))
38+
39+
# Define how much context to retain around the current parse point.
40+
config.set('XML_CONTEXT_BYTES', 1024)
41+
42+
dep_libbsd = dependency('libbsd-overlay', required: get_option('use_libbsd'))
43+
if dep_libbsd.type_name() == 'internal'
44+
config.set('HAVE_ARC4RANDOM_BUF', dep_libbsd.found())
45+
config.set('HAVE_ARC4RANDOM', dep_libbsd.found())
46+
else
47+
config.set('HAVE_ARC4RANDOM_BUF', cc.has_function('arc4random_buf', dependencies: dep_libbsd))
48+
config.set('HAVE_ARC4RANDOM', cc.has_function('arc4random', dependencies: dep_libbsd))
49+
endif
50+
51+
config.set('XML_DTD', get_option('xml_dtd'))
52+
config.set('XML_GE', get_option('xml_ge'))
53+
config.set('XML_NS', get_option('xml_ns'))
54+
55+
foreach h : ['dlfcn', 'fcntl', 'inttypes', 'memory', 'stdint', 'stdlib', 'strings', 'string', 'sys/stat', 'sys/types', 'unistd']
56+
config.set('HAVE_@0@_H'.format(h.underscorify().to_upper()), cc.has_header(h + '.h'))
57+
endforeach
58+
59+
_stdc = true
60+
foreach h : ['stdlib', 'stdarg', 'string', 'float']
61+
if not cc.has_header('@[email protected]'.format(h))
62+
_stdc = false
63+
break
64+
endif
65+
endforeach
66+
config.set('STDC_HEADERS', _stdc)
67+
68+
foreach f : ['getpagesize', 'mmap', 'getrandom']
69+
config.set('HAVE_@0@'.format(f.to_upper()), cc.has_function(f))
70+
endforeach
71+
72+
if host_machine.endian() == 'little'
73+
config.set('BYTEORDER', 1234)
74+
else
75+
config.set('BYTEORDER', 4321)
76+
endif
77+
78+
if not cc.has_header_symbol('sys/types.h', 'off_t')
79+
config.set('off_t', 'long')
80+
endif
81+
82+
config.set('HAVE_SYSCALL_GETRANDOM', cc.has_header_symbol('sys/syscall.h', 'SYS_getrandom'))
83+
84+
# Install headers
85+
config_h = configure_file(
86+
input: 'expat_config.h.cmake',
87+
output: 'expat_config.h',
88+
format: 'cmake@',
89+
configuration: config,
90+
)
91+
install_headers('lib/expat.h', 'lib/expat_external.h', config_h)
92+
93+
expat_static_args = []
94+
95+
add_project_arguments('-DXML_ENABLE_VISIBILITY=1', language: 'c')
96+
add_project_arguments('-DHAVE_EXPAT_CONFIG_H', language: 'c')
97+
add_project_arguments(cc.get_supported_arguments('-fno-strict-aliasing'), language: 'c')
98+
if cc.get_argument_syntax() == 'msvc'
99+
add_project_arguments('-D_CRT_SECURE_NO_WARNINGS', '-wd4996', language: 'c')
100+
endif
101+
102+
if host_machine.system() == 'windows'
103+
add_project_arguments('-DXMLCALL=WINAPIV', language: 'c')
104+
add_project_arguments('-DXMLIMPORT=__declspec(dllexport)', language: 'c')
105+
if get_option('default_library') == 'static'
106+
add_project_arguments('-DXML_STATIC', language: 'c')
107+
expat_static_args += '-DXML_STATIC'
108+
endif
109+
else
110+
add_project_arguments('-DXMLIMPORT=__attribute__ ((visibility("default")))', language: 'c')
111+
if get_option('use_dev_urandom')
112+
add_project_arguments('-DXML_DEV_URANDOM', language: 'c')
113+
endif
114+
endif
115+
116+
incdir = include_directories('lib')
117+
118+
libexpat = library(
119+
'expat',
120+
'lib/xmlparse.c',
121+
'lib/xmlrole.c',
122+
'lib/xmltok.c',
123+
include_directories: incdir,
124+
dependencies: dep_libbsd,
125+
version: '1.9.3',
126+
soversion: host_machine.system() != 'windows' ? '1' : '',
127+
install: true,
128+
gnu_symbol_visibility: 'hidden',
129+
)
130+
131+
expat_dep = declare_dependency(
132+
link_with: libexpat,
133+
include_directories: incdir,
134+
compile_args: expat_static_args,
135+
)
136+
137+
pkg = import('pkgconfig')
138+
pkg.generate(libexpat)
139+
140+
if get_option('build_tests')
141+
add_languages('cpp')
142+
143+
libtest = static_library(
144+
'libtest',
145+
'tests/chardata.c',
146+
'tests/memcheck.c',
147+
'tests/minicheck.c',
148+
'tests/structdata.c',
149+
include_directories: incdir,
150+
)
151+
152+
test(
153+
'runtests',
154+
executable(
155+
'runtests',
156+
'tests/runtests.c',
157+
include_directories: incdir,
158+
link_with: [libtest, libexpat],
159+
),
160+
)
161+
test(
162+
'runtestspp',
163+
executable(
164+
'runtestspp',
165+
'tests/runtestspp.cpp',
166+
include_directories: incdir,
167+
link_with: [libtest, libexpat],
168+
),
169+
)
170+
endif
171+
172+
# TODO: tools, examples, tests, docs
173+
# These are probably not necessary for a wrap, but someone might have use for
174+
# them

Diff for: subprojects/packagefiles/expat/meson_options.txt

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Copyright © 2018 Dylan Baker
2+
# Copyright © 2018 Intel Corporation
3+
4+
# Permission is hereby granted, free of charge, to any person obtaining a copy
5+
# of this software and associated documentation files (the "Software"), to deal
6+
# in the Software without restriction, including without limitation the rights
7+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
# copies of the Software, and to permit persons to whom the Software is
9+
# furnished to do so, subject to the following conditions:
10+
11+
# The above copyright notice and this permission notice shall be included in
12+
# all copies or substantial portions of the Software.
13+
14+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
# SOFTWARE.
21+
22+
option(
23+
'use_libbsd',
24+
type : 'feature',
25+
description : 'Use libbsd for arc4random_buf',
26+
)
27+
option(
28+
'xml_dtd',
29+
type : 'boolean',
30+
value : true,
31+
description : 'If true make parameter entity parsing functionality available',
32+
)
33+
option(
34+
'xml_ge',
35+
type : 'boolean',
36+
value : true,
37+
description : 'If true make general entity parsing functionality available',
38+
)
39+
option(
40+
'xml_ns',
41+
type : 'boolean',
42+
value : true,
43+
description : 'If true make XML Namespaces functionality available',
44+
)
45+
option(
46+
'use_dev_urandom',
47+
type : 'boolean',
48+
value : true,
49+
description : 'If true use /dev/urandom for entropy. Has no affect on platforms without /dev/urandom',
50+
)
51+
option(
52+
'build_tests',
53+
type : 'boolean',
54+
value : false,
55+
description : 'Build unit tests',
56+
)
57+
# TODO: tools, examples, tests, docs

0 commit comments

Comments
 (0)