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=3', 'buildtype=debugoptimized']
51 # To inhibit warnings from the generated files icons_inline.h and ui_icons.h
52 add_global_arguments('-Wno-overlength-strings', language : 'c')
54 # Project requirements
56 gnome = import('gnome')
57 thread_dep = dependency('threads')
58 cc = meson.get_compiler('c')
60 configuration_inc = include_directories('.')
63 gdk_pixbuf_csource = find_program('gdk-pixbuf-csource', required : true)
64 glib_genmarshal = find_program('glib-genmarshal', required : true)
65 gnome_doc_tool = find_program('yelp-build', required : false)
66 if not gnome_doc_tool.found()
67 message('yelp-build not found. Help files not created.')
70 debug = get_option('debug')
72 # Note that main.c sets prefix to the directory above where the executable is run from.
73 # This is to allow AppImages to be used
75 # These gq_* variables are paths relative to /prefix/,
76 # and are also used in defines in the source as GQ_*
77 if get_option('gq_appdir') == ''
78 gq_appdir = join_paths(get_option('datadir'), 'geeqie')
80 gq_appdir = get_option('gq_appdir')
83 # This is not the same as Meson bindir
84 if get_option('gq_bindir') == ''
85 gq_bindir = 'lib/geeqie'
87 gq_bindir = get_option('gq_bindir')
90 if get_option('gq_helpdir') == ''
91 gq_helpdir = join_paths(get_option('datadir'), 'doc/geeqie')
93 gq_helpdir = get_option('gq_helpdir')
96 if get_option('gq_htmldir') == ''
97 gq_htmldir = join_paths(get_option('datadir'), 'doc/geeqie/html')
99 gq_htmldir = get_option('gq_htmldir')
102 if get_option('gq_localedir') == ''
103 gq_localedir = join_paths(get_option('datadir'), 'locale')
105 gq_localedir = get_option('gq_localedir')
109 # Set up the absolute directory paths used
110 prefix = get_option('prefix')
111 datadir = join_paths(prefix, get_option('datadir'))
113 # Installation paths are absolute
114 appdir = join_paths(prefix, gq_appdir)
115 appdatadir = join_paths(datadir, 'metainfo')
116 desktopdir = join_paths(datadir, meson.project_name(), 'applications')
117 helpdir = join_paths(prefix, gq_helpdir)
118 htmldir = join_paths(prefix, gq_htmldir)
119 icondir = join_paths(datadir, 'pixmaps')
120 mandir1 = join_paths(datadir, 'man', 'man1')
122 podir = join_paths(meson.project_source_root(), 'po')
124 # Create the define constants used in the sources. Set via config.h.in
125 conf_data = configuration_data()
126 conf_data.set_quoted('VERSION', run_command('./version.sh', check : true).stdout())
127 conf_data.set('DEBUG', debug)
129 gtk_dep = dependency('gtk+-3.0', version : '>=3.22', required: true)
130 glib_dep = dependency('glib-2.0', version: '>=2.52', required: true)
133 libarchive_dep = dependency('libarchive', version: '>=3.4.0', required : get_option('archive'))
134 if libarchive_dep.found()
135 conf_data.set('HAVE_ARCHIVE', 1)
139 lcms_dep = dependency('lcms2', version: '>=2.0', required : get_option('cms'))
141 conf_data.set('HAVE_LCMS', 1)
142 conf_data.set('HAVE_LCMS2', 1)
146 ddjvuapi_dep = dependency('ddjvuapi', version: '>=3.5.27', required : get_option('djvu'))
147 if ddjvuapi_dep.found()
148 conf_data.set('HAVE_DJVU', 1)
152 exiv2_dep = dependency('exiv2', version: '>=0.11', required : get_option('exiv2'))
154 conf_data.set('HAVE_EXIV2', 1)
157 libffmpegthumbnailer_dep = []
158 libffmpegthumbnailer_dep = dependency('libffmpegthumbnailer',
160 required : get_option('ffmpegthumbnailer'))
162 if libffmpegthumbnailer_dep.found()
163 conf_data.set('HAVE_FFMPEGTHUMBNAILER', 1)
165 if cc.has_member('struct video_thumbnailer_struct', 'prefer_embedded_metadata',
166 prefix : '#include <libffmpegthumbnailer/videothumbnailerc.h>')
168 conf_data.set('HAVE_FFMPEGTHUMBNAILER_METADATA', 1)
171 if cc.has_member('struct image_data_struct', 'image_data_width',
172 prefix : '#include <libffmpegthumbnailer/videothumbnailerc.h>' )
174 conf_data.set('HAVE_FFMPEGTHUMBNAILER_RGB', 1)
177 if cc.has_function('video_thumbnailer_set_size',
178 dependencies : libffmpegthumbnailer_dep)
180 conf_data.set('HAVE_FFMPEGTHUMBNAILER_WH', 1)
185 champlain_gtk_dep = []
186 champlain_dep = dependency('champlain-0.12', version: '>=0.12', required : get_option('gps-map'))
187 champlain_gtk_dep = dependency('champlain-gtk-0.12', version: '>=0.12', required : get_option('gps-map'))
188 if champlain_dep.found() and champlain_gtk_dep.found()
191 clutter_dep = dependency('clutter-1.0', required : true)
192 clutter_gtk_dep = dependency('clutter-gtk-1.0', required : true)
193 if clutter_dep.found() and clutter_gtk_dep.found()
194 conf_data.set('HAVE_CLUTTER', 1)
195 conf_data.set('HAVE_LIBCHAMPLAIN', 1)
196 conf_data.set('HAVE_LIBCHAMPLAIN_GTK', 1)
201 libheif_dep = dependency('libheif', version: '>=1.3.2', required : get_option('heif'))
202 if libheif_dep.found()
203 conf_data.set('HAVE_HEIF', 1)
207 libopenjp2_dep = dependency('libopenjp2', version: '>=2.3.0', required : get_option('j2k'))
208 if libopenjp2_dep.found()
209 conf_data.set('HAVE_J2K', 1)
213 libjpeg_dep = dependency('libjpeg', required : get_option('jpeg'))
214 if libjpeg_dep.found()
215 if cc.has_function('jpeg_destroy_decompress',
216 dependencies : libjpeg_dep)
218 conf_data.set('HAVE_JPEG', 1)
223 libjxl_dep = dependency('libjxl', version: '>=0.3.7', required : get_option('jpegxl'))
224 if libjxl_dep.found()
225 conf_data.set('HAVE_JPEGXL', 1)
229 libraw_dep = dependency('libraw', version: '>=0.20', required : get_option('libraw'))
230 if libraw_dep.found()
231 conf_data.set('HAVE_RAW', 1)
235 lua_dep = dependency('lua5.1', required : get_option('lua'))
237 conf_data.set('HAVE_LUA', 1)
240 poppler_glib_dep = []
241 poppler_glib_dep = dependency('poppler-glib', version: '>=0.62', required : get_option('pdf'))
242 if poppler_glib_dep.found()
243 conf_data.set('HAVE_PDF', 1)
247 gspell_dep = dependency('gspell-1', required: get_option('spell'))
248 if gspell_dep.found()
249 conf_data.set('HAVE_SPELL', 1)
253 tiff_dep = cc.find_library('tiff', required: get_option('tiff'))
255 if cc.has_function('TIFFClientOpen',
256 dependencies : tiff_dep)
258 conf_data.set('HAVE_TIFF', 1)
263 libwebp_dep = dependency('libwebp', version: '>=0.6.1', required : get_option('webp'))
264 if libwebp_dep.found()
265 conf_data.set('HAVE_WEBP', 1)
268 # Check for nl_langinfo and _NL_TIME_FIRST_WEEKDAY
269 code = '''#include <langinfo.h>
271 int main (int argc, char ** argv) {
273 c = nl_langinfo(_NL_TIME_FIRST_WEEKDAY);
276 if cc.links(code, name : 'nl_langinfo and _NL_TIME_FIRST_WEEKDAY')
277 conf_data.set('HAVE__NL_TIME_FIRST_WEEKDAY', 1)
280 conf_data.set_quoted('GETTEXT_PACKAGE', meson.project_name())
281 conf_data.set_quoted('GQ_APPDIR', gq_appdir)
282 conf_data.set_quoted('GQ_BINDIR', gq_bindir)
283 conf_data.set_quoted('GQ_HELPDIR', gq_helpdir)
284 conf_data.set_quoted('GQ_HTMLDIR', gq_htmldir)
285 conf_data.set_quoted('GQ_LOCALEDIR', gq_localedir)
287 conf_data.set_quoted('PACKAGE', meson.project_name())
288 conf_data.set_quoted('PACKAGE_NAME', meson.project_name())
289 conf_data.set_quoted('PACKAGE_STRING', meson.project_version())
290 conf_data.set_quoted('PACKAGE_TARNAME', meson.project_name())
291 conf_data.set_quoted('PACKAGE_VERSION', meson.project_version())
292 conf_data.set_quoted('VERSION', meson.project_version())
294 configure_file(input : 'config.h.in',
297 configuration : conf_data)
299 # Process subdirs before the sources
303 # Generate the executable and the help files
307 # Install other project files
308 run_command(find_program('gen_changelog.sh'), meson.project_source_root(), meson.project_build_root(), check : true)
310 run_command(find_program('gen_readme.sh'), meson.project_source_root(), meson.project_build_root(), check : true)
312 pandoc = find_program('pandoc')
314 install_data('README.md', 'COPYING', join_paths(meson.project_build_root(), 'ChangeLog'), 'TODO', 'AUTHORS', join_paths(meson.project_build_root(), 'README.html'), join_paths(meson.project_build_root(), 'ChangeLog.html'), install_dir : helpdir, install_tag : 'help')
316 install_data('README.md', 'COPYING', join_paths(meson.project_build_root(), 'ChangeLog'), 'TODO', 'README.lirc', 'AUTHORS', install_dir : helpdir, install_tag : 'help')
319 install_data('geeqie.png', install_dir : icondir, install_tag : 'icons')
320 install_data('geeqie.1', install_dir : mandir1, install_tag : 'man')
323 input : 'geeqie.desktop.in',
324 output : 'geeqie.desktop',
328 install_dir : join_paths(datadir, 'applications'))
331 input : 'org.geeqie.Geeqie.appdata.xml.in',
332 output : 'org.geeqie.Geeqie.appdata.xml',
336 install_dir : appdatadir)
338 configure_file(input: 'geeqie.spec.in', output: 'geeqie.spec', configuration: conf_data)