File: meson.build

package info (click to toggle)
krb5-auth-dialog 44.0~alpha1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,612 kB
  • sloc: ansic: 3,348; xml: 151; lex: 149; python: 69; yacc: 42; sh: 11; makefile: 6
file content (276 lines) | stat: -rw-r--r-- 8,402 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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
project('krb5-auth-dialog', 'c',
          version: '44.0.alpha1',
          license: 'GPLv2-or-later',
    meson_version: '>= 0.53.0',
  default_options: [ 'warning_level=1', 'buildtype=debugoptimized', 'c_std=gnu11' ],
)

prefix = get_option('prefix')
bindir = join_paths(prefix, get_option('bindir'))
datadir = join_paths(prefix, get_option('datadir'))
localedir = join_paths(prefix, get_option('localedir'))
libdir = join_paths(prefix, get_option('libdir'))
desktopdir = join_paths(datadir, 'applications')
pluginsdir = join_paths(libdir, 'krb5-auth-dialog/plugins')

app_id = 'org.gnome.KrbAuthDialog'

glib_ver = '2.66'
glib_ver_str = 'GLIB_VERSION_@0@'.format(glib_ver.replace('.','_'))
glib_ver_cmp = '>=@0@'.format(glib_ver)

add_project_arguments([
  '-DHAVE_CONFIG_H',
  '-DGLIB_VERSION_MIN_REQUIRED=@0@'.format(glib_ver_str),
  '-DGLIB_VERSION_MAX_REQUIRED=@0@'.format(glib_ver_str),
  '-DG_LOG_DOMAIN="KrbAuthDialog"',
  '-I' + meson.build_root(),
], language: 'c')

root_inc = include_directories('.')
src_inc = include_directories('src')

cc = meson.get_compiler('c')

global_c_args = []
test_c_args = [
  '-Wcast-align',
  '-Wdate-time',
  '-Wdeclaration-after-statement',
  ['-Werror=format-security', '-Werror=format=2'],
  '-Wendif-labels',
  '-Werror=incompatible-pointer-types',
  '-Werror=missing-declarations',
  '-Werror=overflow',
  '-Werror=return-type',
  '-Werror=shift-count-overflow',
  '-Werror=shift-overflow=2',
  '-Werror=implicit-fallthrough=3',
  '-Wfloat-equal',
  '-Wformat-nonliteral',
  '-Wformat-security',
  '-Winit-self',
  '-Wmaybe-uninitialized',
  '-Wmissing-field-initializers',
  '-Wmissing-include-dirs',
  '-Wmissing-noreturn',
  '-Wnested-externs',
  '-Wno-missing-field-initializers',
  '-Wno-sign-compare',
  '-Wno-strict-aliasing',
  '-Wno-unused-parameter',
  '-Wold-style-definition',
  '-Wpointer-arith',
  '-Wredundant-decls',
  '-Wshadow',
  '-Wstrict-prototypes',
  '-Wswitch-default',
  '-Wswitch-enum',
  '-Wtype-limits',
  '-Wundef',
  '-Wunused-function',
]
if get_option('buildtype') != 'plain'
  test_c_args += '-fstack-protector-strong'
endif

foreach arg: test_c_args
  if cc.has_multi_arguments(arg)
    global_c_args += arg
  endif
endforeach
add_project_arguments(
  global_c_args,
  language: 'c'
)

gnome = import('gnome')
i18n  = import('i18n')

adw_dep = dependency('libadwaita-1', version: '>=1.2')
glib_dep = dependency('glib-2.0', version: glib_ver_cmp)
gio_dep = dependency('gio-2.0', version: glib_ver_cmp)
gobject_dep = dependency('gobject-2.0', version: glib_ver_cmp)
gmodule_dep = dependency('gmodule-2.0', version: glib_ver_cmp)
gtk_dep = dependency('gtk4', version: '>=4.4')

meson.add_install_script(
  join_paths('build-aux', 'post_install.py'),
  datadir
)

# Both heimdal and mit ship a krb5.pc:
krb5_dep    = dependency('krb5')

minimum_lifetime = get_option('minimum-lifetime')
check_interval = get_option('check-interval')

conf_data = configuration_data()
conf_data.set_quoted('PACKAGE', meson.project_name())
conf_data.set_quoted('VERSION', meson.project_version())
conf_data.set_quoted('PACKAGE_VERSION', meson.project_version())
conf_data.set('CREDENTIAL_CHECK_INTERVAL', check_interval)
conf_data.set('MINUTES_BEFORE_PROMPTING', minimum_lifetime)
conf_data.set_quoted('SC_PKCS11', get_option('pkcs11'))
conf_data.set_quoted('GETTEXT_PACKAGE', meson.project_name())
conf_data.set_quoted('LOCALE_DIR', localedir)
conf_data.set_quoted('KA_PLUGINS_DIR', pluginsdir)
conf_data.set_quoted('DATA_DIR', datadir)
conf_data.set_quoted('KA_APP_ID', app_id)

# Hooray to different Kerberos implementations:
if cc.has_member('krb5_creds', 'ticket_flags',
		 prefix: '''#include <krb5.h>''',
		 dependencies: krb5_dep)
  # MIT
  conf_data.set('HAVE_KRB5_CREDS_TICKET_FLAGS', 1)
elif cc.has_member('krb5_creds', 'flags',
		   prefix: '''#include <krb5.h>''',
		   dependencies: krb5_dep)
  conf_data.set('HAVE_KRB5_CREDS_FLAGS', 1)

  if cc.has_member('krb5_creds', 'flags.b.forwardable',
		   prefix: '''#include <krb5.h>''',
		   dependencies: krb5_dep)
    conf_data.set('HAVE_KRB5_CREDS_FLAGS_B_FORWARDABLE', 1)
  endif

  if cc.has_member('krb5_creds', 'flags.b.renewable',
		   prefix: '''#include <krb5.h>''',
		   dependencies: krb5_dep)
    conf_data.set('HAVE_KRB5_CREDS_FLAGS_B_RENEWABLE', 1)
  endif

  if cc.has_member('krb5_creds', 'flags.b.proxiable',
		   prefix: '''#include <krb5.h>''',
		   dependencies: krb5_dep)
    conf_data.set('HAVE_KRB5_CREDS_FLAGS_B_PROXIABLE', 1)
  endif
endif

if cc.has_member('krb5_prompt', 'type',
                 prefix : '#include <krb5.h>',
		 dependencies: krb5_dep)
    conf_data.set('HAVE_KRB5_PROMPT_TYPE', 1)
endif

if cc.compiles('''
    #include <krb5.h>
    int main(int argc, char **argv)
    {
        static krb5_principal foo;
        static krb5_data bar;
        foo->realm = bar;
        return 0;
    }''',
	       name: 'Realm as data',
	       dependencies: krb5_dep)
  conf_data.set('HAVE_KRB5_PRINCIPAL_REALM_AS_DATA', 1)
elif cc.compiles('''
    #include <krb5.h>
    #include <string.h>
    int main(int argc, char **argv)
    {
        static krb5_principal foo;
        return strlen(foo->realm);
    }''',
		 name: 'Realm as string',
		 dependencies: krb5_dep)
  conf_data.set('HAVE_KRB5_PRINCIPAL_REALM_AS_STRING', 1)
endif

if cc.has_function('krb5_get_error_message',
                   prefix: '''#include <krb5.h>''',
                   dependencies: krb5_dep)
  conf_data.set('HAVE_KRB5_GET_ERROR_MESSAGE', 1)
endif

if cc.has_function('krb5_free_error_message',
                   prefix: '''#include <krb5.h>''',
                   dependencies: krb5_dep)
  conf_data.set('HAVE_KRB5_FREE_ERROR_MESSAGE', 1)
endif

if cc.has_function('krb5_free_error_string',
                   prefix: '''#include <krb5.h>''',
                   dependencies: krb5_dep)
  conf_data.set('HAVE_KRB5_FREE_ERROR_STRING', 1)
endif

if cc.has_function('krb5_get_renewed_creds',
                   prefix: '''#include <krb5.h>''',
                   dependencies: krb5_dep)
  conf_data.set('HAVE_KRB5_GET_RENEWED_CREDS', 1)
endif

if cc.has_function('krb5_get_init_creds_opt_set_default_flags',
                   prefix: '''#include <krb5.h>''',
                   dependencies: krb5_dep)
  conf_data.set('HAVE_KRB5_GET_INIT_CREDS_OPT_SET_DEFAULT_FLAGS', 1)
endif

if cc.has_function('krb5_cc_clear_mcred',
                   prefix: '''#include <krb5.h>''',
                   dependencies: krb5_dep)
  conf_data.set('HAVE_KRB5_CC_CLEAR_MCRED', 1)
endif

if cc.has_header('hx509_err.h',
                 prefix: '''#include <krb5.h>''',
                 dependencies: krb5_dep)
  conf_data.set10('HAVE_HX509_ERR_H', true)
endif

have_creds_opt_set_pkinit = false
if cc.has_function('krb5_get_init_creds_opt_set_pkinit',
                   prefix: '''#include <krb5.h>''',
                   dependencies: krb5_dep)
  have_creds_opt_set_pkinit = true
endif
conf_data.set10('HAVE_KRB5_GET_INIT_CREDS_OPT_SET_PKINIT', have_creds_opt_set_pkinit)

have_creds_opt_set_pa = false
if cc.has_function('krb5_get_init_creds_opt_set_pa',
                   prefix: '''#include <krb5.h>''',
                   dependencies: krb5_dep)
  have_creds_opt_set_pa = true
  have_pkinit = true
endif
conf_data.set10('HAVE_KRB5_GET_INIT_CREDS_OPT_SET_PA', have_creds_opt_set_pa)

have_pkinit = have_creds_opt_set_pkinit or have_creds_opt_set_pa
want_pkinit = get_option('pkinit')
if not want_pkinit.disabled()
  if have_pkinit == true
    conf_data.set('ENABLE_PKINIT', 1)
  elif want_pkinit.enabled()
    error('Neither Heimdal nor MIT pkinit available')
  endif
endif

want_pam_plugin = get_option('pam-plugin')
pam_dep = cc.find_library('pam', required: want_pam_plugin)
build_pam_plugin = pam_dep.found() and not want_pam_plugin.disabled()

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

want_etpo = get_option('etpo')
flex = find_program('flex', required: want_etpo)
bison = find_program('bison', required: want_etpo)
build_etpo = flex.found() and bison.found()

subdir('data')
subdir('po')
subdir('src')
subdir('plugins')
subdir('help')
subdir('etpo')

summary({
           'Minimum Lifetime': minimum_lifetime,
           'Check Interval': check_interval,
           'pkinit': conf_data.get('ENABLE_PKINIT', 0),
           'pkcs11': conf_data.get('SC_PKCS11'),
           'pam-plugin': build_pam_plugin,
           'etpo': build_etpo,
})