1 # This file is a part of Geeqie project (https://www.geeqie.org/).
2 # Copyright (C) 2008 - 2022 The Geeqie Team
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.
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.
14 # Meson default directories used in this project:
23 # Project expanded default directories:
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
39 # * See meson_options.txt file
45 version : run_command('./version.sh', check : true).stdout().strip(),
46 license : ['GPL-2.0-or-later'],
47 meson_version : '>= 0.60.0',
48 default_options : ['warning_level=0', 'buildtype=debugoptimized']
51 # Project requirements
53 gnome = import('gnome')
54 thread_dep = dependency('threads')
55 cc = meson.get_compiler('c')
57 configuration_inc = include_directories('.')
60 gdk_pixbuf_csource = find_program('gdk-pixbuf-csource', required : true)
61 glib_genmarshal = find_program('glib-genmarshal', required : true)
62 gnome_doc_tool = find_program('yelp-build', required : false)
63 if not gnome_doc_tool.found()
64 message('yelp-build not found. Help files not created.')
67 debug = get_option('debug')
69 # Note that main.c sets prefix to the directory above where the executable is run from.
70 # This is to allow AppImages to be used
72 # These gq_* variables are paths relative to /prefix/,
73 # and are also used in defines in the source as GQ_*
74 if get_option('gq_appdir') == ''
75 gq_appdir = join_paths(get_option('datadir'), 'geeqie')
77 gq_appdir = get_option('gq_appdir')
80 # This is not the same as Meson bindir
81 if get_option('gq_bindir') == ''
82 gq_bindir = 'lib/geeqie'
84 gq_bindir = get_option('gq_bindir')
87 if get_option('gq_helpdir') == ''
88 gq_helpdir = join_paths(get_option('datadir'), 'doc/geeqie')
90 gq_helpdir = get_option('gq_helpdir')
93 if get_option('gq_htmldir') == ''
94 gq_htmldir = join_paths(get_option('datadir'), 'doc/geeqie/html')
96 gq_htmldir = get_option('gq_htmldir')
99 if get_option('gq_localedir') == ''
100 gq_localedir = join_paths(get_option('datadir'), 'locale')
102 gq_localedir = get_option('gq_localedir')
106 # Set up the absolute directory paths used
107 prefix = get_option('prefix')
108 datadir = join_paths(prefix, get_option('datadir'))
110 # Installation paths are absolute
111 appdir = join_paths(prefix, gq_appdir)
112 appdatadir = join_paths(datadir, 'metainfo')
113 desktopdir = join_paths(datadir, meson.project_name(), 'applications')
114 helpdir = join_paths(prefix, gq_helpdir)
115 htmldir = join_paths(prefix, gq_htmldir)
116 icondir = join_paths(datadir, 'pixmaps')
117 mandir1 = join_paths(datadir, 'man', 'man1')
119 podir = join_paths(meson.project_source_root(), 'po')
121 # Create the define constants used in the sources. Set via config.h.in
122 conf_data = configuration_data()
123 conf_data.set_quoted('VERSION', run_command('./version.sh', check : true).stdout())
124 conf_data.set('DEBUG', debug)
126 if get_option('gtk3')
127 gtk_dep = dependency('gtk+-3.0', version : '>=3.0', required: true)
129 gtk_dep = dependency('gtk+-2.0', version : '>=2.20', required: true)
132 glib_dep = dependency('glib-2.0', version: '>=2.52', required: true)
135 libarchive_dep = dependency('libarchive', version: '>=3.4.0', required : get_option('archive'))
136 if libarchive_dep.found()
137 conf_data.set('HAVE_ARCHIVE', 1)
142 if get_option('gtk3')
143 clutter_dep = dependency('clutter-1.0', required : get_option('clutter'))
144 clutter_gtk_dep = dependency('clutter-gtk-1.0', required : get_option('clutter'))
145 if clutter_dep.found() and clutter_gtk_dep.found()
146 conf_data.set('HAVE_CLUTTER', 1)
151 lcms_dep = dependency('lcms2', version: '>=2.0', required : get_option('cms'))
153 conf_data.set('HAVE_LCMS', 1)
154 conf_data.set('HAVE_LCMS2', 1)
158 ddjvuapi_dep = dependency('ddjvuapi', version: '>=3.5.27', required : get_option('djvu'))
159 if ddjvuapi_dep.found()
160 conf_data.set('HAVE_DJVU', 1)
164 exiv2_dep = dependency('exiv2', version: '>=0.11', required : get_option('exiv2'))
166 conf_data.set('HAVE_EXIV2', 1)
169 libffmpegthumbnailer_dep = []
170 libffmpegthumbnailer_dep = dependency('libffmpegthumbnailer',
172 required : get_option('ffmpegthumbnailer'))
174 if libffmpegthumbnailer_dep.found()
175 conf_data.set('HAVE_FFMPEGTHUMBNAILER', 1)
177 if cc.has_member('struct video_thumbnailer_struct', 'prefer_embedded_metadata',
178 prefix : '#include <libffmpegthumbnailer/videothumbnailerc.h>')
180 conf_data.set('HAVE_FFMPEGTHUMBNAILER_METADATA', 1)
183 if cc.has_member('struct image_data_struct', 'image_data_width',
184 prefix : '#include <libffmpegthumbnailer/videothumbnailerc.h>' )
186 conf_data.set('HAVE_FFMPEGTHUMBNAILER_RGB', 1)
189 if cc.has_function('video_thumbnailer_set_size',
190 dependencies : libffmpegthumbnailer_dep)
192 conf_data.set('HAVE_FFMPEGTHUMBNAILER_WH', 1)
197 champlain_gtk_dep = []
198 if conf_data.has('HAVE_CLUTTER')
199 champlain_dep = dependency('champlain-0.12', version: '>=0.12', required : get_option('gps-map'))
200 champlain_gtk_dep = dependency('champlain-gtk-0.12', version: '>=0.12', required : get_option('gps-map'))
201 if champlain_dep.found() and champlain_gtk_dep.found()
202 conf_data.set('HAVE_LIBCHAMPLAIN', 1)
203 conf_data.set('HAVE_LIBCHAMPLAIN_GTK', 1)
208 libheif_dep = dependency('libheif', version: '>=1.3.2', required : get_option('heif'))
209 if libheif_dep.found()
210 conf_data.set('HAVE_HEIF', 1)
214 libopenjp2_dep = dependency('libopenjp2', version: '>=2.3.0', required : get_option('j2k'))
215 if libopenjp2_dep.found()
216 conf_data.set('HAVE_J2K', 1)
220 libjpeg_dep = dependency('libjpeg', required : get_option('jpeg'))
221 if libjpeg_dep.found()
222 if cc.has_function('jpeg_destroy_decompress',
223 dependencies : libjpeg_dep)
225 conf_data.set('HAVE_JPEG', 1)
230 libjxl_dep = dependency('libjxl', version: '>=0.3.7', required : get_option('jpegxl'))
231 if libjxl_dep.found()
232 conf_data.set('HAVE_JPEGXL', 1)
236 libraw_dep = dependency('libraw', version: '>=0.20', required : get_option('libraw'))
237 if libraw_dep.found()
238 conf_data.set('HAVE_RAW', 1)
242 lirc_dep = dependency('lirc', version: '>=0.6.1', required : get_option('lirc'))
244 conf_data.set('HAVE_LIRC', 1)
248 lua_dep = dependency('lua5.1', required : get_option('lua'))
250 conf_data.set('HAVE_LUA', 1)
253 poppler_glib_dep = []
254 if get_option('gtk3')
255 poppler_glib_dep = dependency('poppler-glib', version: '>=0.62', required : get_option('pdf'))
256 if poppler_glib_dep.found()
257 conf_data.set('HAVE_PDF', 1)
262 if get_option('gtk3')
263 gspell_dep = dependency('gspell-1', required: get_option('spell'))
264 if gspell_dep.found()
265 conf_data.set('HAVE_SPELL', 1)
270 tiff_dep = cc.find_library('tiff', required: get_option('tiff'))
272 if cc.has_function('TIFFClientOpen',
273 dependencies : tiff_dep)
275 conf_data.set('HAVE_TIFF', 1)
280 libwebp_dep = dependency('libwebp', version: '>=0.6.1', required : get_option('webp'))
281 if libwebp_dep.found()
282 conf_data.set('HAVE_WEBP', 1)
285 # Check for nl_langinfo and _NL_TIME_FIRST_WEEKDAY
286 code = '''#include <langinfo.h>
288 int main (int argc, char ** argv) {
290 c = nl_langinfo(_NL_TIME_FIRST_WEEKDAY);
293 if cc.links(code, name : 'nl_langinfo and _NL_TIME_FIRST_WEEKDAY')
294 conf_data.set('HAVE__NL_TIME_FIRST_WEEKDAY', 1)
297 conf_data.set_quoted('GETTEXT_PACKAGE', meson.project_name())
298 conf_data.set_quoted('GQ_APPDIR', gq_appdir)
299 conf_data.set_quoted('GQ_BINDIR', gq_bindir)
300 conf_data.set_quoted('GQ_HELPDIR', gq_helpdir)
301 conf_data.set_quoted('GQ_HTMLDIR', gq_htmldir)
302 conf_data.set_quoted('GQ_LOCALEDIR', gq_localedir)
304 conf_data.set_quoted('PACKAGE', meson.project_name())
305 conf_data.set_quoted('PACKAGE_NAME', meson.project_name())
306 conf_data.set_quoted('PACKAGE_STRING', meson.project_version())
307 conf_data.set_quoted('PACKAGE_TARNAME', meson.project_name())
308 conf_data.set_quoted('PACKAGE_VERSION', meson.project_version())
309 conf_data.set_quoted('VERSION', meson.project_version())
311 configure_file(input : 'config.h.in',
314 configuration : conf_data)
316 # Process subdirs before the sources
320 # Generate the executable and the help files
324 # Install other project files
325 run_command(find_program('gen_changelog.sh'), meson.project_source_root(), meson.project_build_root(), check : true)
327 run_command(find_program('gen_readme.sh'), meson.project_source_root(), meson.project_build_root(), check : true)
329 pandoc = find_program('pandoc')
331 install_data('README.md', 'COPYING', join_paths(meson.project_build_root(), 'ChangeLog'), 'TODO', 'README.lirc', 'AUTHORS', join_paths(meson.project_build_root(), 'README.html'), join_paths(meson.project_build_root(), 'ChangeLog.html'), install_dir : helpdir, install_tag : 'help')
333 install_data('README.md', 'COPYING', join_paths(meson.project_build_root(), 'ChangeLog'), 'TODO', 'README.lirc', 'AUTHORS', install_dir : helpdir, install_tag : 'help')
336 install_data('geeqie.png', install_dir : icondir, install_tag : 'icons')
337 install_data('geeqie.1', install_dir : mandir1, install_tag : 'man')
340 input : 'geeqie.desktop.in',
341 output : 'geeqie.desktop',
345 install_dir : join_paths(datadir, 'applications'))
348 input : 'org.geeqie.Geeqie.appdata.xml.in',
349 output : 'org.geeqie.Geeqie.appdata.xml',
353 install_dir : appdatadir)
355 configure_file(input: 'geeqie.spec.in', output: 'geeqie.spec', configuration: conf_data)