forked from linuxmint/xreader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
275 lines (240 loc) · 8.38 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
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
project('xreader', 'c', 'cpp', version : '3.0.2')
gnome = import('gnome')
i18n = import('i18n')
pkgconfig = import('pkgconfig')
cc = meson.get_compiler('c')
version = meson.project_version()
version_list = version.split('.')
major_version = version_list[0]
minor_version = version_list[1]
micro_version = version_list[2]
api_version = '1.5'
binary_version = '3.0.0'
binary_major_version = binary_version.split('.')[0]
xreader_conf = configuration_data()
xreader_conf.set_quoted('VERSION', version)
xreader_conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
if get_option('enable_dbus')
xreader_conf.set('ENABLE_DBUS', '')
endif
# directories
prefix = get_option('prefix')
bindir = get_option('bindir')
datadir = get_option('datadir')
libdir = get_option('libdir')
includedir = get_option('includedir')
libexecdir = get_option('libexecdir')
desktopdir = join_paths(datadir, 'applications')
schema_dir = join_paths(datadir, 'glib-2.0', 'schemas')
header_dir = join_paths(meson.project_name(), api_version)
po_dir = join_paths(meson.source_root(), 'po')
# dependencies
cairo = dependency('cairo', version: '>= 1.14.0')
gail = dependency('gail-3.0')
gio = dependency('gio-2.0', version: '>= 2.36.0')
glib_version = '2.36.0'
glib = dependency('glib-2.0', version: '>= ' + glib_version)
gmodule = dependency('gmodule-2.0')
gtk_version = '3.14.0'
gtk_api_version = '3.0'
gtk = dependency('gtk+-' + gtk_api_version, version: '>= ' + gtk_version)
ice = dependency('ice')
sm = dependency('sm')
X11 = dependency('x11')
xapp = dependency('xapp', version: '>= 1.9.0')
xml = dependency('libxml-2.0', version: '>= 2.5.0')
zlib = dependency('zlib')
libsecret = dependency('libsecret-1', version: '>= 0.5', required: get_option('keyring'))
gtk_unix_print = dependency('gtk+-unix-print-3.0', version: '>= ' + gtk_version, required: get_option('gtk_unix_print'))
enabled_backend_names = []
backend_subdirs = []
xreader_mime_types = ''
if get_option('pdf')
poppler = dependency('poppler-glib')
backend_subdirs += 'pdf'
xreader_mime_types += 'application/pdf;application/x-bzpdf;application/x-gzpdf;application/x-xzpdf;'
endif
if get_option('ps')
spectre = dependency('libspectre', version: '>= 0.2.0')
backend_subdirs += 'ps'
xreader_mime_types += 'application/postscript;application/x-bzpostscript;application/x-gzpostscript;image/x-eps;image/x-bzeps;image/x-gzeps;'
endif
if get_option('dvi')
kpathsea = dependency('kpathsea')
spectre = dependency('libspectre', version: '>= 0.2.0')
if get_option('t1lib')
t1lib = cc.find_library('t1', required: false)
t1_enabled = t1lib.found()
else
t1_enabled = false
endif
backend_subdirs += 'dvi'
xreader_mime_types += 'application/x-dvi;application/x-bzdvi;application/x-gzdvi;'
endif
if get_option('djvu')
djvu = dependency('ddjvuapi', version: '>= 3.5.17')
backend_subdirs += 'djvu'
xreader_mime_types += 'image/vnd.djvu;image/vnd.djvu+multipage;'
endif
if get_option('tiff')
tiff = dependency('libtiff-4')
backend_subdirs += 'tiff'
xreader_mime_types += 'image/tiff;'
endif
if get_option('pixbuf')
backend_subdirs += 'pixbuf'
xreader_mime_types += 'image/*;'
xreader_conf.set10('ENABLE_PIXBUF', true)
endif
if get_option('comics')
backend_subdirs += 'comics'
xreader_mime_types += 'application/x-cbr;application/x-cbz;application/x-cb7;application/x-cbt;application/vnd.comicbook+zip;application/vnd.comicbook-rar;'
endif
if get_option('xps')
xps = dependency('libgxps', version: '>= 0.2.1')
backend_subdirs += 'xps'
xreader_mime_types += 'application/oxps;application/vnd.ms-xpsdocument;'
endif
if get_option('epub')
webkit = dependency('webkit2gtk-4.0', version: '>= 2.4.3')
backend_subdirs += 'epub'
xreader_mime_types += 'application/epub+zip;'
endif
xreader_conf.set_quoted('SUPPORTED_MIMETYPES', xreader_mime_types) # This is generated by backends/meson.build
# on some systems we need to find the math lib to make sure it builds
math = cc.find_library('m', required: false)
intltool_merge = find_program('intltool-merge')
mathjax_directory = get_option('mathjax-directory')
if mathjax_directory == ''
foreach dir: [
# Arch Linux
'/usr/share/mathjax',
# Debian
'/usr/share/javascript/mathjax'
]
if run_command('test', ['-f', join_paths(dir, 'MathJax.js')]).returncode() == 0
mathjax_directory = dir
# break would require meson_version >= 0.49.0 so just let the last one win
endif
endforeach
endif
if mathjax_directory != ''
xreader_conf.set_quoted('MATHJAX_DIRECTORY', mathjax_directory)
elif get_option('epub')
error('"mathjax-directory" is undefined and could not be autodetected')
endif
# generate config.h
config_h_file = configure_file(
output : 'config.h',
configuration : xreader_conf
)
config_h = declare_dependency(
sources: config_h_file
)
include_dirs = include_directories('.', 'libdocument', 'libview', 'libmisc')
include_root = include_directories('.')
xreader_document_header = [
'xreader-document.h'
]
xreader_view_header = [
'xreader-view.h'
]
# compiler flags
c_args = [
'-DDATADIR="@0@"'.format(join_paths(prefix, datadir)),
'-DLIBDIR="@0@"'.format(join_paths(prefix, libdir)),
'-DBINDIR="@0@"'.format(join_paths(prefix, bindir)),
'-DEV_BACKENDSDIR="@0@"'.format(join_paths(prefix, libdir, meson.project_name(), binary_major_version, 'backends')),
'-DXREADERDATADIR="@0@"'.format(join_paths(prefix, datadir, meson.project_name())),
'-Werror=implicit-function-declaration'
]
cpp_args = [
'-DXREADER_LOCALE_DIR="@0@"'.format(join_paths(prefix, datadir, 'locale')),
'-DXREADER_COMPILATION',
'-DHAVE_CONFIG_H',
]
if get_option('enable_debug')
c_args += '-DEV_ENABLE_DEBUG'
endif
if get_option('epub')
c_args += '-DENABLE_EPUB'
endif
if not get_option('deprecated_warnings')
c_args += [
'-Wno-deprecated-declarations',
'-Wno-deprecated',
'-Wno-declaration-after-statement',
]
endif
add_global_arguments(c_args, language: 'c')
add_global_arguments(cpp_args, language: ['c', 'cpp'])
subdir('cut-n-paste')
subdir('libdocument')
subdir('libview')
subdir('libmisc')
# 'backend' needs to be run before 'data' because the mimetypes defined in 'backend'
# are used to generate the .desktop file
subdir('backend')
subdir('data')
if get_option('thumbnailer')
subdir('thumbnailer')
endif
if get_option('previewer')
subdir('previewer')
endif
subdir('shell')
subdir('po')
subdir('help')
subdir('install-scripts')
# The tests use an option that doesn't exist in meson before 0.46.
# Since they aren't strictly necessary, we'll just skip them for earlier versions
# rather than making 0.46 a hard requirement. This condition can be removed once we
# no longer need to worry about building on 0.45 or earlier
if meson.version().version_compare('>=0.46')
subdir('test')
endif
xreader_headers = [
'xreader-document.h',
'xreader-view.h',
]
install_headers(
xreader_headers,
subdir: header_dir
)
pc_conf = configuration_data()
pc_conf.set('prefix', prefix)
pc_conf.set('exec_prefix', '${prefix}')
pc_conf.set('libdir', join_paths('${prefix}', libdir))
pc_conf.set('includedir', join_paths('${prefix}', includedir))
pc_conf.set('EV_API_VERSION', api_version)
pc_conf.set('EV_BINARY_VERSION', binary_major_version)
pc_conf.set('VERSION', version)
pc_conf.set('GLIB_REQUIRED', glib_version)
pc_conf.set('GTK_API_VERSION', gtk_api_version)
pc_conf.set('GTK_REQUIRED', gtk_version)
configure_file(
input: 'xreader-document.pc.in',
output: 'xreader-document-@[email protected]'.format(api_version),
configuration: pc_conf,
install_dir: join_paths(libdir, 'pkgconfig')
)
configure_file(
input: 'xreader-view.pc.in',
output: 'xreader-view-@[email protected]'.format(api_version),
configuration: pc_conf,
install_dir: join_paths(libdir, 'pkgconfig')
)
message('prefix = @0@'.format(prefix))
message('bindir = @0@'.format(bindir))
message('datadir = @0@'.format(datadir))
message('libdir = @0@'.format(libdir))
message('includedir = @0@'.format(includedir))
message('libexecdir = @0@'.format(libexecdir))
message('desktopdir = @0@'.format(desktopdir))
message('schema_dir = @0@'.format(schema_dir))
message('ENABLE_DBUS = @0@'.format(get_option('enable_dbus')))
message('MathJax directory = @0@'.format(mathjax_directory))
message('Backends enabled:')
foreach backend_name : backend_subdirs
message(' @0@'.format(backend_name))
endforeach