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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
project('qalculate-helper', 'cpp', version: '5.0.6', default_options: [
'warning_level=3',
'cpp_std=c++17',
'buildtype=release',
])
add_project_arguments([], language: 'cpp')
cpp = meson.get_compiler('cpp')
dependencies = []
flags = []
link_flags = []
libqalculate = dependency('libqalculate')
if get_option('libqalculate_static_link')
dependencies += cpp.find_library('qalculate', dirs: libqalculate.get_variable('libdir'), static: true)
dependencies += libqalculate.partial_dependency(compile_args: true, includes: true, sources: true)
dependencies += dependency('mpfr')
dependencies += dependency('icu-uc')
dependencies += dependency('libxml-2.0')
dependencies += dependency('libcurl')
else
dependencies += libqalculate
endif
if get_option('prefer_static') or get_option('libqalculate_static_link')
link_flags += '-Wl,-zmuldefs'
endif
libqalculate_path = libqalculate.get_variable('prefix')
if get_option('expect_custom_libqalculate') and libqalculate_path in ['/usr']
error('libqalculate_expect_custom_prefix is set to true, but libqalculate was found in',
libqalculate_path,
'(hint: run with PKG_CONFIG_PATH=/path/to/prefix/lib/pkgconfig/)')
endif
seccomp = dependency('libseccomp', required: get_option('seccomp'))
if seccomp.found()
dependencies += seccomp
flags += '-DSECCOMP'
else
warning('Building without SECCOMP support, do not use in production!')
endif
capng = dependency('libcap-ng', required: get_option('setuid'))
if capng.found()
dependencies += capng
uid = get_option('setuid_uid')
gid = get_option('setuid_gid')
flags += '-DSETUID'
flags += f'-DSETUID_UID=@uid@'
flags += f'-DSETUID_GID=@gid@'
else
warning('Building without SETUID support, do not use in production!')
endif
if get_option('preload_datasets')
flags += '-DLIBQALCULATE_PRELOAD_DATASETS'
endif
if get_option('defang_calculator')
flags += '-DLIBQALCULATE_DEFANG'
endif
if get_option('debug')
flags += '-DENABLE_DEBUG'
else
flags += '-D_FORTIFY_SOURCE=2'
flags += '-fstack-protector-strong'
flags += '-march=native'
link_flags += '-Wl,-znow'
endif
add_project_arguments(flags, language: 'cpp')
add_project_link_arguments(link_flags, language: 'cpp')
if get_option('exchange_rate_updater').allowed()
executable('exchange-rate-updater', [
'src/exchange_rate_updater.cpp',
'src/exchange_update_exception.cpp',
'src/qalculate_exception.cpp',
'src/security_util.cpp',
], include_directories: [
include_directories('include')
], dependencies: dependencies)
endif
executable('qalculate-helper', [
'src/security_util.cpp',
'src/exchange_update_exception.cpp',
'src/qalculate_exception.cpp',
'src/qalculate_helper.cpp',
'src/timeout_exception.cpp',
], include_directories: [
include_directories('include')
], dependencies: dependencies)
message('Building with libqalculate from', libqalculate.get_variable(pkgconfig: 'prefix'))
|