Debian Codegraph @

meson.build

raw
1 project(
2 'cellbroadcastd',
3 'c',
4 version: '0.0.3',
5 license: 'GPLv3+',
6 meson_version: '>= 1.2.0',
7 default_options: ['warning_level=1', 'buildtype=debugoptimized', 'c_std=gnu11'],
8 )
9
10 app_id = 'org.freedesktop.cbd'
11
12 gio = dependency('gio-2.0', version: '>=2.76.0')
13 gio_unix = dependency('gio-unix-2.0', version: '>=2.76.0')
14 glib = dependency('glib-2.0', version: '>=2.76.0')
15 gmobile = dependency(
16 'gmobile',
17 version: '>= 0.4.0',
18 fallback: ['gmobile', 'gmobile_dep'],
19 default_options: [
20 'examples=false',
21 'introspection=false',
22 'gtk_doc=false',
23 'tests=false',
24 'vapi=false',
25 'hwdb=false',
26 ],
27 )
28 mbpi = dependency('mobile-broadband-provider-info')
29 mm_glib = dependency('mm-glib', version: '>=1.24.0')
30
31 # Import the gvdb sources as a subproject to avoid having the copylib in-tree
32 subproject('gvdb', default_options: {'tests': false})
33 gvdb = dependency('gvdb')
34
35 prefix = get_option('prefix')
36
37 bindir = prefix / get_option('bindir')
38 datadir = prefix / get_option('datadir')
39 libdir = prefix / get_option('libdir')
40 girdir = prefix / datadir / 'gir-1.0'
41 ifacedir = prefix / datadir / 'dbus-1' / 'interfaces'
42 servicedir = prefix / datadir / 'dbus-1' / 'services'
43 libexecdir = prefix / get_option('libexecdir')
44 typelibdir = prefix / libdir / 'girepository-1.0'
45 vapidir = prefix / datadir / 'vala' / 'vapi'
46 desktopdir = prefix / datadir / 'applications'
47
48 systemd_user_unit_dir = get_option('systemd_user_unit_dir')
49 systemd_dep = dependency('systemd', required: false)
50 if systemd_user_unit_dir == ''
51 if systemd_dep.found()
52 systemd_user_unit_dir = systemd_dep.get_variable('systemd_user_unit_dir')
53 else
54 systemd_user_unit_dir = prefix / libdir / 'systemd' / 'user'
55 endif
56 endif
57
58 run_data = configuration_data()
59 run_data.set('ABS_BUILDDIR', meson.current_build_dir())
60 run_data.set('ABS_SRCDIR', meson.current_source_dir())
61 configure_file(input: 'run.in', output: 'run', configuration: run_data)
62
63 i18n = import('i18n')
64 gnome = import('gnome')
65
66 cc = meson.get_compiler('c')
67
68 test_c_args = [
69 '-Wcast-align',
70 '-Wdate-time',
71 ['-Werror=format-security', '-Werror=format=2'],
72 '-Wendif-labels',
73 '-Werror=incompatible-pointer-types',
74 '-Werror=missing-declarations',
75 '-Werror=overflow',
76 '-Werror=return-type',
77 '-Werror=shift-count-overflow',
78 '-Werror=shift-overflow=2',
79 '-Werror=implicit-fallthrough=3',
80 '-Wformat-nonliteral',
81 '-Wformat-security',
82 '-Winit-self',
83 '-Wmaybe-uninitialized',
84 '-Wmissing-field-initializers',
85 '-Wmissing-include-dirs',
86 '-Wmissing-noreturn',
87 '-Wnested-externs',
88 '-Wno-missing-field-initializers',
89 '-Wno-sign-compare',
90 '-Wno-strict-aliasing',
91 '-Wno-unused-parameter',
92 '-Wold-style-definition',
93 '-Wpointer-arith',
94 '-Wredundant-decls',
95 '-Wstrict-prototypes',
96 '-Wtype-limits',
97 '-Wundef',
98 '-Wunused-function',
99 ]
100
101 if get_option('buildtype') != 'plain'
102 test_c_args += '-fstack-protector-strong'
103 endif
104
105 global_c_args = [
106 '-DGMOBILE_USE_UNSTABLE_API',
107 '-DLIBCELLBROADCAST_COMPILATION',
108 '-DCBD_VERSION="@0@"'.format(meson.project_version()),
109 ]
110
111 add_project_arguments(global_c_args + cc.get_supported_arguments(test_c_args), language: 'c')
112
113 apiversion = '0.0'
114 libname = 'libcellbroadcast-' + apiversion
115
116 introspection_feature = get_option('introspection')
117 introspection = introspection_feature.enabled() or introspection_feature.auto()
118
119 have_mm_cbs_set_channels = false
120 if cc.has_function('mm_gdbus_modem_cell_broadcast_call_set_channels_sync', dependencies: mm_glib)
121 have_mm_cbs_set_channels = true
122 endif
123
124 config_h = configuration_data()
125 config_h.set_quoted('CBD_SERVICE_PROVIDER_DATABASE', mbpi.get_variable('database'))
126 config_h.set('CBD_MM_HAS_SET_CHANNELS', have_mm_cbs_set_channels)
127 config_h.set_quoted('CBD_APP_ID', app_id)
128 config_h.set_quoted('CBD_VERSION', meson.project_version())
129 configure_file(output: 'cbd-config.h', configuration: config_h)
130 cbd_root_inc = include_directories('.')
131
132 subdir('po')
133 subdir('data')
134 subdir('libcellbroadcast')
135 subdir('src')
136 subdir('cli')
137 subdir('tests')
138
139 summary(
140 {
141 'Daemon': get_option('daemon'),
142 'Systemd user unit directory': systemd_user_unit_dir,
143 'Tests': get_option('tests'),
144 'MM SetChannel support': have_mm_cbs_set_channels,
145 'GObject introspection': introspection,
146 },
147 bool_yn: true,
148 section: 'Build',
149 )
150
151 gnome.post_install(glib_compile_schemas: true)