Include image tests in GitHub workflow
[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 libexecinfo_dep = []
191 if not option.disabled()
192     result = cc.check_header('execinfo.h')
193     if result
194         # Include unconditionally dependency for NetBSD.
195         libexecinfo_dep = cc.find_library('execinfo', required : false)
196         conf_data.set('HAVE_EXECINFO_H', 1)
197         summary({'execinfo' : ['stacktrace supported:', true]}, section : 'Debugging', bool_yn : true)
198     else
199         summary({'execinfo' : ['stacktrace supported:', false]}, section : 'Debugging', bool_yn : true)
200     endif
201 else
202     summary({'execinfo' : ['stacktrace supported:', false]}, section : 'Debugging', bool_yn : true)
203 endif
204
205 libarchive_dep = []
206 req_version = '>=3.4.0'
207 option = get_option('archive')
208 if not option.disabled()
209     libarchive_dep = dependency('libarchive', version : req_version, required : get_option('archive'))
210     if libarchive_dep.found()
211         conf_data.set('HAVE_ARCHIVE', 1)
212         summary({'archive' : ['archive files e.g. .zip supported:', true]}, section : 'Configuration', bool_yn : true)
213     else
214         summary({'archive' : ['libarchive ' + req_version + ' not found - archive files e.g. .zip supported::', false]}, section : 'Configuration', bool_yn : true)
215     endif
216 else
217     summary({'archive' : ['disabled - archive files e.g. .zip supported:', false]}, section : 'Configuration', bool_yn : true)
218 endif
219
220 lcms_dep = []
221 req_version = '>=2.0'
222 option = get_option('cms')
223 if not option.disabled()
224     xxd = find_program('xxd', 'xxdi.pl', required : false)
225     if xxd.found()
226         lcms_dep = dependency('lcms2', version : req_version, required : get_option('cms'))
227         if lcms_dep.found()
228             conf_data.set('HAVE_LCMS', 1)
229             conf_data.set('HAVE_LCMS2', 1)
230             summary({'cms' : ['color management supported:', true]}, section : 'Configuration', bool_yn : true)
231         else
232             summary({'cms' : ['lcms2' + req_version + ' not found - color management supported:', false]}, section : 'Configuration', bool_yn : true)
233         endif
234     else
235         summary({'cms' : ['xxd or xxdi.pl not found - color management supported:', false]}, section : 'Configuration', bool_yn : true)
236     endif
237 else
238     summary({'cms' : ['disabled - color management supported:', false]}, section : 'Configuration', bool_yn : true)
239 endif
240
241 ddjvuapi_dep = []
242 req_version = '>=2.5.27'
243 option = get_option('djvu')
244 if not option.disabled()
245     ddjvuapi_dep = dependency('ddjvuapi', version : req_version, required : get_option('djvu'))
246     if ddjvuapi_dep.found()
247         conf_data.set('HAVE_DJVU', 1)
248         summary({'djvu' : ['djvu files supported:', true]}, section : 'Configuration', bool_yn : true)
249     else
250         summary({'djvu' : ['ddjvuapi ' + req_version + ' not found - djvu files supported:', false]}, section : 'Configuration', bool_yn : true)
251     endif
252 else
253     summary({'djvu' : ['disabled - djvu files supported:', false]}, section : 'Configuration', bool_yn : true)
254 endif
255
256 option = get_option('evince')
257 if not option.disabled()
258     evince = find_program('evince', required : false)
259     if evince.found()
260         summary({'print preview' : ['print preview supported:', true]}, section : 'Configuration', bool_yn : true)
261     else
262         summary({'print preview' : ['evince not found - print preview supported:', false]}, section : 'Configuration', bool_yn : true)
263     endif
264 else
265     summary({'print preview' : ['disabled - print preview supported:', false]}, section : 'Configuration', bool_yn : true)
266 endif
267
268 # Required only for seg. fault stacktrace and backtrace debugging
269 option = get_option('execinfo')
270 if not option.disabled()
271     result = cc.check_header('execinfo.h')
272     if result
273         conf_data.set('HAVE_EXECINFO_H', 1)
274         summary({'execinfo' : ['stacktrace supported:', true]}, section : 'Configuration', bool_yn : true)
275     else
276         summary({'execinfo' : ['stacktrace supported:', false]}, section : 'Configuration', bool_yn : true)
277     endif
278 else
279     summary({'execinfo' : ['stacktrace supported:', false]}, section : 'Configuration', bool_yn : true)
280 endif
281
282 exiv2_dep = []
283 req_version = '>=0.11'
284 option = get_option('exiv2')
285 if not option.disabled()
286     exiv2_dep = dependency('exiv2', version : req_version, required : get_option('exiv2'))
287     if exiv2_dep.found()
288         conf_data.set('HAVE_EXIV2', 1)
289         summary({'exiv2' : ['image metadata processed by exiv2:', true]}, section : 'Configuration', bool_yn : true)
290     else
291         summary({'exiv2' : ['exiv2 ' + req_version + ' not found - image data not processed by exiv2:', false]}, section : 'Configuration', bool_yn : true)
292     endif
293 else
294     summary({'exiv2' : ['disabled - image data processed by exiv2:', false]}, section : 'Configuration', bool_yn : true)
295 endif
296
297 champlain_dep = []
298 champlain_gtk_dep = []
299 clutter_dep = []
300 clutter_gtk_dep = []
301 req_version_champlain = '>=0.12'
302 req_version_champlain_gtk = '>=0.12'
303 req_version_clutter = '>=1.0'
304 req_version_clutter_gtk = '>=1.0'
305 option = get_option('gps-map')
306 if not option.disabled()
307     champlain_dep = dependency('champlain-0.12', version : req_version_champlain, required : get_option('gps-map'))
308     champlain_gtk_dep = dependency('champlain-gtk-0.12', version : req_version_champlain_gtk, required : get_option('gps-map'))
309     if champlain_dep.found() and champlain_gtk_dep.found()
310         clutter_dep = dependency('clutter-1.0', version : req_version_clutter, required : get_option('gps-map'))
311         clutter_gtk_dep = dependency('clutter-gtk-1.0', version : req_version_clutter_gtk, required : get_option('gps-map'))
312         if clutter_dep.found() and clutter_gtk_dep.found()
313             conf_data.set('HAVE_CLUTTER', 1)
314             conf_data.set('HAVE_LIBCHAMPLAIN', 1)
315             conf_data.set('HAVE_LIBCHAMPLAIN_GTK', 1)
316             summary({'gps-map' : ['GPS map displayed', true]}, section : 'Configuration', bool_yn : true)
317         else
318             if not clutter_dep.found()
319                 summary({'gps-map-clutter' : ['clutter-1.0 ' + req_version_clutter + ' not found - GPS map displayed:', false]}, section : 'Configuration', bool_yn : true)
320             endif
321             if not clutter_gtk_dep.found()
322                 summary({'gps-map-clutter-gtk' : ['clutter-gtk-1.0 ' + req_version_clutter_gtk + ' not found - GPS map displayed:', false]}, section : 'Configuration', bool_yn : true)
323             endif
324         endif
325     else
326         if not champlain_dep.found()
327             summary({'gps-map-champlain' : ['champlain-0.12 ' + req_version_champlain + ' not found - GPS map displayed:', false]}, section : 'Configuration', bool_yn : true)
328         endif
329         if not champlain_gtk_dep.found()
330             summary({'gps-map-champlain-gtk' : ['champlain-gtk-0.12 ' + req_version_champlain_gtk + ' not found - GPS map displayed:', false]}, section : 'Configuration', bool_yn : true)
331         endif
332     endif
333 else
334     summary({'gps-map' : ['disabled - GPS map displayed:', false]}, section : 'Configuration', bool_yn : true)
335 endif
336
337 libheif_dep = []
338 req_version = '>=1.3.2'
339 option = get_option('heif')
340 if not option.disabled()
341     libheif_dep = dependency('libheif', version : req_version, required : get_option('heif'))
342     if libheif_dep.found()
343         conf_data.set('HAVE_HEIF', 1)
344         summary({'heif' : ['heif files supported:', true]}, section : 'Configuration', bool_yn : true)
345     else
346         summary({'heif' : ['libheif ' + req_version + ' not found - heif files supported:', false]}, section : 'Configuration', bool_yn : true)
347     endif
348 else
349     summary({'heif' : ['disabled - heif files supported:', false]}, section : 'Configuration', bool_yn : true)
350 endif
351
352 libopenjp2_dep = []
353 req_version = '>=2.3.0'
354 option = get_option('j2k')
355 if not option.disabled()
356     libopenjp2_dep = dependency('libopenjp2', version : req_version, required : get_option('j2k'))
357     if libopenjp2_dep.found()
358         conf_data.set('HAVE_J2K', 1)
359         summary({'j2k' : ['j2k files supported:', true]}, section : 'Configuration', bool_yn : true)
360     else
361         summary({'j2k' : ['libopenjp2 ' + req_version + ' not found - j2k files supported:', false]}, section : 'Configuration', bool_yn : true)
362     endif
363 else
364     summary({'j2k' : ['disabled - j2k files supported:', false]}, section : 'Configuration', bool_yn : true)
365 endif
366
367 libjpeg_dep = []
368 option = get_option('jpeg')
369 if not option.disabled()
370 libjpeg_dep = dependency('libjpeg', required : get_option('jpeg'))
371     if libjpeg_dep.found()
372         if cc.has_function('jpeg_destroy_decompress', dependencies : libjpeg_dep)
373             conf_data.set('HAVE_JPEG', 1)
374             summary({'jpeg' : ['jpeg files supported:', true]}, section : 'Configuration', bool_yn : true)
375         else
376             summary({'jpeg' : ['jpeg_destroy_decompress not found - jpeg files supported:', false]}, section : 'Configuration', bool_yn : true)
377         endif
378     else
379         summary({'jpeg' : ['libjpeg: not found', false]}, section : 'Configuration', bool_yn : true)
380     endif
381 else
382     summary({'jpeg' : ['disabled - jpeg files supported:', false]}, section : 'Configuration', bool_yn : true)
383 endif
384
385 libjxl_dep = []
386 req_version = '>=0.3.7'
387 option = get_option('jpegxl')
388 if not option.disabled()
389     libjxl_dep = dependency('libjxl', version : req_version, required : get_option('jpegxl'))
390     if libjxl_dep.found()
391         conf_data.set('HAVE_JPEGXL', 1)
392         summary({'jpegxl' : ['jpegxl files supported:', true]}, section : 'Configuration', bool_yn : true)
393     else
394         summary({'jpegxl' : ['libjxl ' + req_version + ' not found - jpegxl files supported:', false]}, section : 'Configuration', bool_yn : true)
395     endif
396 else
397     summary({'jpegxl' : ['disabled - jpegxl files supported:', false]}, section : 'Configuration', bool_yn : true)
398 endif
399
400 libraw_dep = []
401 req_version = '>=0.20'
402 option = get_option('libraw')
403 if not option.disabled()
404     libraw_dep = dependency('libraw', version : req_version, required : get_option('libraw'))
405     if libraw_dep.found()
406         conf_data.set('HAVE_RAW', 1)
407         summary({'libraw' : ['.cr3 files supported:', true]}, section : 'Configuration', bool_yn : true)
408     else
409         summary({'libraw' : ['libraw ' + req_version + ' not found - .cr3 files supported:', false]}, section : 'Configuration', bool_yn : true)
410     endif
411 else
412     summary({'libraw' : ['disabled - .cr3 files supported:', false]}, section : 'Configuration', bool_yn : true)
413 endif
414
415 lua_dep = []
416 req_version = '>=5.3'
417 option = get_option('lua')
418 if not option.disabled()
419     foreach name : ['lua', 'lua5.3', 'lua-5.3', 'lua53']
420         lua_dep = dependency(name, version: req_version, required: get_option('lua'))
421         if lua_dep.found()
422             break
423         endif
424     endforeach
425     if lua_dep.found()
426         conf_data.set('HAVE_LUA', 1)
427         summary({'lua' : ['lua supported:', true]}, section : 'Configuration', bool_yn : true)
428     else
429         summary({'lua' : ['lua ' + req_version + ' not found - lua supported:', false]}, section : 'Configuration', bool_yn : true)
430     endif
431 else
432     summary({'lua' : ['disabled - lua supported:', false]}, section : 'Configuration', bool_yn : true)
433 endif
434
435 # Install standard documents
436 option = get_option('pandoc')
437 if not option.disabled()
438     pandoc = find_program('pandoc', required : false)
439     if pandoc.found()
440         readme_html = custom_target(
441             'README.html',
442             input: 'README.md',
443             output: 'README.html',
444             command: [pandoc, '@INPUT@', '-o', '@OUTPUT@'],
445             install: true,
446             install_dir: helpdir)
447
448         summary({'README' : ['README.html created:', true]}, section : 'Documentation', bool_yn : true)
449     else
450         summary({'README' : ['pandoc not found - README.html created:', false]}, section : 'Documentation', bool_yn : true)
451     endif
452 else
453     summary({'pandoc' : ['disabled - README.html created:', false]}, section : 'Documentation', bool_yn : true)
454 endif
455 install_data('README.md', 'COPYING', 'TODO', install_dir : helpdir)
456
457 poppler_glib_dep = []
458 req_version = '>=0.62'
459 option = get_option('pdf')
460 if not option.disabled()
461     poppler_glib_dep = dependency('poppler-glib', version : req_version, required : get_option('pdf'))
462     if poppler_glib_dep.found()
463         conf_data.set('HAVE_PDF', 1)
464         summary({'pdf'  : ['pdf files supported:', true]}, section : 'Configuration', bool_yn : true)
465     else
466         summary({'pdf' : ['poppler-glib ' + req_version + ' not found - pdf files supported:', false]}, section : 'Configuration', bool_yn : true)
467     endif
468 else
469     summary({'pdf' : ['disabled - pdf files supported:', false]}, section : 'Configuration', bool_yn : true)
470 endif
471
472 gspell_dep = []
473 req_version = '>=1.6'
474 option = get_option('spell')
475 if not option.disabled()
476     gspell_dep = dependency('gspell-1', version : req_version, required: get_option('spell'))
477     if gspell_dep.found()
478         conf_data.set('HAVE_SPELL', 1)
479         summary({'spell' : ['spelling checks enabled', true]}, section : 'Configuration', bool_yn : true)
480     else
481         summary({'spell' : ['gspell-1 ' + req_version + ' not found - spelling checks enabled', false]}, section : 'Configuration', bool_yn : true)
482     endif
483 else
484     summary({'spell' : ['disabled - spelling checks enabled', false]}, section : 'Configuration', bool_yn : true)
485 endif
486
487 tiff_dep = []
488 option = get_option('tiff')
489 if not option.disabled()
490     tiff_dep = dependency('libtiff-4', required: get_option('tiff'))
491     if tiff_dep.found()
492         if cc.has_function('TIFFClientOpen', dependencies : tiff_dep)
493             conf_data.set('HAVE_TIFF', 1)
494             summary({'tiff' : ['tiff files supported:', true]}, section : 'Configuration', bool_yn : true)
495         else
496             summary({'tiff' : ['TIFFClientOpen not found - tiff files supported:', false]}, section : 'Configuration', bool_yn : true)
497         endif
498     else
499         summary({'tiff' : ['libtiff not found - tiff files supported:', false]}, section : 'Configuration', bool_yn : true)
500     endif
501 else
502     summary({'tiff' : ['disabled - tiff files supported:', false]}, section : 'Configuration', bool_yn : true)
503 endif
504
505 libffmpegthumbnailer_dep = []
506 req_version = '>=2.1.0'
507 option = get_option('videothumbnailer')
508 if not option.disabled()
509     libffmpegthumbnailer_dep = dependency('libffmpegthumbnailer',
510         version : req_version,
511         required : get_option('videothumbnailer'))
512
513     if libffmpegthumbnailer_dep.found()
514         conf_data.set('HAVE_FFMPEGTHUMBNAILER', 1)
515         summary({'videothumbnailer' : ['thumbnails of video files supported:', true]}, section : 'Configuration', bool_yn : true)
516
517         result = cc.has_member('struct video_thumbnailer_struct', 'prefer_embedded_metadata', prefix : '#include <libffmpegthumbnailer/videothumbnailerc.h>')
518         if result
519             conf_data.set('HAVE_FFMPEGTHUMBNAILER_METADATA', 1)
520         endif
521         summary({'fmpegthumbnailer_metadata' : ['fmpegthumbnailer_metadata found:', result]}, section : 'Thumbnailer', bool_yn : true)
522
523         result = cc.has_member('struct image_data_struct', 'image_data_width', prefix : '#include <libffmpegthumbnailer/videothumbnailerc.h>' )
524         if result
525             conf_data.set('HAVE_FFMPEGTHUMBNAILER_RGB', 1)
526         endif
527         summary({'fmpegthumbnailer_rgb' : ['fmpegthumbnailer_rgb found:', result]}, section : 'Thumbnailer', bool_yn : true)
528
529         result = cc.has_function('video_thumbnailer_set_size', dependencies : libffmpegthumbnailer_dep)
530         if result
531             conf_data.set('HAVE_FFMPEGTHUMBNAILER_WH', 1)
532         endif
533         summary({'fmpegthumbnailer_set_size' : ['fmpegthumbnailer_set_size found:', result]}, section : 'Thumbnailer', bool_yn : true)
534     else
535         summary({'videothumbnailer' : ['libvideothumbnailer ' + req_version + ' not found - thumbnails of video files supported', false]}, section : 'Configuration', bool_yn : true)
536     endif
537 else
538     summary({'videothumbnailer' : ['disabled -thumbnails of video files supported', false]}, section : 'Configuration', bool_yn : true)
539 endif
540
541 # libpixbufloader-webp is not loaded as part of libgdk-pixbuf. Just issue
542 # a warning if not installed
543 libwebp_dir = dependency('gdk-pixbuf-2.0', method: 'pkg-config').get_variable(pkgconfig: 'gdk_pixbuf_moduledir', internal: 'gdk_pixbuf_moduledir')
544
545 if libwebp_dir.contains('loaders')
546     libwebp_dep = cc.find_library('pixbufloader-webp', dirs : libwebp_dir, required : false)
547     if libwebp_dep.found()
548         summary({'webp' : ['webp files supported:', true]}, section : 'Configuration', bool_yn : true)
549     else
550         summary({'webp' : ['webp-pixbuf-loader not installed - webp files supported:', false]}, section : 'Configuration', bool_yn : true)
551     endif
552 else
553     summary({'webp' : ['webp-pixbuf-loader not installed - webp files supported:', false]}, section : 'Configuration', bool_yn : true)
554 endif
555
556 # Check for nl_langinfo and _NL_TIME_FIRST_WEEKDAY
557 code = '''#include <langinfo.h>
558 #include<stdio.h>
559 int main (int argc, char ** argv) {
560     char *c;
561     c =  nl_langinfo(_NL_TIME_FIRST_WEEKDAY);
562     return 0;
563 }'''
564 if cc.links(code, name : 'nl_langinfo and _NL_TIME_FIRST_WEEKDAY')
565     conf_data.set('HAVE__NL_TIME_FIRST_WEEKDAY', 1)
566     summary({'nl_langinfo' : ['first weekday depends on locale:', true]}, section : 'Documentation', bool_yn : true)
567 else
568     summary({'nl_langinfo' : ['nl_langinfo not found - first weekday depends on locale:', false, 'first weekday defaults to Monday']}, section : 'Documentation', bool_yn : true)
569 endif
570
571 conf_data.set_quoted('GETTEXT_PACKAGE', meson.project_name())
572 conf_data.set_quoted('GQ_APPDIR', gq_appdir)
573 conf_data.set_quoted('GQ_BINDIR', gq_bindir)
574 conf_data.set_quoted('GQ_HELPDIR', gq_helpdir)
575 conf_data.set_quoted('GQ_HTMLDIR', gq_htmldir)
576 conf_data.set_quoted('GQ_LOCALEDIR', gq_localedir)
577
578 conf_data.set_quoted('PACKAGE', meson.project_name())
579 conf_data.set_quoted('PACKAGE_NAME', meson.project_name())
580 conf_data.set_quoted('PACKAGE_STRING', meson.project_version())
581 conf_data.set_quoted('PACKAGE_TARNAME', meson.project_name())
582 conf_data.set_quoted('PACKAGE_VERSION', meson.project_version())
583 conf_data.set_quoted('VERSION', meson.project_version())
584
585 configure_file(input : 'config.h.in',
586                output : 'config.h',
587                encoding : 'UTF-8',
588                configuration : conf_data)
589
590 # For shellcheck on scripts
591 script_sources = []
592 subdir('scripts')
593
594 # For gtk builder checks on .ui files
595 ui_sources = []
596
597 # Process subdirs before the sources
598 subdir('po')
599 subdir('plugins')
600
601 # Generate the executable
602 subdir('src')
603
604 # Generate the help files
605 subdir('doc')
606
607 # Install other project files
608 if running_from_git
609     cmd = [find_program('gen_changelog.sh'), meson.current_source_dir(), meson.current_build_dir()]
610     custom_target(
611         'ChangeLog',
612         input: 'ChangeLog.gqview',
613         output: ['ChangeLog', 'ChangeLog.html'],
614         command: cmd,
615         install: true,
616         install_dir: helpdir)
617     meson.add_dist_script(cmd)
618     summary({'ChangeLog' : ['ChangeLog, ChangeLog.html created:', true]}, section : 'Documentation', bool_yn : true)
619 elif fs.exists('ChangeLog.html')
620     install_data('ChangeLog', 'ChangeLog.html', install_dir: helpdir)
621     summary({'ChangeLog' : ['ChangeLog, ChangeLog.html installed from dist:', true]}, section : 'Documentation', bool_yn : true)
622 endif
623
624 install_data('geeqie.png', install_dir : icondir)
625 install_data('geeqie.1', install_dir : mandir1)
626
627 i18n.merge_file(
628     input : 'geeqie.desktop.in',
629     output : 'geeqie.desktop',
630     type : 'desktop',
631     po_dir : podir,
632     install : true,
633     install_dir : join_paths(datadir, 'applications'))
634
635 i18n.merge_file(
636     input : 'org.geeqie.Geeqie.appdata.xml.in',
637     output : 'org.geeqie.Geeqie.appdata.xml',
638     type : 'xml',
639     po_dir : podir,
640     install : true,
641     install_dir : appdatadir)
642
643 configure_file(input: 'geeqie.spec.in', output: 'geeqie.spec', configuration: conf_data)
644
645 # Basic test of the executable
646 xvfb = find_program('xvfb-run', required : false)
647 if xvfb.found()
648     test('Basic test', xvfb, args: ['--auto-servernum', geeqie_exe, '--version'], timeout: 100)
649     summary({'xvfb' : ['Test runs:', true]}, section : 'Testing', bool_yn : true)
650 else
651     summary({'xvfb' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
652 endif
653
654 # The tests are run on GitHub with all options disabled, and then
655 # with all or most options enabled. Shellcheck and GtkBuilder need only
656 # be run once when options are disabled. Use option archive as a flag.
657
658 # Shellcheck
659 option = get_option('archive')
660 if option.disabled()
661     shellcheck_exe = find_program('shellcheck', required : false)
662     script_sources += files('gen_changelog.sh',
663     'geeqie-install-debian.sh',
664     'version.sh')
665
666     if shellcheck_exe.found()
667         foreach script : script_sources
668             script_path = '@0@'.format(script)
669             test('Shellcheck_ ' + script_path, shellcheck_exe, args: ['--norc', '--shell=sh', '--enable=add-default-case,avoid-nullary-conditions,check-unassigned-uppercase,deprecate-which,quote-safe-variables', script], timeout: 100)
670         endforeach
671         summary({'shellcheck' : ['Test runs:', true]}, section : 'Testing', bool_yn : true)
672     else
673         summary({'shellcheck' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
674     endif
675 else
676     summary({'shellcheck' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
677 endif
678
679 # GtkBuilder .ui check
680 option = get_option('archive')
681 if option.disabled()
682     if xvfb.found()
683         gtk_builder_tool = find_program('gtk-builder-tool', required : false)
684         if gtk_builder_tool.found()
685             foreach ui_file : ui_sources
686                 ui_path = '@0@'.format(ui_file)
687                 test('UI Build_ ' + ui_path, xvfb, args: ['--auto-servernum', gtk_builder_tool.full_path(), 'validate', ui_file], timeout: 100)
688             endforeach
689             summary({'gtk-builder-tool' : ['Test runs:', true]}, section : 'Testing', bool_yn : true)
690         else
691             summary({'gtk-builder-tool' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
692         endif
693     else
694         summary({'gtk-builder-tool xvfb' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
695     endif
696 else
697     summary({'gtk-builder-tool xvfb' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
698 endif
699
700 # Image checks
701 option = get_option('devel')
702 if option.enabled()
703     get_test_images_sh = find_program('get-test-images.sh', dirs : scriptsdir, required : true)
704     image_test_sh = find_program('image-test.sh', dirs : scriptsdir, required : true)
705
706     images_dir = join_paths(meson.current_build_dir(), 'test-images.p')
707
708     message('Downloading test images')
709     sources_list = run_command(get_test_images_sh, images_dir,  'https://github.com/caclark/geeqie-test.git', check: true)
710
711     sources = sources_list.stdout().strip().split('\n')
712
713     foreach image : sources
714         image_path = '@0@'.format(image)
715         path_array = image_path.split('/')
716         image_name = path_array[path_array.length() - 1]
717
718         test('Image_ ' + image_name, image_test_sh, args: [geeqie_exe, image], is_parallel : false, timeout: 100)
719     endforeach
720     summary({'Image tests' : ['Test runs:', true]}, section : 'Testing', bool_yn : true)
721 else
722     summary({'Image tests' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
723 endif