Find and use libexecinfo (for backtrace()).
[geeqie.git] / meson.build
1 # This file is a part of Geeqie project (https://www.geeqie.org/).
2 # Copyright (C) 2008 - 2022 The Geeqie Team
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13
14 # Meson default directories used in this project:
15 # prefix - /usr/local
16 # bindir - bin
17 # datadir - share
18
19 # Meson core options:
20 # buildtype
21 # debug
22
23 # Project expanded default directories:
24 # prefix        /usr/local/
25 # bindir        /usr/local/bin                          geeqie executable
26 # gq_bindir     /usr/local/lib/geeqie               *   plugins scripts
27 # datadir       /usr/local/share/
28 #               /usr/local/share/applications           geeqie.desktop
29 # [gq_]appdir   /usr/local/share/geeqie/            *   template.desktop
30 # desktopdir    /usr/local/share/geeqie/applications    plugin desktop files
31 # appdatadir    /usr/local/share/metainfo               org.geeqie.Geeqie.appdata.xml
32 # icondir       /usr/local/share/pixmaps                geeqie.png icon
33 # [gq_]helpdir  /usr/local/share/doc/geeqie         *   readme files etc.
34 # [gq_]htmldir  /usr/local/share/doc/geeqie/html    *   help files
35 # gq_localedir  /usr/locale/share/locale
36 # mandir1       /usr/local/share/man/man1               man page
37 # podir         project_root/po
38
39 # * See meson_options.txt file
40
41 project(
42     'geeqie',
43     'c',
44     'cpp',
45     version : run_command('./version.sh', check : true).stdout().strip(),
46     license : ['GPL-2.0-or-later'],
47     meson_version : '>=0.56.2',
48     default_options : ['cpp_std=c++14', 'warning_level=3', 'buildtype=debugoptimized', 'cpp_link_args=-rdynamic']
49 )
50
51 # To inhibit warnings from the generated files icons_inline.h and ui_icons.h
52 add_global_arguments('-Wno-overlength-strings', language : 'c')
53
54 # To compile originally-C files as C++
55 add_global_arguments('-Wno-error=deprecated-declarations', language : 'cpp')
56 add_global_arguments('-Wno-error=sign-compare', language : 'cpp')
57 add_global_arguments('-Wno-error=return-type', language : 'cpp')
58 add_global_arguments('-Wno-error=literal-suffix', language : 'cpp')
59 add_global_arguments('-Wno-error=write-strings', language : 'cpp')
60
61 # Project requirements
62 project_sources = []
63 gnome = import('gnome')
64 thread_dep = dependency('threads')
65 cc = meson.get_compiler('c')
66 i18n = import('i18n')
67 fs = import('fs')
68 configuration_inc = include_directories('.')
69
70 # Extended stack trace using backward-app
71 option = get_option('devel')
72 if option.enabled()
73     if cc.has_link_argument('-ldwarf')
74         add_project_link_arguments('-ldwarf', language: 'cpp')
75     endif
76 endif
77
78 # External programs
79 gdk_pixbuf_csource = find_program('gdk-pixbuf-csource', required : true)
80 glib_compile_resources = find_program('glib-compile-resources', required : true)
81 glib_genmarshal = find_program('glib-genmarshal', required : true)
82
83 option = get_option('git')
84 if not option.disabled()
85     running_from_git = find_program('git', required: false).found() and fs.is_dir('.git')
86 else
87     running_from_git = false
88     summary({'git' : ['disabled - ChangeLog, ChangeLog.html, lua-api help file created:', false]}, section : 'Documentation', bool_yn : true)
89 endif
90
91 debug = get_option('debug')
92
93 # Note that main.cc sets prefix to the directory above where the executable is run from.
94 # This is to allow AppImages to be used
95
96 # These gq_* variables are paths relative to /prefix/,
97 # and are also used in defines in the source as GQ_*
98 if get_option('gq_appdir') == ''
99     gq_appdir = join_paths(get_option('datadir'), 'geeqie')
100 else
101     gq_appdir = get_option('gq_appdir')
102 endif
103
104 # This is not the same as Meson bindir
105 if get_option('gq_bindir') == ''
106     gq_bindir = 'lib/geeqie'
107 else
108     gq_bindir = get_option('gq_bindir')
109 endif
110
111 if get_option('gq_helpdir') == ''
112     gq_helpdir = join_paths(get_option('datadir'), 'doc/geeqie')
113 else
114     gq_helpdir = get_option('gq_helpdir')
115 endif
116
117 if get_option('gq_htmldir') == ''
118     gq_htmldir = join_paths(get_option('datadir'), 'doc/geeqie/html')
119 else
120     gq_htmldir = get_option('gq_htmldir')
121 endif
122
123 if get_option('gq_localedir') == ''
124     gq_localedir = join_paths(get_option('datadir'), 'locale')
125 else
126     gq_localedir = get_option('gq_localedir')
127 endif
128
129
130 # Set up the absolute directory paths used
131 prefix = get_option('prefix')
132 datadir = join_paths(prefix, get_option('datadir'))
133
134 # Installation paths are absolute
135 appdir = join_paths(prefix, gq_appdir)
136 appdatadir = join_paths(datadir, 'metainfo')
137 desktopdir = join_paths(datadir, meson.project_name(), 'applications')
138 helpdir = join_paths(prefix, gq_helpdir)
139 htmldir = join_paths(prefix, gq_htmldir)
140 icondir = join_paths(datadir, 'pixmaps')
141 mandir1 = join_paths(datadir, 'man', 'man1')
142
143 podir = join_paths(meson.project_source_root(), 'po')
144 scriptsdir = join_paths(meson.project_source_root(), 'scripts')
145
146 summary({'gq_appdir': gq_appdir,
147         'gq_bindir': gq_helpdir,
148         'gq_helpdir': gq_helpdir,
149         'gq_htmldir': gq_htmldir,
150         'gq_localedir': gq_localedir,
151         }, section: 'Directories')
152
153 # Create the define constants used in the sources. Set via config.h.in
154 conf_data = configuration_data()
155 conf_data.set_quoted('VERSION', meson.project_version())
156 conf_data.set('DEBUG', debug)
157
158 option = get_option('gtk4')
159 if option.enabled()
160     gtk_dep = dependency('gtk4', required: true)
161     conf_data.set('HAVE_GTK4', 1)
162 else
163     gtk_dep = dependency('gtk+-3.0', version : '>=3.24', required: true)
164 endif
165 glib_dep = dependency('glib-2.0', version : '>=2.52', required: true)
166
167 # Required only when backward-cpp is used
168 libdw_dep = []
169 libunwind_dep = []
170 option = get_option('devel')
171 if option.enabled()
172     libdw_dep = dependency('libdw', required : true)
173     if libdw_dep.found()
174         libunwind_dep = dependency('libunwind', required : true)
175         if libunwind_dep.found()
176             conf_data.set('HAVE_DEVELOPER', 1)
177             summary({'developer mode' : ['extended stacktrace:', true]}, section : 'Debugging', bool_yn : true)
178         else
179             summary({'developer mode' : ['libunwind not found. extended stacktrace:', false]}, section : 'Debugging', bool_yn : true)
180         endif
181     else
182         summary({'developer mode' : ['libdw not found. extended stacktrace:', false]}, section : 'Debugging', bool_yn : true)
183     endif
184 else
185     summary({'developer mode' : ['extended stacktrace:', false]}, section : 'Debugging', bool_yn : true)
186 endif
187
188 # Required only for seg. fault stacktrace and backtrace debugging
189 option = get_option('execinfo')
190 if not option.disabled()
191     result = cc.check_header('execinfo.h')
192     if result
193         libexecinfo_dep = cc.find_library('execinfo', required : false)
194         conf_data.set('HAVE_EXECINFO_H', 1)
195         summary({'execinfo' : ['stacktrace supported:', true]}, section : 'Debugging', bool_yn : true)
196     else
197         summary({'execinfo' : ['stacktrace supported:', false]}, section : 'Debugging', bool_yn : true)
198     endif
199 else
200     summary({'execinfo' : ['stacktrace supported:', false]}, section : 'Debugging', bool_yn : true)
201 endif
202
203 libarchive_dep = []
204 req_version = '>=3.4.0'
205 option = get_option('archive')
206 if not option.disabled()
207     libarchive_dep = dependency('libarchive', version : req_version, required : get_option('archive'))
208     if libarchive_dep.found()
209         conf_data.set('HAVE_ARCHIVE', 1)
210         summary({'archive' : ['archive files e.g. .zip supported:', true]}, section : 'Configuration', bool_yn : true)
211     else
212         summary({'archive' : ['libarchive ' + req_version + ' not found - archive files e.g. .zip supported::', false]}, section : 'Configuration', bool_yn : true)
213     endif
214 else
215     summary({'archive' : ['disabled - archive files e.g. .zip supported:', false]}, section : 'Configuration', bool_yn : true)
216 endif
217
218 lcms_dep = []
219 req_version = '>=2.0'
220 option = get_option('cms')
221 if not option.disabled()
222     xxd = find_program('xxd', 'xxdi.pl', required : false)
223     if xxd.found()
224         lcms_dep = dependency('lcms2', version : req_version, required : get_option('cms'))
225         if lcms_dep.found()
226             conf_data.set('HAVE_LCMS', 1)
227             conf_data.set('HAVE_LCMS2', 1)
228             summary({'cms' : ['color management supported:', true]}, section : 'Configuration', bool_yn : true)
229         else
230             summary({'cms' : ['lcms2' + req_version + ' not found - color management supported:', false]}, section : 'Configuration', bool_yn : true)
231         endif
232     else
233         summary({'cms' : ['xxd or xxdi.pl not found - color management supported:', false]}, section : 'Configuration', bool_yn : true)
234     endif
235 else
236     summary({'cms' : ['disabled - color management supported:', false]}, section : 'Configuration', bool_yn : true)
237 endif
238
239 ddjvuapi_dep = []
240 req_version = '>=2.5.27'
241 option = get_option('djvu')
242 if not option.disabled()
243     ddjvuapi_dep = dependency('ddjvuapi', version : req_version, required : get_option('djvu'))
244     if ddjvuapi_dep.found()
245         conf_data.set('HAVE_DJVU', 1)
246         summary({'djvu' : ['djvu files supported:', true]}, section : 'Configuration', bool_yn : true)
247     else
248         summary({'djvu' : ['ddjvuapi ' + req_version + ' not found - djvu files supported:', false]}, section : 'Configuration', bool_yn : true)
249     endif
250 else
251     summary({'djvu' : ['disabled - djvu files supported:', false]}, section : 'Configuration', bool_yn : true)
252 endif
253
254 option = get_option('evince')
255 if not option.disabled()
256     evince = find_program('evince', required : false)
257     if evince.found()
258         summary({'print preview' : ['print preview supported:', true]}, section : 'Configuration', bool_yn : true)
259     else
260         summary({'print preview' : ['evince not found - print preview supported:', false]}, section : 'Configuration', bool_yn : true)
261     endif
262 else
263     summary({'print preview' : ['disabled - print preview supported:', false]}, section : 'Configuration', bool_yn : true)
264 endif
265
266 # Required only for seg. fault stacktrace and backtrace debugging
267 option = get_option('execinfo')
268 if not option.disabled()
269     result = cc.check_header('execinfo.h')
270     if result
271         conf_data.set('HAVE_EXECINFO_H', 1)
272         summary({'execinfo' : ['stacktrace supported:', true]}, section : 'Configuration', bool_yn : true)
273     else
274         summary({'execinfo' : ['stacktrace supported:', false]}, section : 'Configuration', bool_yn : true)
275     endif
276 else
277     summary({'execinfo' : ['stacktrace supported:', false]}, section : 'Configuration', bool_yn : true)
278 endif
279
280 exiv2_dep = []
281 # See https://github.com/BestImageViewer/geeqie/issues/1090
282 # for the reason for 0.28.0 exclusion
283 req_version = ['>=0.11', '!=0.28.0']
284
285 req_version_str = ''
286 foreach req_version_str_ : req_version
287     req_version_str += req_version_str_
288 endforeach
289
290 option = get_option('exiv2')
291 if not option.disabled()
292     exiv2_dep = dependency('exiv2', version : req_version, required : get_option('exiv2'))
293     if exiv2_dep.found()
294         conf_data.set('HAVE_EXIV2', 1)
295         summary({'exiv2' : ['image metadata processed by exiv2:', true]}, section : 'Configuration', bool_yn : true)
296     else
297         summary({'exiv2' : ['exiv2 ' + req_version_str + ' not found - image data not processed by exiv2:', false]}, section : 'Configuration', bool_yn : true)
298     endif
299 else
300     summary({'exiv2' : ['disabled - image data processed by exiv2:', false]}, section : 'Configuration', bool_yn : true)
301 endif
302
303 champlain_dep = []
304 champlain_gtk_dep = []
305 clutter_dep = []
306 clutter_gtk_dep = []
307 req_version_champlain = '>=0.12'
308 req_version_champlain_gtk = '>=0.12'
309 req_version_clutter = '>=1.0'
310 req_version_clutter_gtk = '>=1.0'
311 option = get_option('gps-map')
312 if not option.disabled()
313     champlain_dep = dependency('champlain-0.12', version : req_version_champlain, required : get_option('gps-map'))
314     champlain_gtk_dep = dependency('champlain-gtk-0.12', version : req_version_champlain_gtk, required : get_option('gps-map'))
315     if champlain_dep.found() and champlain_gtk_dep.found()
316         clutter_dep = dependency('clutter-1.0', version : req_version_clutter, required : get_option('gps-map'))
317         clutter_gtk_dep = dependency('clutter-gtk-1.0', version : req_version_clutter_gtk, required : get_option('gps-map'))
318         if clutter_dep.found() and clutter_gtk_dep.found()
319             conf_data.set('HAVE_CLUTTER', 1)
320             conf_data.set('HAVE_LIBCHAMPLAIN', 1)
321             conf_data.set('HAVE_LIBCHAMPLAIN_GTK', 1)
322             summary({'gps-map' : ['GPS map displayed', true]}, section : 'Configuration', bool_yn : true)
323         else
324             if not clutter_dep.found()
325                 summary({'gps-map-clutter' : ['clutter-1.0 ' + req_version_clutter + ' not found - GPS map displayed:', false]}, section : 'Configuration', bool_yn : true)
326             endif
327             if not clutter_gtk_dep.found()
328                 summary({'gps-map-clutter-gtk' : ['clutter-gtk-1.0 ' + req_version_clutter_gtk + ' not found - GPS map displayed:', false]}, section : 'Configuration', bool_yn : true)
329             endif
330         endif
331     else
332         if not champlain_dep.found()
333             summary({'gps-map-champlain' : ['champlain-0.12 ' + req_version_champlain + ' not found - GPS map displayed:', false]}, section : 'Configuration', bool_yn : true)
334         endif
335         if not champlain_gtk_dep.found()
336             summary({'gps-map-champlain-gtk' : ['champlain-gtk-0.12 ' + req_version_champlain_gtk + ' not found - GPS map displayed:', false]}, section : 'Configuration', bool_yn : true)
337         endif
338     endif
339 else
340     summary({'gps-map' : ['disabled - GPS map displayed:', false]}, section : 'Configuration', bool_yn : true)
341 endif
342
343 libheif_dep = []
344 req_version = '>=1.3.2'
345 option = get_option('heif')
346 if not option.disabled()
347     libheif_dep = dependency('libheif', version : req_version, required : get_option('heif'))
348     if libheif_dep.found()
349         conf_data.set('HAVE_HEIF', 1)
350         summary({'heif' : ['heif files supported:', true]}, section : 'Configuration', bool_yn : true)
351     else
352         summary({'heif' : ['libheif ' + req_version + ' not found - heif files supported:', false]}, section : 'Configuration', bool_yn : true)
353     endif
354 else
355     summary({'heif' : ['disabled - heif files supported:', false]}, section : 'Configuration', bool_yn : true)
356 endif
357
358 libopenjp2_dep = []
359 req_version = '>=2.3.0'
360 option = get_option('j2k')
361 if not option.disabled()
362     libopenjp2_dep = dependency('libopenjp2', version : req_version, required : get_option('j2k'))
363     if libopenjp2_dep.found()
364         conf_data.set('HAVE_J2K', 1)
365         summary({'j2k' : ['j2k files supported:', true]}, section : 'Configuration', bool_yn : true)
366     else
367         summary({'j2k' : ['libopenjp2 ' + req_version + ' not found - j2k files supported:', false]}, section : 'Configuration', bool_yn : true)
368     endif
369 else
370     summary({'j2k' : ['disabled - j2k files supported:', false]}, section : 'Configuration', bool_yn : true)
371 endif
372
373 libjpeg_dep = []
374 option = get_option('jpeg')
375 if not option.disabled()
376 libjpeg_dep = dependency('libjpeg', required : get_option('jpeg'))
377     if libjpeg_dep.found()
378         if cc.has_function('jpeg_destroy_decompress', dependencies : libjpeg_dep)
379             conf_data.set('HAVE_JPEG', 1)
380             summary({'jpeg' : ['jpeg files supported:', true]}, section : 'Configuration', bool_yn : true)
381         else
382             summary({'jpeg' : ['jpeg_destroy_decompress not found - jpeg files supported:', false]}, section : 'Configuration', bool_yn : true)
383         endif
384     else
385         summary({'jpeg' : ['libjpeg: not found', false]}, section : 'Configuration', bool_yn : true)
386     endif
387 else
388     summary({'jpeg' : ['disabled - jpeg files supported:', false]}, section : 'Configuration', bool_yn : true)
389 endif
390
391 libjxl_dep = []
392 req_version = '>=0.3.7'
393 option = get_option('jpegxl')
394 if not option.disabled()
395     libjxl_dep = dependency('libjxl', version : req_version, required : get_option('jpegxl'))
396     if libjxl_dep.found()
397         conf_data.set('HAVE_JPEGXL', 1)
398         summary({'jpegxl' : ['jpegxl files supported:', true]}, section : 'Configuration', bool_yn : true)
399     else
400         summary({'jpegxl' : ['libjxl ' + req_version + ' not found - jpegxl files supported:', false]}, section : 'Configuration', bool_yn : true)
401     endif
402 else
403     summary({'jpegxl' : ['disabled - jpegxl files supported:', false]}, section : 'Configuration', bool_yn : true)
404 endif
405
406 libraw_dep = []
407 req_version = '>=0.20'
408 option = get_option('libraw')
409 if not option.disabled()
410     libraw_dep = dependency('libraw', version : req_version, required : get_option('libraw'))
411     if libraw_dep.found()
412         conf_data.set('HAVE_RAW', 1)
413         summary({'libraw' : ['.cr3 files supported:', true]}, section : 'Configuration', bool_yn : true)
414     else
415         summary({'libraw' : ['libraw ' + req_version + ' not found - .cr3 files supported:', false]}, section : 'Configuration', bool_yn : true)
416     endif
417 else
418     summary({'libraw' : ['disabled - .cr3 files supported:', false]}, section : 'Configuration', bool_yn : true)
419 endif
420
421 lua_dep = []
422 req_version = '>=5.3'
423 option = get_option('lua')
424 if not option.disabled()
425     foreach name : ['lua', 'lua5.3', 'lua-5.3', 'lua53']
426         lua_dep = dependency(name, version: req_version, required: get_option('lua'))
427         if lua_dep.found()
428             break
429         endif
430     endforeach
431     if lua_dep.found()
432         conf_data.set('HAVE_LUA', 1)
433         summary({'lua' : ['lua supported:', true]}, section : 'Configuration', bool_yn : true)
434     else
435         summary({'lua' : ['lua ' + req_version + ' not found - lua supported:', false]}, section : 'Configuration', bool_yn : true)
436     endif
437 else
438     summary({'lua' : ['disabled - lua supported:', false]}, section : 'Configuration', bool_yn : true)
439 endif
440
441 option = get_option('pandoc')
442 if not option.disabled()
443     pandoc = find_program('pandoc', required : false)
444     if pandoc.found()
445         readme_html = custom_target(
446             'README.html',
447             input: 'README.md',
448             output: 'README.html',
449             command: [pandoc, '@INPUT@', '-o', '@OUTPUT@'],
450             install: true,
451             install_dir: helpdir)
452
453         summary({'README' : ['README.html created:', true]}, section : 'Documentation', bool_yn : true)
454     else
455         summary({'README' : ['pandoc not found - README.html created:', false]}, section : 'Documentation', bool_yn : true)
456     endif
457     install_data('README.md', 'COPYING', 'TODO', install_dir : helpdir)
458 else
459     summary({'pandoc' : ['disabled - README.html created:', false]}, section : 'Documentation', bool_yn : true)
460 endif
461
462 poppler_glib_dep = []
463 req_version = '>=0.62'
464 option = get_option('pdf')
465 if not option.disabled()
466     poppler_glib_dep = dependency('poppler-glib', version : req_version, required : get_option('pdf'))
467     if poppler_glib_dep.found()
468         conf_data.set('HAVE_PDF', 1)
469         summary({'pdf'  : ['pdf files supported:', true]}, section : 'Configuration', bool_yn : true)
470     else
471         summary({'pdf' : ['poppler-glib ' + req_version + ' not found - pdf files supported:', false]}, section : 'Configuration', bool_yn : true)
472     endif
473 else
474     summary({'pdf' : ['disabled - pdf files supported:', false]}, section : 'Configuration', bool_yn : true)
475 endif
476
477 gspell_dep = []
478 req_version = '>=1.6'
479 option = get_option('spell')
480 if not option.disabled()
481     gspell_dep = dependency('gspell-1', version : req_version, required: get_option('spell'))
482     if gspell_dep.found()
483         conf_data.set('HAVE_SPELL', 1)
484         summary({'spell' : ['spelling checks enabled', true]}, section : 'Configuration', bool_yn : true)
485     else
486         summary({'spell' : ['gspell-1 ' + req_version + ' not found - spelling checks enabled', false]}, section : 'Configuration', bool_yn : true)
487     endif
488 else
489     summary({'spell' : ['disabled - spelling checks enabled', false]}, section : 'Configuration', bool_yn : true)
490 endif
491
492 tiff_dep = []
493 option = get_option('tiff')
494 if not option.disabled()
495     tiff_dep = dependency('libtiff-4', required: get_option('tiff'))
496     if tiff_dep.found()
497         if cc.has_function('TIFFClientOpen', dependencies : tiff_dep)
498             conf_data.set('HAVE_TIFF', 1)
499             summary({'tiff' : ['tiff files supported:', true]}, section : 'Configuration', bool_yn : true)
500         else
501             summary({'tiff' : ['TIFFClientOpen not found - tiff files supported:', false]}, section : 'Configuration', bool_yn : true)
502         endif
503     else
504         summary({'tiff' : ['libtiff not found - tiff files supported:', false]}, section : 'Configuration', bool_yn : true)
505     endif
506 else
507     summary({'tiff' : ['disabled - tiff files supported:', false]}, section : 'Configuration', bool_yn : true)
508 endif
509
510 libffmpegthumbnailer_dep = []
511 req_version = '>=2.1.0'
512 option = get_option('videothumbnailer')
513 if not option.disabled()
514     libffmpegthumbnailer_dep = dependency('libffmpegthumbnailer',
515         version : req_version,
516         required : get_option('videothumbnailer'))
517
518     if libffmpegthumbnailer_dep.found()
519         conf_data.set('HAVE_FFMPEGTHUMBNAILER', 1)
520         summary({'videothumbnailer' : ['thumbnails of video files supported:', true]}, section : 'Configuration', bool_yn : true)
521
522         result = cc.has_member('struct video_thumbnailer_struct', 'prefer_embedded_metadata', prefix : '#include <libffmpegthumbnailer/videothumbnailerc.h>')
523         if result
524             conf_data.set('HAVE_FFMPEGTHUMBNAILER_METADATA', 1)
525         endif
526         summary({'fmpegthumbnailer_metadata' : ['fmpegthumbnailer_metadata found:', result]}, section : 'Thumbnailer', bool_yn : true)
527
528         result = cc.has_member('struct image_data_struct', 'image_data_width', prefix : '#include <libffmpegthumbnailer/videothumbnailerc.h>' )
529         if result
530             conf_data.set('HAVE_FFMPEGTHUMBNAILER_RGB', 1)
531         endif
532         summary({'fmpegthumbnailer_rgb' : ['fmpegthumbnailer_rgb found:', result]}, section : 'Thumbnailer', bool_yn : true)
533
534         result = cc.has_function('video_thumbnailer_set_size', dependencies : libffmpegthumbnailer_dep)
535         if result
536             conf_data.set('HAVE_FFMPEGTHUMBNAILER_WH', 1)
537         endif
538         summary({'fmpegthumbnailer_set_size' : ['fmpegthumbnailer_set_size found:', result]}, section : 'Thumbnailer', bool_yn : true)
539     else
540         summary({'videothumbnailer' : ['libvideothumbnailer ' + req_version + ' not found - thumbnails of video files supported', false]}, section : 'Configuration', bool_yn : true)
541     endif
542 else
543     summary({'videothumbnailer' : ['disabled -thumbnails of video files supported', false]}, section : 'Configuration', bool_yn : true)
544 endif
545
546 # libpixbufloader-webp is not loaded as part of libgdk-pixbuf. Just issue
547 # a warning if not installed
548 libwebp_dir = dependency('gdk-pixbuf-2.0', method: 'pkg-config').get_variable(pkgconfig: 'gdk_pixbuf_moduledir', internal: 'gdk_pixbuf_moduledir')
549
550 if libwebp_dir.contains('loaders')
551     libwebp_dep = cc.find_library('pixbufloader-webp', dirs : libwebp_dir, required : false)
552     if libwebp_dep.found()
553         summary({'webp' : ['webp files supported:', true]}, section : 'Configuration', bool_yn : true)
554     else
555         summary({'webp' : ['webp-pixbuf-loader not installed - webp files supported:', false]}, section : 'Configuration', bool_yn : true)
556     endif
557 else
558     summary({'webp' : ['webp-pixbuf-loader not installed - webp files supported:', false]}, section : 'Configuration', bool_yn : true)
559 endif
560
561 # Check for nl_langinfo and _NL_TIME_FIRST_WEEKDAY
562 code = '''#include <langinfo.h>
563 #include<stdio.h>
564 int main (int argc, char ** argv) {
565     char *c;
566     c =  nl_langinfo(_NL_TIME_FIRST_WEEKDAY);
567     return 0;
568 }'''
569 if cc.links(code, name : 'nl_langinfo and _NL_TIME_FIRST_WEEKDAY')
570     conf_data.set('HAVE__NL_TIME_FIRST_WEEKDAY', 1)
571     summary({'nl_langinfo' : ['first weekday depends on locale:', true]}, section : 'Documentation', bool_yn : true)
572 else
573     summary({'nl_langinfo' : ['nl_langinfo not found - first weekday depends on locale:', false, 'first weekday defaults to Monday']}, section : 'Documentation', bool_yn : true)
574 endif
575
576 conf_data.set_quoted('GETTEXT_PACKAGE', meson.project_name())
577 conf_data.set_quoted('GQ_APPDIR', gq_appdir)
578 conf_data.set_quoted('GQ_BINDIR', gq_bindir)
579 conf_data.set_quoted('GQ_HELPDIR', gq_helpdir)
580 conf_data.set_quoted('GQ_HTMLDIR', gq_htmldir)
581 conf_data.set_quoted('GQ_LOCALEDIR', gq_localedir)
582
583 conf_data.set_quoted('PACKAGE', meson.project_name())
584 conf_data.set_quoted('PACKAGE_NAME', meson.project_name())
585 conf_data.set_quoted('PACKAGE_STRING', meson.project_version())
586 conf_data.set_quoted('PACKAGE_TARNAME', meson.project_name())
587 conf_data.set_quoted('PACKAGE_VERSION', meson.project_version())
588 conf_data.set_quoted('VERSION', meson.project_version())
589
590 configure_file(input : 'config.h.in',
591                output : 'config.h',
592                encoding : 'UTF-8',
593                configuration : conf_data)
594
595 # For shellcheck on scripts
596 script_sources = []
597 subdir('scripts')
598
599 # Process subdirs before the sources
600 subdir('po')
601 subdir('plugins')
602
603 # Generate the executable
604 subdir('src')
605
606 # Generate the help files
607 subdir('doc')
608
609 # Install other project files
610 if running_from_git
611     cmd = [find_program('gen_changelog.sh'), meson.current_source_dir(), meson.current_build_dir()]
612     custom_target(
613         'ChangeLog',
614         input: 'ChangeLog.gqview',
615         output: ['ChangeLog', 'ChangeLog.html'],
616         command: cmd,
617         install: true,
618         install_dir: helpdir)
619     meson.add_dist_script(cmd)
620     summary({'ChangeLog' : ['ChangeLog, ChangeLog.html created:', true]}, section : 'Documentation', bool_yn : true)
621 elif fs.exists('ChangeLog.html')
622     install_data('ChangeLog', 'ChangeLog.html', install_dir: helpdir)
623     summary({'ChangeLog' : ['ChangeLog, ChangeLog.html installed from dist:', true]}, section : 'Documentation', bool_yn : true)
624 endif
625
626 install_data('geeqie.png', install_dir : icondir)
627 install_data('geeqie.1', install_dir : mandir1)
628
629 i18n.merge_file(
630     input : 'geeqie.desktop.in',
631     output : 'geeqie.desktop',
632     type : 'desktop',
633     po_dir : podir,
634     install : true,
635     install_dir : join_paths(datadir, 'applications'))
636
637 i18n.merge_file(
638     input : 'org.geeqie.Geeqie.appdata.xml.in',
639     output : 'org.geeqie.Geeqie.appdata.xml',
640     type : 'xml',
641     po_dir : podir,
642     install : true,
643     install_dir : appdatadir)
644
645 configure_file(input: 'geeqie.spec.in', output: 'geeqie.spec', configuration: conf_data)
646
647 # Basic test of the executable
648 xvfb = find_program('xvfb-run', required : false)
649 if xvfb.found()
650     test('Basic test', xvfb, args: ['--auto-servernum', geeqie_exe, '--version'], timeout: 100)
651     summary({'xvfb' : ['Test runs:', true]}, section : 'Testing', bool_yn : true)
652 else
653     summary({'xvfb' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
654 endif
655
656 # Shellcheck
657 shellcheck_exe = find_program('shellcheck', required : false)
658 script_sources += files('gen_changelog.sh',
659 'geeqie-install-debian.sh',
660 'version.sh')
661
662 if shellcheck_exe.found()
663     foreach script : script_sources
664         test('Shellcheck', shellcheck_exe, args: ['--norc', '--shell=sh', '--enable=add-default-case,avoid-nullary-conditions,check-unassigned-uppercase,deprecate-which,quote-safe-variables', script], timeout: 100)
665     endforeach
666     summary({'shellcheck' : ['Test runs:', true]}, section : 'Testing', bool_yn : true)
667 else
668     summary({'shellcheck' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
669 endif