@@ -14,7 +14,6 @@ gnome = import('gnome')
1414glib = dependency (' glib-2.0' , version : ' >= 2.12' , static : true )
1515gobject = dependency (' gobject-2.0' , version : ' >= 0.9.4' , static : true )
1616gio = dependency (' gio-2.0' , version : ' >= 2.14' , static : true )
17- libxml = dependency (' libxml-2.0' , version : ' >= 2.7' , static : true )
1817zlib = dependency (' zlib' , static : true )
1918
2019add_project_arguments (' -w' , language : ' c' )
@@ -30,6 +29,113 @@ if host_machine.system() == 'windows'
3029 )
3130endif
3231
32+ # --- libxml2 (static, built from source) ---
33+ cc = meson .get_compiler(' c' )
34+
35+ xml2_version_config = configuration_data ()
36+ xml2_version_config.set(' VERSION' , ' 2.16.0' )
37+ xml2_version_config.set(' LIBXML_VERSION_NUMBER' , ' 21600' )
38+ xml2_version_config.set(' LIBXML_VERSION_EXTRA' , '' )
39+ xml2_version_config.set(' WITH_THREADS' , 1 )
40+ xml2_version_config.set(' WITH_THREAD_ALLOC' , 0 )
41+ xml2_version_config.set(' WITH_OUTPUT' , 1 )
42+ xml2_version_config.set(' WITH_PUSH' , 1 )
43+ xml2_version_config.set(' WITH_READER' , 1 )
44+ xml2_version_config.set(' WITH_PATTERN' , 0 )
45+ xml2_version_config.set(' WITH_WRITER' , 1 )
46+ xml2_version_config.set(' WITH_SAX1' , 0 )
47+ xml2_version_config.set(' WITH_HTTP' , 0 )
48+ xml2_version_config.set(' WITH_VALID' , 1 )
49+ xml2_version_config.set(' WITH_HTML' , 0 )
50+ xml2_version_config.set(' WITH_C14N' , 0 )
51+ xml2_version_config.set(' WITH_CATALOG' , 0 )
52+ xml2_version_config.set(' WITH_WINPATH' , host_machine .system() == ' windows' ? 1 : 0 )
53+ xml2_version_config.set(' WITH_XPATH' , 0 )
54+ xml2_version_config.set(' WITH_XPTR' , 0 )
55+ xml2_version_config.set(' WITH_XINCLUDE' , 0 )
56+ xml2_version_config.set(' WITH_ICONV' , 1 )
57+ xml2_version_config.set(' WITH_ICU' , 0 )
58+ xml2_version_config.set(' WITH_ISO8859X' , 1 )
59+ xml2_version_config.set(' WITH_DEBUG' , 0 )
60+ xml2_version_config.set(' WITH_REGEXPS' , 0 )
61+ xml2_version_config.set(' WITH_RELAXNG' , 0 )
62+ xml2_version_config.set(' WITH_SCHEMAS' , 0 )
63+ xml2_version_config.set(' WITH_SCHEMATRON' , 0 )
64+ xml2_version_config.set(' WITH_MODULES' , 0 )
65+ xml2_version_config.set(' WITH_ZLIB' , 1 )
66+ xml2_version_config.set(' MODULE_EXTENSION' , '' )
67+
68+ xml2_version_h = configure_file (
69+ input : ' libxml2/include/libxml/xmlversion.h.in' ,
70+ output : ' xmlversion-gen.h' ,
71+ configuration : xml2_version_config,
72+ )
73+
74+ xml2_config = configuration_data ()
75+ xml2_config.set(' HAVE_STDINT_H' , 1 )
76+ xml2_config.set(' HAVE_DECL_GETENTROPY' , cc.has_function(' getentropy' , prefix : ' #include <sys/random.h>' ) ? 1 : 0 )
77+ xml2_config.set(' HAVE_DECL_GLOB' , cc.has_function(' glob' , prefix : ' #include <glob.h>' ) ? 1 : 0 )
78+ xml2_config.set(' HAVE_DECL_MMAP' , cc.has_function(' mmap' , prefix : ' #include <sys/mman.h>' ) ? 1 : 0 )
79+ xml2_config.set(' HAVE_FUNC_ATTRIBUTE_DESTRUCTOR' , cc.compiles(' void __attribute__((destructor)) f(void) {} int main(void) { return 0; }' ) ? 1 : false )
80+ xml2_config.set(' HAVE_DLOPEN' , cc.has_function(' dlopen' ) ? 1 : false )
81+ xml2_config.set(' XML_THREAD_LOCAL' , ' _Thread_local' )
82+
83+ xml2_config_h = configure_file (
84+ output : ' xml2-config.h' ,
85+ configuration : xml2_config,
86+ )
87+
88+ libxml2_sources = files (
89+ ' libxml2/buf.c' ,
90+ ' libxml2/chvalid.c' ,
91+ ' libxml2/dict.c' ,
92+ ' libxml2/encoding.c' ,
93+ ' libxml2/entities.c' ,
94+ ' libxml2/error.c' ,
95+ ' libxml2/globals.c' ,
96+ ' libxml2/hash.c' ,
97+ ' libxml2/list.c' ,
98+ ' libxml2/parser.c' ,
99+ ' libxml2/parserInternals.c' ,
100+ ' libxml2/SAX2.c' ,
101+ ' libxml2/threads.c' ,
102+ ' libxml2/tree.c' ,
103+ ' libxml2/uri.c' ,
104+ ' libxml2/valid.c' ,
105+ ' libxml2/xmlIO.c' ,
106+ ' libxml2/xmlmemory.c' ,
107+ ' libxml2/xmlstring.c' ,
108+ ' libxml2/xmlsave.c' ,
109+ ' libxml2/xmlreader.c' ,
110+ ' libxml2/xmlwriter.c' ,
111+ )
112+
113+ libxml2_deps = [zlib]
114+
115+ xml2_all_inc_dirs = include_directories (
116+ ' .' ,
117+ ' libxml2' ,
118+ ' libxml2/include' ,
119+ )
120+
121+ libxml2 = static_library (' xml2' ,
122+ libxml2_sources,
123+ xml2_config_h,
124+ xml2_version_h,
125+ include_directories : xml2_all_inc_dirs,
126+ dependencies : libxml2_deps,
127+ c_args : [
128+ ' -include' , meson .project_build_root() / ' xml2-config.h' ,
129+ ],
130+ )
131+
132+ libxml = declare_dependency (
133+ link_with : libxml2,
134+ include_directories : xml2_all_inc_dirs,
135+ dependencies : libxml2_deps,
136+ sources : xml2_version_h,
137+ )
138+
33139bison = find_program (' bison' )
34140
35141# --- config.h ---
@@ -252,7 +358,6 @@ libmsi_dep = declare_dependency(
252358
253359# --- Platform-specific dependencies and link args ---
254360platform_link_deps = []
255- platform_extra_deps = []
256361
257362if host_machine .system() == ' linux'
258363 libeconf = static_library (' econf' ,
@@ -319,13 +424,14 @@ wixl = executable('wixl',
319424 ' --pkg' , ' posix' ,
320425 ' --pkg' , ' libmsi-1.0' ,
321426 ' --pkg' , ' libgcab-1.0' ,
427+ ' --pkg' , ' libxml-2.0' ,
322428 ' --vapidir=' + vapi_dir,
323429 ' --vapidir=' + meson .project_build_root(),
324430 ],
325431 c_args : [' -include' , meson .project_build_root() / ' config.h' ],
326432 include_directories : [inc_dirs, gcab_inc_dirs],
327433 link_with : [libcommon] + platform_link_deps,
328- dependencies : [libmsi_dep, libgcab_dep, glib, gio, libxml] + platform_extra_deps ,
434+ dependencies : [libmsi_dep, libgcab_dep, glib, gio, libxml],
329435 link_args : platform_link_args,
330436 install : true ,
331437)
0 commit comments