forked from hughsie/passim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
146 lines (131 loc) · 4.13 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
project('passim', 'c',
version: '0.1.7',
license: 'LGPL-2.1+',
meson_version: '>=0.61.0',
default_options: ['warning_level=2', 'c_std=c11'],
)
# libtool versioning - this applies to libpassim
libpassim_lt_current = '1'
libpassim_lt_revision = '0'
libpassim_lt_age = '0'
libpassim_lt_version = '@0@.@1@.@2@'.format(libpassim_lt_current, libpassim_lt_age, libpassim_lt_revision)
warning_flags = [
'-Waggregate-return',
'-Wunused',
'-Warray-bounds',
'-Wcast-align',
'-Wclobbered',
'-Wdeclaration-after-statement',
'-Wdiscarded-qualifiers',
'-Wduplicated-branches',
'-Wduplicated-cond',
'-Wempty-body',
'-Wformat=2',
'-Wformat-nonliteral',
'-Wformat-security',
'-Wformat-signedness',
'-Wignored-qualifiers',
'-Wimplicit-function-declaration',
'-Wimplicit-int',
'-Winit-self',
'-Wint-conversion',
'-Wlogical-op',
'-Wmaybe-uninitialized',
'-Wmissing-declarations',
'-Wmissing-format-attribute',
'-Wmissing-include-dirs',
'-Wmissing-noreturn',
'-Wmissing-parameter-type',
'-Wmissing-prototypes',
'-Wnested-externs',
'-Wno-cast-function-type',
'-Wno-address-of-packed-member', # incompatible with g_autoptr()
'-Wno-unknown-pragmas',
'-Wno-missing-field-initializers',
'-Wno-strict-aliasing',
'-Wno-suggest-attribute=format',
'-Wno-typedef-redefinition',
'-Wno-unknown-warning-option',
'-Wno-unused-parameter',
'-Wold-style-definition',
'-Woverride-init',
'-Wpointer-arith',
'-Wredundant-decls',
'-Wreturn-type',
'-Wshadow',
'-Wsign-compare',
'-Wstrict-aliasing',
'-Wstrict-prototypes',
'-Wswitch-default',
'-Wtype-limits',
'-Wundef',
'-Wuninitialized',
'-Wunused-but-set-variable',
'-Wunused-variable',
'-Wvla',
'-Wwrite-strings'
]
cc = meson.get_compiler('c')
add_project_arguments(cc.get_supported_arguments(warning_flags), language: 'c')
add_project_arguments('-DPASSIM_COMPILATION', language: 'c')
# needed for memfd_create()
add_project_arguments('-D_GNU_SOURCE', language: 'c')
prefix = get_option('prefix')
sysconfdir = prefix / get_option('sysconfdir')
bindir = prefix / get_option('bindir')
localstatedir = prefix / get_option('localstatedir')
libexecdir = prefix / get_option('libexecdir')
datadir = prefix / get_option('datadir')
localedir = prefix / get_option('localedir')
conf = configuration_data()
conf.set_quoted('PACKAGE_NAME', meson.project_name())
conf.set_quoted('PACKAGE_DATADIR', datadir)
conf.set_quoted('PACKAGE_SYSCONFDIR', sysconfdir)
conf.set_quoted('PACKAGE_LOCALEDIR', localedir)
conf.set_quoted('PACKAGE_LOCALSTATEDIR', localstatedir)
conf.set_quoted('VERSION', meson.project_version())
conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
varr = meson.project_version().split('.')
conf.set('MAJOR_VERSION', varr[0])
conf.set('MINOR_VERSION', varr[1])
conf.set('MICRO_VERSION', varr[2])
systemd = dependency('systemd', version: '>= 211')
systemd_root_prefix = get_option('systemd_root_prefix')
if systemd_root_prefix == ''
pkgconfig_kwargs = {}
else
pkgconfig_kwargs = {
'pkgconfig_define': ['rootprefix', systemd_root_prefix],
}
endif
systemdunitdir = systemd.get_variable(pkgconfig: 'systemdsystemunitdir', kwargs: pkgconfig_kwargs)
sysusersdir = systemd.get_variable(pkgconfig: 'sysusersdir', kwargs: pkgconfig_kwargs)
# get source version, falling back to package version
git = find_program('git', required: false)
tag = false
if git.found()
source_version = run_command([git, 'describe'], check: false).stdout().strip()
if source_version == ''
source_version = meson.project_version()
endif
tag = run_command([git, 'describe', '--exact-match'], check: false).returncode() == 0
else
source_version = meson.project_version()
endif
conf.set_quoted('SOURCE_VERSION', source_version)
root_incdir = include_directories('.')
libgio = dependency('gio-unix-2.0', version: '>= 2.68.0')
libsoup = dependency('libsoup-3.0', version: '>= 3.4.0')
libgnutls = dependency('gnutls', version: '>= 3.6.0')
if cc.has_function('memfd_create')
conf.set('HAVE_MEMFD_CREATE', '1')
endif
configure_file(
output: 'config.h',
configuration: conf
)
python3 = import('python').find_installation('python3')
subdir('libpassim')
subdir('src')
subdir('data')
subdir('po')