summaryrefslogtreecommitdiff
path: root/meson.build
blob: 608e62bc48734221ce6556c099e2ae2efdf136d8 (plain)
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
project('eom','c',
  version: '1.28.0',
  meson_version: '>=0.59.0',
  license: 'GPLv2+',
)

eom_api_version = '2.20'

cc = meson.get_compiler('c')

i18n = import('i18n')
gnome = import('gnome')

top_inc = include_directories('.')
po_dir = meson.project_source_root() / 'po'
datadir = join_paths(get_option('prefix'), get_option('datadir'))
pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), 'eom')
bindir = get_option('prefix') / 'bin'
libdir = join_paths(get_option('prefix'), get_option('libdir'))
schemadir = datadir / 'glib-2.0' / 'schemas'
localedir = join_paths(get_option('prefix'), get_option('localedir'))
includedir = join_paths(get_option('prefix'), get_option('includedir'))
pluginsdir = libdir / 'eom' / 'plugins'

# Dependencies
glib_required = '2.52.0'
gtk_required = '3.22.0'
libpeas_required = '1.8.0'

gio = dependency('gio-2.0', version: '>= ' + glib_required)
gio_unix = dependency('gio-unix-2.0', version: '>= ' + glib_required)
gthread = dependency('gthread-2.0', version: '>= ' + glib_required)
gdk = dependency('gdk-3.0')
gdk_pixbuf = dependency('gdk-pixbuf-2.0', version : '>=2.36.5')
glib = dependency('glib-2.0', version: '>= 2.52.0')
gtk = dependency('gtk+-3.0', version : '>= ' + gtk_required)
gtk_unix_print = dependency('gtk+-unix-print-3.0', version : '>= ' + gtk_required)
gmodule = dependency('gmodule-2.0', required : false)
mate_desktop = dependency('mate-desktop-2.0', version : '>=1.17.0')
shared_mime_info = dependency('shared-mime-info', version : '>= 0.20')
libpeas = dependency('libpeas-1.0', version : '>= ' + libpeas_required)
libpeas_gtk = dependency('libpeas-gtk-1.0', version : '>= ' + libpeas_required)
xml = dependency('libxml-2.0', version: '>=2.0')
gobject_introspection = dependency('gobject-introspection-1.0', version : '>= 0.9.3', required : get_option('introspection'))
xmp = dependency('exempi-2.0', version: '>= 1.99.5', required : get_option('xmp'))
exif = dependency('libexif', version: '>= 0.6.14', required : get_option('libexif'))
rsvg = dependency('librsvg-2.0', version: '>= 2.36.2', required : get_option('librsvg'), not_found_message : 'LIBRSVG support disabled, svg files will not scale')

all_deps = [
  gio, gio_unix, gthread, gdk, glib,
  gtk, gtk_unix_print, gmodule, mate_desktop,
  gdk_pixbuf, shared_mime_info, libpeas, libpeas_gtk,
  xml, gobject_introspection, xmp, exif, rsvg,
]

m = cc.find_library('m', required : false)
all_deps += [m]

z = dependency('zlib')
assert(cc.has_function('crc32', dependencies: [z]), 'zlib do not have crc32')
all_deps += [z]

jpeg = dependency('libjpeg', required : get_option('jpeg'))
if jpeg.found() and (
  not cc.has_function('jpeg_destroy_decompress', dependencies: [jpeg])
  or not cc.has_header('jpeglib.h', dependencies: [jpeg])
)
  jpeg = disabler()
  warn('JPEG loader will not be built (JPEG library not found)')
endif
jpeg_has_progressive = false
if jpeg.found()
  if cc.has_function('jpeg_simple_progression', dependencies: [jpeg])
    jpeg_has_progressive = true
  else
    warn('JPEG library does not support progressive saving')
  endif

  jpeg_lib_version = cc.get_define('JPEG_LIB_VERSION', dependencies: [jpeg], prefix: '#include <jpeglib.h>').to_int()
  jpeg_80 = jpeg_lib_version >= 80
endif

assert(jpeg.found() or get_option('jpeg').disabled(), 'Checks for JPEG loader failed. You can build without it by passing -D jpeg=disabled but some programs using GTK+ may not work properly')
all_deps += [jpeg]

cms = dependency('lcms2', required : get_option('cms'))
all_deps += [cms]
gdk_target_has_x11 = gdk.get_variable('targets').split(' ').contains('x11')
if cms.found() or gdk_target_has_x11
  x11 = dependency('x11')
  all_deps += [x11]
endif

package_url = 'https://mate-desktop.org'
pkg_info = configuration_data({
  'PACKAGE_URL': package_url,
  'VERSION': meson.project_version(),
  'GETTEXT_PACKAGE': meson.project_name(),
  'prefix': get_option('prefix'),
  'exec_prefix': get_option('prefix'),
  'libdir': libdir,
  'includedir': includedir,
  'pluginsdir': includedir / 'eom' / 'plugins',
  'EOM_API_VERSION': eom_api_version,
})

if exif.found() or xmp.found()
  pkg_info.set('EOM_DOC_EXIF_START', '')
  pkg_info.set('EOM_DOC_EXIF_STOP', '')
else
  pkg_info.set('EOM_DOC_EXIF_START', '<!--')
  pkg_info.set('EOM_DOC_EXIF_STOP', '-->')
endif

conf = configuration_data()

conf.set_quoted('PACKAGE', meson.project_name())
conf.set_quoted('PACKAGE_URL', package_url)
conf.set_quoted('VERSION', meson.project_version())
version_parts = meson.project_version().split('.')
conf.set('EOM_MAJOR_VERSION', version_parts[0])
conf.set('EOM_MINOR_VERSION', version_parts[1])
conf.set('EOM_MICRO_VERSION', version_parts[2])

conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
if get_option('nls')
  conf.set('ENABLE_NLS', 1)
endif
if cc.has_function('strptime')
  conf.set('HAVE_STRPTIME', 1)
endif
if cc.has_header_symbol('langinfo.h', '_NL_MEASUREMENT_MEASUREMENT', required: false)
  conf.set('HAVE__NL_MEASUREMENT_MEASUREMENT', 1)
endif

if get_option('thumbnailer')
  if get_option('gdk-pixbuf-thumbnailer')
    eom_thumbnailer = find_program('gdk-pixbuf-thumbnailer').full_path()
  else
    magick = dependency('MagickWand', version : '>= 6.2.6')
    if magick.version().version_compare('>= 7')
      conf.set('HAVE_IMAGEMAGICK7', 1)
    else
      conf.set('HAVE_IMAGEMAGICK6', 1)
    endif
    eom_thumbnailer = 'eom-thumbnailer'
  endif
endif

pkg_info.set('EOM_THUMBNAILER', eom_thumbnailer)

# XMP support
if xmp.found()
  conf.set('HAVE_EXEMPI', 1)
endif
# EXIF support
if exif.found()
  conf.set('HAVE_EXIF', 1)
endif
# JPEG support
if jpeg.found()
  conf.set('HAVE_JPEG', 1)
  conf.set('HAVE_LIBJPEG', 1)
endif
# Jpeg Progressive Saving Support
if jpeg_has_progressive
  conf.set('HAVE_PROGRESSIVE_JPEG', 1)
endif
# Little CMS support
if cms.found()
  conf.set('HAVE_LCMS', 1)
endif
# RSVG Support
if rsvg.found()
  conf.set('HAVE_RSVG', 1)
endif
# Enable GObject Introspection
if gobject_introspection.found()
  conf.set('HAVE_INTROSPECTION', 1)
endif

conf_file = configure_file(output : 'config.h', configuration : conf)
add_project_arguments('-DHAVE_CONFIG_H', language : 'c')

summary({
  'EXIF support': exif.found(),
  'XMP support': xmp.found(),
  'JPEG support': jpeg.found(),
  'RSVG support': rsvg.found(),
  'Colour management support': cms.found(),
  'GObject Introspection': gobject_introspection.found(),
  'Native Language support': get_option('nls'),
  'Thumbnailer': eom_thumbnailer,
})

if get_option('nls')
  subdir('po')
endif

if jpeg.found()
  subdir('jpegutils')
endif

subdir('cut-n-paste')
subdir('src')
subdir('man')
subdir('plugins')
subdir('help')
subdir('data')
subdir('doc')

if get_option('thumbnailer')
  subdir('thumbnailer')
endif

meson.add_dist_script('update-changelog.sh')