-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
222 lines (188 loc) · 4.62 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
project('CM4all MyProxy', 'cpp', version: '0.23',
meson_version: '>= 1.0',
default_options: [
'cpp_std=c++2a',
'warning_level=3',
'fmt:cpp_std=c++2a',
],
)
debug = get_option('b_ndebug') != 'true'
compiler = meson.get_compiler('cpp')
conf = configuration_data()
common_flags = [
'-D_GNU_SOURCE',
]
test_common_flags = [
'-Wcast-align',
'-Wcast-qual',
'-Wdouble-promotion',
'-Wfloat-equal',
'-Wmissing-declarations',
'-Wmissing-noreturn',
'-Wmissing-format-attribute',
'-Wredundant-decls',
'-Wshadow',
'-Wundef',
'-Wunused',
'-Wvla',
'-Wwrite-strings',
'-Wno-missing-field-initializers',
# clang specific warning options:
'-Wunreachable-code-aggressive',
#'-Wused-but-marked-unused', (disabled due to OpenSSL)
]
test_global_common_flags = [
'-fvisibility=hidden',
]
add_global_link_arguments(
compiler.get_supported_link_arguments(
# make relocations read-only (hardening)
'-Wl,-z,relro',
# no lazy binding, please - not worth it for a daemon
'-Wl,-z,now',
),
language: 'cpp'
)
if not debug
test_global_common_flags += [
'-ffunction-sections',
'-fdata-sections',
]
add_global_link_arguments(
compiler.get_supported_link_arguments(
'-Wl,--gc-sections',
'-Wl,--icf=all',
),
language: 'cpp'
)
endif
test_global_cxxflags = test_global_common_flags + [
]
test_cxxflags = test_common_flags + [
'-fno-threadsafe-statics',
'-fmerge-all-constants',
'-Wcomma-subscript',
'-Wextra-semi',
'-Wmismatched-tags',
'-Woverloaded-virtual',
'-Wsign-promo',
'-Wvolatile',
'-Wvirtual-inheritance',
# a vtable without a dtor is just fine
'-Wno-non-virtual-dtor',
# clang specific warning options:
'-Wcomma',
'-Wheader-hygiene',
'-Winconsistent-missing-destructor-override',
]
add_global_arguments(common_flags, language: 'cpp')
add_global_arguments(compiler.get_supported_arguments(test_global_cxxflags), language: 'cpp')
add_project_arguments(compiler.get_supported_arguments(test_cxxflags), language: 'cpp')
libsystemd = dependency('libsystemd', required: get_option('systemd'))
inc = include_directories(
'.',
'src',
'libcommon/src',
)
libcommon_enable_json = false
libcommon_require_libcrypto = get_option('openssl')
openssl_min_version = '3'
openssl_api_compat = '0x30000000L'
sources = []
subdir('libcommon/src/util')
subdir('libcommon/src/lib/fmt')
subdir('libcommon/src/lib/openssl')
subdir('libcommon/src/lib/sodium')
subdir('libcommon/src/io')
subdir('libcommon/src/io/linux')
subdir('libcommon/src/system')
subdir('libcommon/src/net')
subdir('libcommon/src/net/linux')
subdir('libcommon/src/event')
subdir('libcommon/src/event/net')
subdir('libcommon/src/memory')
subdir('src/memory')
subdir('libcommon/src/co')
subdir('libcommon/src/lua')
subdir('libcommon/src/lua/io')
subdir('libcommon/src/lua/net')
subdir('libcommon/src/lua/event')
subdir('libcommon/src/lua/sodium')
if libsystemd.found()
# systemd support also enables the systemd-resolved client which
# uses a protocol with JSON payloads
sources += 'src/AsyncResolver.cxx'
subdir('libcommon/src/lib/nlohmann_json')
subdir('libcommon/src/event/systemd')
libsystemd = event_systemd_dep
endif
libcommon_require_pg = get_option('pg')
subdir('libcommon/src/pg')
if pg_dep.found()
subdir('libcommon/src/lua/pg')
pg_dep = lua_pg_dep
endif
conf.set('HAVE_LIBSYSTEMD', libsystemd.found())
conf.set('HAVE_OPENSSL', crypto_dep.found())
conf.set('HAVE_PG', pg_dep.found())
configure_file(output: 'config.h', configuration: conf)
subdir('src/auth')
my = static_library(
'my',
'src/MysqlReader.cxx',
'src/MysqlParser.cxx',
'src/MysqlMakePacket.cxx',
'src/MysqlForwardPacket.cxx',
'src/MysqlTextResultsetParser.cxx',
include_directories: inc,
dependencies: [
event_net_dep,
util_dep,
dependency('libmd'), # SHA-1 implementation for "mysql_native_password"
],
)
my_dep = declare_dependency(
link_with: my,
)
executable(
'cm4all-myproxy',
sources,
'src/system/SetupProcess.cxx',
'src/Options.cxx',
'src/Cluster.cxx',
'src/Check.cxx',
'src/LResolver.cxx',
'src/Policy.cxx',
'src/Peer.cxx',
'src/Connection.cxx',
'src/LHandler.cxx',
'src/LClient.cxx',
'src/LAction.cxx',
'src/Instance.cxx',
'src/PrometheusExporter.cxx',
'src/CommandLine.cxx',
'src/Main.cxx',
include_directories: inc,
dependencies: [
libsystemd,
my_dep,
auth_dep,
util_dep,
io_linux_dep,
net_dep,
net_linux_dep,
event_dep,
lua_dep,
lua_io_dep,
lua_net_dep,
lua_event_dep,
lua_sodium_dep,
pg_dep,
sodium_dep,
memory_dep,
],
install: true,
install_dir: 'sbin',
)
subdir('test')
subdir('doc')