File: meson.build

package info (click to toggle)
packagekit 1.3.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,704 kB
  • sloc: ansic: 56,209; cpp: 13,919; python: 4,970; xml: 4,945; sh: 313; perl: 60; makefile: 57
file content (208 lines) | stat: -rw-r--r-- 6,250 bytes parent folder | download
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
project('PackageKit', 'c',
  meson_version : '>=1.0',
  default_options : ['warning_level=2', 'c_std=gnu17'],

  license : 'LGPL-2.1+',
  version : '1.3.3',
)

gnome = import('gnome')
i18n = import('i18n')
pkg = import('pkgconfig')

source_root = meson.project_source_root()

glib_req_version = '2.76'
glib_req = '>= @0@'.format(glib_req_version)
glib_major = glib_req_version.split('.')[0].to_int()
glib_minor = glib_req_version.split('.')[1].to_int()

glib_dep = dependency('glib-2.0', version: glib_req)
gobject_dep = dependency('gobject-2.0', version: glib_req)
gio_dep = dependency('gio-2.0', version: glib_req)
gio_unix_dep = dependency('gio-unix-2.0', version: glib_req)
gmodule_dep = dependency('gmodule-2.0', version: glib_req)
sqlite3_dep = dependency('sqlite3')
polkit_dep = dependency('polkit-gobject-1', version: '>=0.114')
ply_client_dep = dependency('ply-boot-client', version: '>=0.9.5', required: false)

if get_option('pkgctl')
    jansson_dep = dependency('jansson', version: '>=2.8', required: true)
endif

libsystemd = []
if get_option('systemd')
  libsystemd = dependency('libsystemd', version: '>=213')
  systemd_system_unit_dir = get_option('systemdsystemunitdir')
  systemd_user_unit_dir = get_option('systemduserunitdir')
  if systemd_system_unit_dir == '' or systemd_user_unit_dir == ''
    systemd = dependency('systemd')
  endif
  if systemd_system_unit_dir == ''
    systemd_system_unit_dir = systemd.get_variable(pkgconfig: 'systemdsystemunitdir')
  endif
  if systemd_user_unit_dir == ''
    systemd_user_unit_dir = systemd.get_variable(pkgconfig: 'systemduserunitdir')
  endif

  add_project_arguments ('-DHAVE_SYSTEMD_SD_DAEMON_H=1', language: 'c')
  add_project_arguments ('-DHAVE_SYSTEMD_SD_LOGIN_H=1', language: 'c')
  add_project_arguments ('-DHAVE_SYSTEMD_SD_JOURNAL_H=1', language: 'c')
endif

elogind = []
if get_option('elogind')
  elogind = dependency('elogind', version: '>=229.4')
  add_project_arguments ('-DHAVE_SYSTEMD_SD_LOGIN_H=1', language: 'c')
  add_project_arguments ('-DHAVE_SYSTEMD_SD_JOURNAL_H=1', language: 'c')
endif

if get_option('local_checkout')
  add_project_arguments ('-DPK_BUILD_LOCAL=1', language: 'c')
endif

if get_option('daemon_tests')
  add_project_arguments ('-DPK_ENABLE_DAEMON_TESTS=1', language: 'c')
endif

# Ensure functions like realpath(3) and other "default" functions are available
add_project_arguments ('-D_DEFAULT_SOURCE', language: 'c')

add_project_arguments (
  '-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_@0@_@1@'.format(glib_major, glib_minor),
  language: 'c'
)

# allow the daemon to include library files directly
add_project_arguments ('-DPK_COMPILATION', language: ['c', 'cpp'])

conf = configuration_data()
conf.set_quoted('DATADIR', join_paths(get_option('prefix'), get_option('datadir')))
conf.set_quoted('LIBDIR', join_paths(get_option('prefix'), get_option('libdir')))
conf.set_quoted('SYSCONFDIR', get_option('sysconfdir'))

conf.set_quoted('PROJECT_NAME', meson.project_name())
conf.set_quoted('PROJECT_VERSION', meson.project_version())

cc = meson.get_compiler('c')
if cc.has_function('setpriority')
  conf.set('HAVE_SETPRIORITY', '1')
endif
if cc.has_function('clearenv')
  conf.set('HAVE_CLEARENV', '1')
endif
if cc.has_header('unistd.h')
  conf.set('HAVE_UNISTD_H', '1')
endif

config_header = configure_file(
  output: 'config.h',
  configuration: conf,
)

config_dep = declare_dependency(
  sources: config_header,
  include_directories: include_directories('.')
)

pk_db_dir = join_paths(get_option('localstatedir'), 'lib', 'PackageKit')
local_state_dir = get_option('localstatedir')
test_data_dir = join_paths(source_root, 'tests', 'data')
package_data_dir = get_option('datadir')
package_locale_dir = join_paths(get_option('prefix'), get_option('datadir'), 'locale')
pk_plugin_dir = join_paths(get_option('prefix'), get_option('libdir'), 'packagekit-backend')

# enable strict checks and make warnings errors in maintainer mode
if get_option('maintainer')
  add_project_arguments(
    cc.get_supported_arguments([
            '-Werror',
            '-Wall',
            '-Wextra',
            '-Wcast-align',
            '-Wno-uninitialized',
            '-Wempty-body',
            '-Winit-self',
            '-Wnull-dereference',
            '-Wfloat-equal',
            '-Winline',
            '-Wno-error=comment',
        ], checked: 'warn'),
        language: ['c', 'cpp']
    )
endif

# default compiler flags for C and C++
# if a common compiler flag is not supported by C, then it likely
# isn't by C++ either. So, we don't need a double check here.
add_project_arguments(
    cc.get_supported_arguments([
        '-Werror=missing-include-dirs',
        '-Wno-strict-aliasing',
        '-Winline',
        '-Wno-unused-parameter',
        '-Wno-error=unused-parameter',
    ]),
    language: ['c', 'cpp']
)

# default compiler warning/error flags for C only
add_project_arguments(
  cc.get_supported_arguments([
    '-Wcast-align',
    '-Wno-uninitialized',
    '-Werror=missing-declarations',
    '-Wredundant-decls',
    '-Wpointer-arith',
    '-Wcast-align',
    '-Wwrite-strings',
    '-Winit-self',
    '-Wreturn-type',
    '-Wformat-nonliteral',
    '-Wformat-security',
    '-Wmissing-include-dirs',
    '-Wmissing-format-attribute',
    '-Wclobbered',
    '-Wempty-body',
    '-Wignored-qualifiers',
    '-Wsign-compare',
    '-Wtype-limits',
    '-Wuninitialized',
    '-Wmissing-parameter-type',
    '-Woverride-init',
    '-Wno-unused-parameter',
    '-Wno-error=unused-parameter',
    '-Werror=misleading-indentation',
    '-Werror=return-type',
    '-Werror=format-security',
    '-Wformat',
    '-Werror=shadow',
    '-Werror=missing-declarations',
    '-Werror=pointer-arith',
    '-Werror=strict-prototypes',
    '-Werror=missing-prototypes',
    '-Werror=implicit-function-declaration',
    '-Werror=int-conversion',
    '-Werror=incompatible-pointer-types',
    '-Werror=declaration-after-statement',
    '-Werror=empty-body',
  ]),
  language: 'c'
)

# default warning flags for C++ only
add_project_arguments(
  '-Werror=init-self',
  language: 'cpp'
)

subdir('po')
subdir('policy')
subdir('etc')
subdir('data')
subdir('lib')
subdir('src')
subdir('client')
subdir('backends')
subdir('contrib')
subdir('docs')