-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmeson.build
123 lines (109 loc) · 3.52 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
project('dbus-http', 'c',
version : '0.2',
license : 'Apache 2.0',
default_options: [
'c_std=gnu99',
'prefix=/usr',
'sysconfdir=/etc',
'localstatedir=/var',
]
)
conf = configuration_data()
conf.set('_GNU_SOURCE', true)
conf.set('__SANE_USERSPACE_TYPES__', true)
# Generate a config header file
config_h = configure_file(output : 'dbus-http-config.h', configuration : conf)
cc = meson.get_compiler('c')
foreach arg : ['-Wextra',
'-Werror=undef',
'-Wlogical-op',
'-Wmissing-include-dirs',
'-Wold-style-definition',
'-Wpointer-arith',
'-Winit-self',
'-Wdeclaration-after-statement',
'-Wfloat-equal',
'-Wsuggest-attribute=noreturn',
'-Werror=missing-prototypes',
'-Werror=implicit-function-declaration',
'-Werror=missing-declarations',
'-Werror=return-type',
'-Werror=incompatible-pointer-types',
'-Werror=format=2',
'-Wstrict-prototypes',
'-Wredundant-decls',
'-Wmissing-noreturn',
'-Wshadow',
'-Wendif-labels',
'-Wstrict-aliasing=2',
'-Wwrite-strings',
'-Werror=overflow',
'-Wdate-time',
'-Wnested-externs',
'-ffast-math',
'-fno-common',
'-fdiagnostics-show-option',
'-fno-strict-aliasing',
'-fvisibility=hidden',
'-fstack-protector',
'-fstack-protector-strong',
'-fPIE',
'--param=ssp-buffer-size=4',
]
if cc.has_argument(arg)
add_project_arguments(arg, language : 'c')
endif
endforeach
# "negative" arguments: gcc on purpose does not return an error for "-Wno-"
# arguments, just emits a warnings. So test for the "positive" version instead.
foreach arg : ['unused-parameter',
'missing-field-initializers',
'unused-result',
'format-signedness',
'error=nonnull', # work-around for gcc 7.1 turning this on on its own
]
if cc.has_argument('-W' + arg)
add_project_arguments('-Wno-' + arg, language : 'c')
endif
endforeach
#### unit file ####
prefixdir = get_option('prefix')
conf_inst = configuration_data()
conf_inst.set('bindir', join_paths(prefixdir, get_option('bindir')))
systemunitdir = join_paths(prefixdir, 'lib/systemd/system')
configure_file(input : 'data/dbus-http.service.in',
output : 'dbus-http.service',
configuration : conf_inst,
install_dir : systemunitdir)
#### dbus-http ####
src = [
'src/main.c',
'src/dbus-http.h',
'src/dbus-http.c',
'src/http-server.h',
'src/http-server.c',
'src/json.h',
'src/json.c',
'src/dbus.h',
'src/dbus.c',
'src/log.c',
'src/log.h',
'src/environment.h',
'src/systemd-compat.h'
]
dep_expat = dependency('expat')
dep_libmicrohttpd = dependency('libmicrohttpd')
dep_libsystemd = dependency('libsystemd')
executable('dbus-http',
sources : src,
c_args : ['-include', 'dbus-http-config.h'],
dependencies : [dep_expat, dep_libmicrohttpd, dep_libsystemd],
install : true
)
#### dbus-http-testd ####
src_testd = 'test/dbus-http-testd.c'
executable('dbus-http-testd',
sources : src_testd,
dependencies : [dep_libsystemd],
install : false
)