-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathmeson.build
148 lines (128 loc) · 4.34 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
project('gnome-keyring', 'c',
version: '48.alpha',
meson_version: '>= 0.62',
)
gnome = import('gnome')
i18n = import('i18n')
# Version
gkr_major_version = '3'
# Common variables
cc = meson.get_compiler('c')
gkr_prefix = get_option('prefix')
gkr_bindir = gkr_prefix / get_option('bindir')
gkr_pkglibdir = gkr_prefix / get_option('libdir') / 'gnome-keyring' / 'devel'
config_h_inc = include_directories('.')
po_dir = meson.current_source_dir() / 'po'
source_root = meson.current_source_dir()
build_root = meson.current_build_dir()
# Dependencies
glib_version = '2.44'
glib_version_macro = 'GLIB_VERSION_@0@'.format(glib_version.replace('.', '_'))
glib_dep = declare_dependency(
dependencies: dependency('glib-2.0', version: f'>= @glib_version@'),
compile_args: [
f'-DGLIB_VERSION_MIN_REQUIRED=@glib_version_macro@',
f'-DGLIB_VERSION_MAX_ALLOWED=@glib_version_macro@',
],
)
gio_dep = dependency('gio-2.0', version: f'>= @glib_version@')
gio_unix_dep = dependency('gio-unix-2.0', version: f'>= @glib_version@')
gmodule_dep = dependency('gmodule-no-export-2.0', version: f'>= @glib_version@')
gobject_dep = dependency('gobject-2.0', version: f'>= @glib_version@')
threads_dep = dependency('threads')
gck_dep = dependency('gck-1', version: '>= 3.3.4')
gcr_dep = dependency('gcr-3', version: '>= 3.27.90')
gcr_base_dep = dependency('gcr-base-3', version: '>= 3.27.90')
libgcrypt_dep = dependency('libgcrypt', version: '>= 1.2.2')
libcap_ng_dep = dependency('libcap-ng', required: false)
p11_kit_dep = dependency('p11-kit-1')
libselinux_dep = dependency('libselinux', required: get_option('selinux'))
libsystemd_dep = dependency('libsystemd', required: get_option('systemd'))
if libsystemd_dep.found()
systemd_user_unit_dir = dependency('systemd').get_variable('systemduserunitdir', pkgconfig_define: ['prefix', gkr_prefix])
endif
if get_option('ssh-agent')
ssh_agent_bin = find_program('ssh-agent')
ssh_add_bin = find_program('ssh-add')
endif
if get_option('pam')
libpam_dep = cc.find_library('pam')
endif
# Check for some types
have_socklen_t = cc.has_type('socklen_t',
prefix: '\n'.join([
'#include <sys/types.h>',
'#include <sys/socket.h>',
'#include <netdb.h>',
]),
)
have_struct_cmsgcred = cc.has_type('struct cmsgcred',
prefix: '\n'.join([
'#include <sys/types.h>',
'#include <sys/socket.h>',
]),
)
# Project-wide defines
add_project_arguments([
'-D_GNU_SOURCE',
'-DGCK_API_SUBJECT_TO_CHANGE',
'-DGCR_API_SUBJECT_TO_CHANGE',
], language: 'c')
if get_option('debug-mode')
add_project_arguments([
'-DWITH_DEBUG=1',
'-D_DEBUG=1',
], language: 'c')
endif
# Configuration
conf = configuration_data()
conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
conf.set_quoted('LOCALE_DIR', gkr_prefix / get_option('localedir'))
conf.set_quoted('VERSION', meson.project_version())
conf.set_quoted('LIBGCRYPT_VERSION', libgcrypt_dep.version())
conf.set('HAVE_LIBCAPNG', libcap_ng_dep.found())
conf.set('WITH_SELINUX', libselinux_dep.found())
conf.set('WITH_SYSTEMD', libsystemd_dep.found())
if get_option('ssh-agent')
conf.set('WITH_SSH', true)
conf.set_quoted('SSH_AGENT', ssh_agent_bin.full_path())
conf.set_quoted('SSH_ADD', ssh_add_bin.full_path())
endif
conf.set('DOTLOCK_USE_PTHREAD', true)
conf.set('DOTLOCK_GLIB_LOGGING', true)
conf.set('DOTLOCK_EXT_SYM_PREFIX', '_gkm_')
conf.set('HAVE_SOCKLEN_T', have_socklen_t)
conf.set('HAVE_GETPEERUCRED', cc.has_function('getpeerucred'))
conf.set('HAVE_GETPEEREID', cc.has_function('getpeereid'))
conf.set('HAVE_FLOCK', cc.has_function('flock'))
conf.set('HAVE_MLOCK', cc.has_function('mlock'))
conf.set('HAVE_TIMEGM', cc.has_function('timegm'))
conf.set('HAVE_FSYNC', cc.has_function('fsync'))
configure_file(output: 'config.h', configuration: conf)
config_h_dir = include_directories('.')
# Test variables
test_gkr_daemon_bin = meson.current_build_dir() / 'daemon' / 'gnome-keyring-daemon'
# Build libegg (helper module)
subdir('egg')
# Daemon launch lib (needed for tests)
libgkd_test = library('gkd-test',
files('daemon/gkd-test.c'),
dependencies: [glib_dep, libegg_dep ],
c_args: [ '-DBUILDDIR="@0@"'.format(build_root) ],
)
libgkd_test_dep = declare_dependency(
link_with: libgkd_test,
)
# Other subdirectories
subdir('po')
subdir('pkcs11')
subdir('daemon')
subdir('schema')
subdir('tool')
if get_option('pam')
subdir('pam')
endif
subdir('docs')
gnome.post_install(
glib_compile_schemas: true,
)