-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmeson.build
154 lines (136 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
project('Btrfsd', 'c',
meson_version: '>=0.60',
default_options: ['c_std=c11', 'cpp_std=gnu++14'],
license: 'LGPL-2.1+',
version: '0.2.3',
)
cc = meson.get_compiler('c')
source_root = meson.project_source_root()
btrfsd_version = meson.project_version()
varr = btrfsd_version.split('.')
btrfsd_major_version = varr[0]
btrfsd_minor_version = varr[1]
btrfsd_micro_version = varr[2]
#
# Configure files
#
btrfs_exe_path = get_option('btrfs-cmd')
if btrfs_exe_path == 'auto'
btrfs_exe = find_program('btrfs', dirs: ['/usr/bin', '/usr/sbin', '/bin', '/sbin'], required : false)
btrfs_exe_path = btrfs_exe.found() ? btrfs_exe.full_path() : '/usr/bin/btrfs'
endif
message('Using `btrfs` executable:', btrfs_exe_path)
conf = configuration_data()
conf.set('BTRFSD_MAJOR_VERSION_CONF', btrfsd_major_version)
conf.set('BTRFSD_MINOR_VERSION_CONF', btrfsd_minor_version)
conf.set('BTRFSD_MICRO_VERSION_CONF', btrfsd_micro_version)
conf.set_quoted('PACKAGE_VERSION', btrfsd_version)
conf.set_quoted('GETTEXT_PACKAGE', 'btrfsd')
conf.set_quoted('LOCALEDIR',
get_option('prefix') / get_option('localedir'))
conf.set_quoted('LOCALSTATEDIR',
get_option('prefix') / get_option('localstatedir'))
conf.set_quoted('LIBEXECDIR',
get_option('prefix') / get_option('libexecdir'))
conf.set_quoted('DATADIR',
get_option('prefix') / get_option('datadir'))
conf.set_quoted('LIBDIR',
get_option('prefix') / get_option('libdir'))
conf.set_quoted('BINDIR',
get_option('prefix') / get_option('bindir'))
conf.set_quoted('SYSCONFDIR',
get_option('prefix') / get_option('sysconfdir'))
conf.set_quoted('BTRFS_CMD', btrfs_exe_path)
conf.set('HAVE_SYSTEMD', true)
conf.set('_DEFAULT_SOURCE', true)
configure_file(output: 'config.h', configuration: conf)
root_inc_dir = include_directories ('.')
if get_option('static-analysis') and host_machine.system() != 'windows'
if cc.get_id() != 'gcc'
error('You need to compile with GCC to run the static analyzer!')
endif
# enable statuc analyzer
add_project_arguments(['-fanalyzer'], language : 'c')
# make false-positive non-fatal with GCC 12 for now
if cc.version().version_compare('>11<13')
add_project_arguments(['-Wno-error=analyzer-use-of-uninitialized-value'], language : 'c')
endif
# g_error has a deliberate infinite loop, so we have to suppress the new warning for now
if cc.version().version_compare('>13<15')
add_project_arguments(['-Wno-error=analyzer-infinite-loop'], language : 'c')
endif
endif
#
# Custom C flags
#
sanitizer_libs = []
if get_option('maintainer')
maintainer_c_args = ['-Werror',
'-Wall',
'-Wextra',
'-Wcast-align',
'-Wno-uninitialized',
'-Wempty-body',
'-Winit-self',
'-Wnull-dereference',
'-Wfloat-equal',
'-Winline',
'-Wno-error=comment',
]
add_project_arguments(maintainer_c_args, language: 'c')
endif
# a few compiler warning flags we always want enabled
add_project_arguments(
cc.get_supported_arguments([
'-Werror=shadow',
'-Werror=empty-body',
'-Werror=strict-prototypes',
'-Werror=missing-prototypes',
'-Werror=implicit-function-declaration',
'-Werror=pointer-arith',
'-Werror=missing-declarations',
'-Werror=return-type',
'-Werror=int-conversion',
'-Werror=incompatible-pointer-types',
'-Werror=misleading-indentation',
'-Werror=missing-include-dirs',
'-Werror=declaration-after-statement',
'-Werror=format-security',
'-Wno-missing-field-initializers',
'-Wno-error=missing-field-initializers',
'-Wno-unused-parameter',
'-Wno-error=unused-parameter',
]),
language: 'c'
)
if cc.get_id() == 'clang'
# Clang doesn't understand autofree helpers on GMutexLocker and thinks
# these variables are irrelevant, so this warning when used with Clang
# gives many false-positives
add_project_arguments(
'-Wno-unused-variable',
language: 'c'
)
endif
#
# Dependencies
#
systemd_dep = dependency('systemd')
glib_dep = dependency('glib-2.0', version: '>= 2.72')
gobject_dep = dependency('gobject-2.0', version: '>= 2.72')
gio_dep = dependency('gio-2.0', version: '>= 2.72')
json_glib_dep = dependency('json-glib-1.0', version: '>= 1.6.2')
mount_dep = dependency('mount')
libsystemd_dep = dependency('libsystemd')
#
# Modules
#
fs = import('fs')
glib = import('gnome')
#
# Directories
#
subdir('src/')
subdir('data/')
subdir('tests/')
subdir('docs/')