-
-
Notifications
You must be signed in to change notification settings - Fork 35
/
meson.build
82 lines (72 loc) · 3.23 KB
/
meson.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
project('zim-tools', ['c', 'cpp'],
version : '3.5.0',
license : 'GPLv3+',
default_options : ['c_std=c11', 'cpp_std=c++17', 'werror=true', 'warning_level=1'])
add_global_arguments('-DVERSION="@0@"'.format(meson.project_version()), language : 'cpp')
static_linkage = get_option('static-linkage')
compiler = meson.get_compiler('cpp')
if static_linkage
# Static build is not supported on MacOS
if host_machine.system() != 'darwin'
add_global_link_arguments('-static-libstdc++', '--static', language:'cpp')
endif
if compiler.get_id() == 'gcc' and build_machine.system() == 'linux'
add_global_link_arguments('-Wl,--whole-archive', '-lpthread', '-Wl,--no-whole-archive', language:'cpp')
endif
endif
libzim_dep = dependency('libzim', version:['>=9.2.0', '<10.0.0'], static:static_linkage)
with_xapian_support = compiler.has_header_symbol('zim/zim.h', 'LIBZIM_WITH_XAPIAN')
find_library_in_compiler = meson.version().version_compare('>=0.31.0')
rt_dep = dependency('rt', required:false)
docopt_dep = dependency('docopt', static:static_linkage)
icu_dep = dependency('icu-i18n', static:static_linkage)
with_writer = host_machine.system() != 'windows'
if with_writer
thread_dep = dependency('threads')
zlib_dep = dependency('zlib', static:static_linkage)
gumbo_dep = dependency('gumbo', static:static_linkage)
magic_dep = dependency('libmagic', static:static_linkage, required:false)
# libmagic.pc has been introduced in version 5.39 of
# File. Unfortunately Ubuntu 20.04 (Focal) still uses version
# 5.38. Therefore we have to keep this special handling. As
# soon as Ubuntu 20.04 will move forward we will be able to remove
# this custom code. Check https://launchpad.net/ubuntu/+source/file
# and https://bugs.launchpad.net/ubuntu/+source/file/+bug/1951594
if not magic_dep.found()
magic_include_path = ''
magic_prefix_install = get_option('magic-install-prefix')
if magic_prefix_install == ''
if compiler.has_header('magic.h')
if find_library_in_compiler
magic_lib = compiler.find_library('magic')
else
magic_lib = find_library('magic')
endif
magic_dep = declare_dependency(link_args:['-lmagic'])
else
error('magic.h not found')
endif
else
if not find_library_in_compiler
error('For custom magic_prefix_install you need a meson version >=0.31.0')
endif
magic_include_path = magic_prefix_install + '/include'
magic_include_args = ['-I'+magic_include_path]
if compiler.has_header('magic.h', args:magic_include_args)
magic_include_dir = include_directories(magic_include_path, is_system:true)
magic_lib_path = join_paths(magic_prefix_install, get_option('libdir'))
magic_lib = compiler.find_library('magic', dirs:magic_lib_path, required:false)
if not magic_lib.found()
magic_lib_path = join_paths(magic_prefix_install, 'lib')
magic_lib = compiler.find_library('magic', dirs:magic_lib_path)
endif
magic_link_args = ['-L'+magic_lib_path, '-lmagic']
magic_dep = declare_dependency(include_directories:magic_include_dir, link_args:magic_link_args)
else
error('magic.h not found')
endif
endif
endif
endif
subdir('src')
subdir('test')