-
Notifications
You must be signed in to change notification settings - Fork 17
/
meson.build
182 lines (161 loc) · 5.88 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
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
project('seahorse', ['vala', 'c'],
version: '47.0.1',
meson_version: '>= 0.59',
license: 'GPL-2.0-or-later',
)
gnome = import('gnome')
i18n = import('i18n')
# Some variables
cc = meson.get_compiler('c')
valac = meson.get_compiler('vala')
buildtype = get_option('buildtype')
seahorse_prefix = get_option('prefix')
po_dir = meson.current_source_dir() / 'po'
libexecbindir = seahorse_prefix / get_option('libexecdir') / meson.project_name()
# Application ID
if get_option('profile') == 'default'
application_id = 'org.gnome.seahorse.Application'
else
application_id = 'org.gnome.seahorse.ApplicationDevel'
endif
# Dependencies
min_glib_version = '2.66'
min_gcr_version = '3.38'
accepted_gpg_versions = [ '2.2.0', '2.3.0', '2.4.0', '2.5.0' ]
gpg_check_version = find_program('build-aux' / 'gpg_check_version.py')
glib_deps = [
dependency('glib-2.0', version: '>=' + min_glib_version),
dependency('gobject-2.0', version: '>=' + min_glib_version),
dependency('gio-2.0', version: '>=' + min_glib_version),
dependency('gio-unix-2.0',version: '>=' + min_glib_version),
dependency('gmodule-2.0', version: '>=' + min_glib_version),
]
gtk = dependency('gtk+-3.0', version: '>= 3.24.0')
libhandy_dep = dependency('libhandy-1', version: '>= 1.6.0')
gcr = dependency('gcr-3', version: '>=' + min_gcr_version)
gcr_ui = dependency('gcr-ui-3', version: '>=' + min_gcr_version)
libsecret = dependency('libsecret-1', version: '>= 0.16')
libpwquality = dependency('pwquality')
posix = valac.find_library('posix')
ssh_bin = find_program('ssh')
ssh_keygen = find_program('ssh-keygen')
gpg_bin = find_program('gpg2', 'gpg', required: get_option('pgp-support'))
gpgme_dep = dependency('gpgme', version: '>= 1.14.0', required: get_option('pgp-support'))
if get_option('pgp-support')
gpg_version_check = run_command(
[gpg_check_version, gpg_bin.full_path(), accepted_gpg_versions ],
check: true,
)
# GnuPG now outputs e.g. 2.3.4-unknown so we need to drop this extra cruft
gpg_version_raw = gpg_version_check.stdout()
gpg_version_raw_split = gpg_version_raw.split('-')
gpg_version = gpg_version_raw_split[0]
message('GnuPG Version: @0@'.format(gpg_version))
if get_option('check-compatible-gpg') and gpg_version_check.returncode() != 0
error('Incompatible version of GnuPG. Accepted versions are: @0@'.format(accepted_gpg_versions))
endif
endif
pkcs11_dep = valac.find_library('pkcs11', required: get_option('pkcs11-support'))
if get_option('pkcs11-support') and not pkcs11_dep.found()
error('Required library "pkcs11" not found (needed for PKCS#11 support)')
endif
if get_option('ldap-support')
libldap = cc.find_library('ldap')
liblber = cc.find_library('lber')
add_project_arguments('-D', 'WITH_LDAP', language: 'vala')
endif
if get_option('hkp-support')
add_project_arguments('-D', 'WITH_HKP', language: 'vala')
endif
libsoup = dependency('libsoup-3.0', required: get_option('hkp-support'))
avahi_client = dependency('avahi-client', required: get_option('key-sharing'))
avahi_glib = dependency('avahi-glib', version: '>= 0.6', required: get_option('key-sharing'))
if get_option('key-sharing')
message('NOTE: key-sharing over DNS-SD will possibly be removed in the future')
endif
# Project-wide flags
add_project_arguments([
'--target-glib=@0@'.format(min_glib_version),
],
language: 'vala',
)
add_project_arguments([
'-DGCR_API_SUBJECT_TO_CHANGE',
'-DGCK_API_SUBJECT_TO_CHANGE',
'-DSECRET_WITH_UNSTABLE',
'-include', 'config.h',
# Don't care about unused parameters (which can happen a lot with callbacks)
'-Wno-unused-parameter',
'-Wno-missing-field-initializers',
],
language: 'c',
)
# configuration
conf = configuration_data()
conf.set_quoted('VERSION', '@VCS_TAG@')
conf.set_quoted('PACKAGE', meson.project_name())
conf.set_quoted('PACKAGE_NAME', meson.project_name())
conf.set_quoted('PACKAGE_VERSION', '@VCS_TAG@')
conf.set_quoted('PACKAGE_STRING', '@0@ @1@'.format(meson.project_name(), meson.project_version()))
conf.set_quoted('PKGDATADIR', get_option('datadir') / meson.project_name())
conf.set_quoted('EXECDIR', libexecbindir)
conf.set_quoted('LOCALEDIR', seahorse_prefix / get_option('localedir'))
conf.set_quoted('APPLICATION_ID', application_id)
conf.set_quoted('PROFILE', get_option('profile'))
conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
conf.set_quoted('G_LOG_DOMAIN', meson.project_name())
conf.set('WITH_DEBUG', buildtype.contains('debug'))
conf.set10('_DEBUG', buildtype.contains('debug'))
conf.set('HAVE_STRSEP', cc.has_function('strsep'))
conf.set('WITH_PGP', get_option('pgp-support'))
conf.set('WITH_PKCS11', get_option('pkcs11-support'))
conf.set('WITH_LDAP', get_option('ldap-support'))
conf.set('WITH_HKP', get_option('hkp-support'))
conf.set('WITH_KEYSERVER', get_option('keyservers-support'))
conf.set('WITH_SHARING', get_option('key-sharing'))
conf.set_quoted('SSH_KEYGEN_PATH', ssh_keygen.full_path())
conf.set_quoted('SSH_PATH', ssh_bin.full_path())
if get_option('pgp-support')
conf.set_quoted('GNUPG', gpg_bin.full_path())
gpg_version_split = gpg_version.split('.')
conf.set('GPG_MAJOR', gpg_version_split[0])
conf.set('GPG_MINOR', gpg_version_split[1])
conf.set('GPG_MICRO', gpg_version_split[2])
endif
config_file = vcs_tag(
input: configure_file(
output: 'config.h.in',
configuration: conf
),
output: 'config.h'
)
config = declare_dependency(
sources: config_file,
dependencies: [
valac.find_library('config', dirs: meson.current_source_dir() / 'common'),
],
include_directories: include_directories('.'),
)
# Post-install scripts
gnome.post_install(
gtk_update_icon_cache: true,
glib_compile_schemas: true,
update_desktop_database: true,
)
# subdirs
subdir('po')
subdir('data')
if get_option('help')
subdir('help')
endif
subdir('common')
subdir('libseahorse')
subdir('gkr')
subdir('ssh')
if get_option('pgp-support')
subdir('pgp')
endif
if get_option('pkcs11-support')
subdir('pkcs11')
endif
subdir('src')