-
Notifications
You must be signed in to change notification settings - Fork 686
/
meson.build
2207 lines (1866 loc) · 71.8 KB
/
meson.build
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
project('gimp',
'c', 'cpp',
version: '3.0.0-RC1+git',
meson_version: '>=0.61.0',
default_options: [
'cpp_std=gnu++14',
'buildtype=debugoptimized',
],
)
project_url = 'https://gitlab.gnome.org/GNOME/gimp'
project_url_issues = project_url + '/issues/new'
conf = configuration_data()
warnings = []
################################################################################
# Project info
prettyname = 'GIMP'
full_name = 'GNU Image Manipulation Program'
# General version
gimp_version = meson.project_version()
package_string= prettyname + ' ' + gimp_version
gimp_app_version_arr = gimp_version.split('.')
gimp_app_version_major = gimp_app_version_arr[0].to_int()
gimp_app_version_minor = gimp_app_version_arr[1].to_int()
gimp_app_micro_rc = gimp_app_version_arr[2].split('-')
gimp_app_version_micro = gimp_app_micro_rc[0].to_int()
if gimp_app_micro_rc.length() > 1
if not gimp_app_micro_rc[1].startswith('RC')
error('Version format is: <major>.<minor>.<micro> with optional "-RC<num>" suffix and optional "+git".')
endif
if gimp_app_micro_rc[1].endswith('+git')
gimp_app_version_rc = gimp_app_micro_rc[1].substring(2, -4).to_int()
else
gimp_app_version_rc = gimp_app_micro_rc[1].substring(2).to_int()
endif
endif
# Override for Release-candidates
gimp_app_version = '@0@.@1@'.format(
gimp_app_version_major,
gimp_app_version_minor
)
# API & pkg-config version
api_version_major = gimp_app_version_major
api_version_minor = 0
if gimp_app_version_minor == 99
api_version_major += 1
endif
gimp_api_version = '@0@.@1@'.format(api_version_major, api_version_minor)
gimp_api_name = 'gimp-' + gimp_api_version
# Libtool versioning
gimp_interface_age = 0
gimp_binary_age = 100 * gimp_app_version_minor + gimp_app_version_micro
lt_current = 100 * gimp_app_version_minor + gimp_app_version_micro - gimp_interface_age
lt_revision = gimp_interface_age
lt_age = gimp_binary_age - gimp_interface_age
# libtool's -version-info transforms "current:revision:age" into "(current - age).age.revision".
# Let's compute this ourselves.
so_version = '@0@.@1@.@2@'.format(lt_current - lt_age, lt_age, lt_revision)
gimp_command = 'gimp-' + gimp_app_version
gettext_package= 'gimp@0@@1@'.format(api_version_major, api_version_minor)
conf.set_quoted('GETTEXT_PACKAGE', gettext_package)
conf.set_quoted('GIMP_VERSION', gimp_version)
# GIMP_UNSTABLE tells if we are on an unstable or stable development branch.
stable = (gimp_app_version_minor % 2 == 0)
conf.set('GIMP_UNSTABLE', stable ? false : 1)
# GIMP_RELEASE tells if this is a release or in-between release (git) code.
release = (gimp_app_version_micro % 2 == 0)
conf.set('GIMP_RELEASE', release ? 1 : false)
versionconfig = configuration_data()
versionconfig.set('GIMP_FULL_NAME', full_name)
versionconfig.set('GIMP_MAJOR_VERSION', gimp_app_version_major)
versionconfig.set('GIMP_MINOR_VERSION', gimp_app_version_minor)
versionconfig.set('GIMP_MICRO_VERSION', gimp_app_version_micro)
versionconfig.set('GIMP_VERSION', gimp_version)
versionconfig.set('GIMP_API_VERSION', gimp_api_version)
################################################################################
# Get configuration and Meson modules
pkgconfig = import('pkgconfig')
i18n = import('i18n')
gnome = import('gnome')
pythonmod = import('python')
simd = import('unstable-simd')
fs = import('fs')
cc = meson.get_compiler('c')
cxx = meson.get_compiler('cpp')
prefix = get_option('prefix')
buildtype = get_option('buildtype')
exec_ver = '-' + gimp_app_version
gimpconsole_exe_name = 'gimp-console' + exec_ver
gimpmain_exe_name = 'gimp' + exec_ver
compiler_args = []
linker_args = []
################################################################################
# Host system detection
host_cpu_family = host_machine.cpu_family()
message('Host machine cpu family: ' + host_cpu_family)
host_cpu_family = host_machine.cpu_family()
have_x86 = false
have_ppc = false
if host_cpu_family == 'x86'
have_x86 = true
conf.set10('ARCH_X86', true)
elif host_cpu_family == 'x86_64'
have_x86 = true
conf.set10('ARCH_X86', true)
conf.set10('ARCH_X86_64', true)
elif host_cpu_family == 'ppc'
have_ppc = true
conf.set10('ARCH_PPC', true)
elif host_cpu_family == 'ppc64'
have_ppc = true
conf.set10('ARCH_PPC', true)
conf.set10('ARCH_PPC64', true)
endif
host_os = host_machine.system().to_lower()
message('Host os: ' + host_os)
platform_linux = (
host_os.contains('linux')
)
platform_windows = (
host_os.contains('mingw') or
host_os.contains('cygwin') or
host_os.contains('windows')
)
platform_osx = (
host_os.contains('machten') or
host_os.contains('rhapsody') or
host_os.contains('darwin')
)
if platform_osx
conf.set('PLATFORM_OSX', 1)
endif
if platform_windows
windows = import('windows')
# AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
# AM_CONDITIONAL(MS_LIB_AVAILABLE, test "x$ms_librarian" = xyes)
# compiler_args += '-Wl,--large-address-aware'
endif
# on OSX ObjC and C sources are mixed so adding objc to the linkflags
osx_ldflags = []
if platform_osx
add_languages('objc')
osx_ldflags += ['-Wl,-framework,Foundation', '-Wl,-framework,AppKit', '-ObjC']
add_project_link_arguments(osx_ldflags, language : ['objc', 'c'])
endif
if cc.get_id() == 'gcc' and cc.version() == '7.2.0'
gcc_warning = '''
GCC 7.2.0 has a serious bug affecting GEGL/GIMP. We advise
against using this version of the compiler (previous and
further versions are fine).
See https://bugzilla.gnome.org/show_bug.cgi?id=787222
'''
warning(gcc_warning)
warnings += gcc_warning
endif
################################################################################
# Compiler CPU extensions for optimizations
#
# -- Don't enable these flags project-wide, only files needing them
# should be built with a given extension, which we do with meson simd
# module. Otherwise GIMP would end up crashing when run on CPUs which
# don't support all the flags supported by the compiler.
# See merge request !262 for more details.
# Note that Meson has a SIMD module which can also do this for us, but it uses
# its own #defines and we want to stay compatible with the autotools build
conf.set('USE_MMX', cc.has_argument('-mmmx'))
conf.set('USE_SSE', cc.has_argument('-msse'))
conf.set10('COMPILE_SSE2_INTRINISICS', cc.has_argument('-msse2'))
conf.set10('COMPILE_SSE4_1_INTRINISICS', cc.has_argument('-msse4.1'))
if host_cpu_family == 'ppc'
altivec_args = cc.get_supported_arguments([
'-faltivec',
'-maltivec',
'-mabi=altivec',
])
if altivec_args != []
if host_os.contains('darwin')
conf.set('USE_ALTIVEC', true)
conf.set('HAVE_ALTIVEC_SYSCTL', true)
elif cc.compiles('''
int main() { asm ("vand %v0, %v0, %v0"); return 0; }
''')
conf.set('USE_ALTIVEC', true)
endif
endif
endif
################################################################################
# CFlags
if get_option('profiling') and cc.get_id() == 'gcc'
compiler_args += '-pg'
linker_args += '-pg'
endif
if get_option('ansi')
compiler_args += [ '-ansi', '-pedantic']
endif
warning_cflags_common = [
'-fdiagnostics-show-option',
'-fno-common',
'-Wformat',
'-Wformat-security',
'-Winit-self',
'-Wlogical-op',
'-Wmissing-declarations',
'-Wmissing-format-attribute',
'-Wpointer-arith',
'-Wreturn-type',
'-Wtype-limits',
]
warning_cflags_c = [
'-Wabsolute-value',
'-Wdeclaration-after-statement',
'-Wenum-conversion',
'-Wliteral-conversion',
'-Wno-strict-prototypes',
'-Wold-style-definition',
'-Wparentheses-equality',
'-W#pragma-messages',
'-Wsometimes-uninitialized',
'-Wtautological-unsigned-enum-zero-compare',
'-Wunneeded-internal-declaration',
'-Wunused-function',
'-Wunused-value',
'-Werror=implicit-function-declaration',
]
warning_cflags_cpp = [
]
compiler_args += cc.get_supported_arguments(warning_cflags_common)
add_project_arguments(cc .get_supported_arguments(warning_cflags_c), language: 'c')
add_project_arguments(cxx.get_supported_arguments(warning_cflags_cpp), language: 'cpp')
# Ensure MSVC-compatible struct packing convention is used when
# compiling for Win32 with gcc.
if platform_windows and cc.get_id() == 'gcc'
msvc_compat_args = cc.first_supported_argument([
'-fnative-struct',
'-mms-bitfields',
])
if msvc_compat_args == []
error('''
GCC does not support '-fnative-struct' nor '-mms-bitfields'.
Build will be incompatible with GTK DLLs.
''')
endif
compiler_args += msvc_compat_args
endif
if platform_windows and cc.get_id() == 'clang'
# Optimize DWARF symbols to Dr. Mingw
# https://github.com/jrfonseca/drmingw/issues/42
compiler_args += '-gdwarf-aranges'
# Workaround to get colored output
# https://github.com/msys2/MINGW-packages/issues/2988
compiler_args += '-fansi-escape-codes'
endif
# Generate .pdb (CodeView) debug symbols (makes possible to debug with DIA SDK)
#pdb_support = cc.has_argument('-gcodeview') and cc.has_link_argument('-Wl,--pdb=')
#if platform_windows and pdb_support
# compiler_args += '-gcodeview'
# linker_args += '-Wl,--pdb='
#endif
conf.set('HAVE__NL_MEASUREMENT_MEASUREMENT',
cc.compiles('''
#include<langinfo.h>
int main() {
char c = *((unsigned char *) nl_langinfo(_NL_MEASUREMENT_MEASUREMENT));
}
''')
)
conf.set('HAVE__NL_IDENTIFICATION_LANGUAGE',
cc.compiles('''
#include<langinfo.h>
int main() {
char c = *((unsigned char *) nl_langinfo(_NL_IDENTIFICATION_LANGUAGE));
}
''')
)
################################################################################
# Dependencies
no_dep = dependency('', required: false)
################################################################################
# Mandatory Dependencies
if get_option('relocatable-bundle') == 'yes'
relocatable_bundle = true
elif get_option('relocatable-bundle') == 'no'
relocatable_bundle = false
else # == 'platform-default'
# By default, assume building for Windows or macOS everything to be on
# the same prefix and can be relocated.
# On other platforms, build-time paths are meaningful.
if platform_windows or platform_osx
relocatable_bundle = true
else
relocatable_bundle = false
endif
endif
conf.set('ENABLE_RELOCATABLE_RESOURCES', relocatable_bundle)
math = cc.find_library('m')
# libdl is only required on Linux. On Windows and some (all?) BSD, it
# doesn't exist, but the API exists in libc by default (see #8604). On
# macOS, it apparently exists but linking it explicitly is actually
# unneeded as well.
dl = cc.find_library('dl', required: platform_linux)
rpc = platform_windows ? cc.find_library('rpcrt4') : no_dep
dbghelp = platform_windows ? cc.find_library('dbghelp') : no_dep
winsock = platform_windows ? cc.find_library('ws2_32') : no_dep
mscms = platform_windows ? cc.find_library('mscms') : no_dep
atk_minver = '2.4.0'
atk = dependency('atk', version: '>='+atk_minver)
babl_minver = '0.1.110'
babl = dependency('babl-0.1', version: '>='+babl_minver, required: false)
if not babl.found()
# babl changed its pkg-config name from 'babl' to 'babl-0.1' in version
# 0.1.100 (0.1.99 dev cycle more exactly). 'babl-0.1' is checked in priority
# because it would be a newer version.
babl = dependency('babl', version: '>='+babl_minver)
endif
# TODO: we want to bump to Cairo 1.17.2 when possible in order to use
# CAIRO_FORMAT_RGBA128F unconditionally. At time of writing, it's not possible
# because of our bookworm availability requirement.
cairo_minver = '1.14.0'
cairo = dependency('cairo', version: '>='+cairo_minver)
# fontconfig_name = platform_windows ? 'fontconfig_win32' : 'fontconfig'
fontconfig_name = 'fontconfig'
fontconfig_minver = '2.12.4'
fontconfig = dependency(fontconfig_name, version: '>='+fontconfig_minver)
freetype2_minver = '2.1.7'
freetype2 = dependency('freetype2', version: '>='+freetype2_minver)
gdk_pixbuf_minver = '2.30.8'
gdk_pixbuf = dependency('gdk-pixbuf-2.0', version: '>='+gdk_pixbuf_minver)
gegl_minver = '0.4.50'
gegl = dependency('gegl-0.4', version: '>='+gegl_minver)
exiv2_minver = '0.27.4'
exiv2 = dependency('exiv2', version: '>='+exiv2_minver)
gexiv2_minver = '0.14.0'
gexiv2 = dependency('gexiv2', version: '>='+gexiv2_minver)
gio = dependency('gio-2.0')
gio_specific_name = platform_windows ? 'gio-windows-2.0' : 'gio-unix-2.0'
gio_specific = dependency(gio_specific_name)
glib_minver = '2.70.0'
glib = dependency('glib-2.0', version: '>='+glib_minver)
gi = dependency('gobject-introspection-1.0')
conf.set('G_DISABLE_DEPRECATED', glib.version().version_compare('>=2.57'))
gobject = dependency('gobject-2.0', version: '>='+glib_minver)
gmodule = dependency('gmodule-no-export-2.0')
gtk3_minver = '3.24.0'
gtk3 = dependency('gtk+-3.0', version: '>='+gtk3_minver)
harfbuzz_minver = '2.8.2'
harfbuzz = dependency('harfbuzz', version: '>='+harfbuzz_minver)
json_glib = dependency('json-glib-1.0', version: '>=1.2.6')
lcms_minver = '2.8'
lcms = dependency('lcms2', version: '>='+lcms_minver)
libmypaint_minver = '1.3.0'
libmypaint = dependency('libmypaint', version: '>='+libmypaint_minver)
mypaint_brushes = dependency('mypaint-brushes-1.0',version: '>='+libmypaint_minver)
if not libmypaint.version().version_compare('>=1.4.0')
libmypaint_warning='''
libmypaint lower than version 1.4.0 is known to crash when
parsing MyPaint 2 brushes. Please update.
'''
warning(libmypaint_warning)
warnings += libmypaint_warning
endif
if relocatable_bundle
mypaint_brushes_dir = '${gimp_installation_dir}'\
/'share'/'mypaint-data'/'1.0'/'brushes'
else
mypaint_brushes_dir = mypaint_brushes.get_variable(pkgconfig: 'brushesdir')
endif
conf.set_quoted('MYPAINT_BRUSHES_DIR', mypaint_brushes_dir)
pango_minver = '1.50.0'
pango = dependency('pango', version: '>='+pango_minver)
pangocairo = dependency('pangocairo', version: '>='+pango_minver)
pangoft2 = dependency('pangoft2', version: '>='+pango_minver)
rsvg_minver = '2.40.6'
rsvg = dependency('librsvg-2.0', version: '>='+rsvg_minver)
conf.set('PANGO_DISABLE_DEPRECATED',pangocairo.version().version_compare('<1.43'))
################################################################################
# Check for GLib Networking
glib_networking_works_run=false
if meson.is_cross_build() and not meson.can_run_host_binaries()
# Cross-compilation without run capability: we won't be able to
# check networking support.
glib_networking_works = true
glib_warning = '''
Test for glib-networking cannot be performed while cross-compiling,
unless you set an `exe_wrapper` binary in your toolchain file.
Make sure glib-networking is installed, otherwise GIMP will not be able
to display the remote help pages through the help browser, nor will it
be able to open remote HTTPS (or other protocol using SSL/TLS) files.
HTTPS is becoming the expected standard and should not be considered
optional anymore.
'''
warning(glib_warning)
warnings += glib_warning
else # not meson.is_cross_build() or meson.can_run_host_binaries()
glib_networking_works_run = cc.run(
'''#include <gio/gio.h>
int main() {
return !g_tls_backend_supports_tls (g_tls_backend_get_default ());
}''',
dependencies: gio,
)
glib_networking_works = (glib_networking_works_run.compiled() and
glib_networking_works_run.returncode() == 0)
if not glib_networking_works and meson.is_cross_build()
# Since cross-platform test runs may be unreliable, let's be
# flexible and pass the test with a warning.
glib_networking_works = true
glib_warning = '''
The cross-platform test for glib-networking failed, using the
`exe_wrapper` set in your toolchain file.
Make sure glib-networking is installed, otherwise GIMP will not be able
to display the remote help pages through the help browser, nor will it
be able to open remote HTTPS (or other protocol using SSL/TLS) files.
HTTPS is becoming the expected standard and should not be considered
optional anymore.
'''
warning(glib_warning)
warnings += glib_warning
endif
endif
if not glib_networking_works
error('Test for glib-networking failed. This is required.')
endif
################################################################################
# Check if Pango is built with a recent fontconfig
pango_check = cc.links(
'''#include <fontconfig/fontconfig.h>
int main() {
FcObjectSet *os; os = FcObjectSetBuild (FC_FAMILY, FC_WIDTH);
}''',
dependencies: fontconfig,
)
if not pango_check
pango_warning = '\n *** '.join([
'You have a fontconfig >= fontconfig_required_version installed on your',
'system, but your Pango library is using an older version. This old version',
'is probably in /usr/X11R6. Look at the above output, and note that the',
'result for FONTCONFIG_CFLAGS is not in the result for PANGOCAIRO_CFLAGS,',
'and that there is likely an extra -I line, other than the ones for GLIB,',
'Freetype, and Pango itself. That\'s where your old fontconfig files are.',
'Rebuild pango, and make sure that it uses the newer fontconfig.',
'The easiest way be sure of this is to simply get rid of the old',
'fontconfig. When you rebuild pango, make sure the result for',
'FONTCONFIG_CFLAGS is the same as the result here.',
])
warning(pango_warning)
warnings += pango_warning
endif
################################################################################
# Optional Dependencies
libsocket = cc.find_library('socket', required: false)
conf.set('HAVE_LIBSOCKET', libsocket.found())
################################################################################
# Check for extension support
appstream_glib_minver = '0.7.7'
appstream_glib = dependency('appstream-glib', version: '>='+appstream_glib_minver)
libarchive = dependency('libarchive')
################################################################################
# Check for debug console (Win32)
if platform_windows
enable_win32_debug_console = get_option('win32-debug-console').enabled() or \
(get_option('win32-debug-console').auto() and (not stable or not release))
conf.set('ENABLE_WIN32_DEBUG_CONSOLE', enable_win32_debug_console)
# When we'll depend on meson >= 1.1.0, we can just use:
# conf.set('ENABLE_WIN32_DEBUG_CONSOLE', get_option('win32-debug-console').enable_auto_if(not stable or not release).enabled())
endif
################################################################################
# Check for 32-bit DLLs (Win32 64-bit)
if platform_windows and host_cpu_family == 'x86_64'
conf.set_quoted('WIN32_32BIT_DLL_FOLDER', get_option('win32-32bits-dll-folder'))
endif
################################################################################
# Check for detailed backtraces support
## Check for libbacktrace
if get_option('libbacktrace')
libbacktrace = cc.find_library('backtrace', required: false)
if libbacktrace.found()
libbacktrace_links = cc.links('''
#include <stddef.h>
#include <backtrace.h>
#include <backtrace-supported.h>
#if ! BACKTRACE_SUPPORTED
# error ! BACKTRACE_SUPPORTED
#endif
int main() {
(void) backtrace_create_state (NULL, 0, NULL, NULL);
return 0;
}
''',
dependencies: libbacktrace,
)
if not libbacktrace_links
warning(
'libbacktrace was found, but the test compilation failed.\n' +
'You can find more info in meson-logs/meson-logs.txt.'
)
libbacktrace = no_dep
endif
endif
else
libbacktrace = no_dep
endif
conf.set('HAVE_LIBBACKTRACE', libbacktrace.found())
## Check for libunwind
libunwind = ( get_option('libunwind')
? dependency('libunwind', version: '>=1.1.0', required: false)
: no_dep
)
conf.set('HAVE_LIBUNWIND', libunwind.found())
## Check for backtrace() API
# In musl, backtrace() is in the libexecinfo library.
# In glibc, it is internal (there we only need the header).
# So we look for both cases, so that we are able to link to libexecinfo
# if it exists. Cf. !455.
opt_execinfo = cc.find_library('execinfo', has_headers: ['execinfo.h'], required: false)
have_execinfo_h = opt_execinfo.found() or cc.has_header('execinfo.h')
conf.set('HAVE_EXECINFO_H', have_execinfo_h ? 1 : false)
# See app/core/gimpbacktrace-backend.h for supported platforms.
dashboard_backtrace='no (unsupported platform)'
if platform_windows
if have_x86
dashboard_backtrace='yes'
else
dashboard_backtrace='no (x86 only on Windows)'
endif
elif platform_linux
if not have_execinfo_h
dashboard_backtrace='no (missing: execinfo.h)'
elif not libbacktrace.found() and not libunwind.found()
dashboard_backtrace='rough (missing: libbacktrace and libunwind)'
elif not libbacktrace.found()
dashboard_backtrace='partially detailed (missing: libbacktrace)'
elif not libunwind.found()
dashboard_backtrace='partially detailed (missing: libunwind)'
else
dashboard_backtrace='detailed'
endif
endif
## Check for Dr. Mingw
drmingw = no_dep
if platform_windows
exchndl = cc.find_library('exchndl', required: false)
exchndl_fn = cc.has_function('ExcHndlSetLogFileNameW', dependencies: exchndl)
if exchndl.found() and exchndl_fn
drmingw = declare_dependency(dependencies: exchndl)
endif
endif
conf.set('HAVE_EXCHNDL', drmingw.found())
################################################################################
# Check for x11 support
x11_target = gtk3.get_variable(pkgconfig: 'targets').contains('x11')
x11 = x11_target ? dependency('x11') : no_dep
xmu = x11_target ? dependency('xmu') : no_dep
xext = x11_target ? dependency('xext') : no_dep
xfixes= x11_target ? dependency('xfixes') : no_dep
x11_deps = [ x11, xmu, xext, xfixes ]
conf.set('HAVE_XFIXES', xfixes.found())
if x11_target
foreach header : [ 'X11/Xmu/WinUtil.h', 'X11/extensions/shape.h', ]
if not cc.has_header(header, dependencies: [ xext, xmu ])
error('x11 install does not provide required header ' + header)
endif
endforeach
foreach function : [ 'XmuClientWindow', 'XShapeGetRectangles', ]
if not cc.has_function(function, dependencies: [ xext, xmu ])
error('x11 install does not provide required function ' + function)
endif
endforeach
endif
conf.set('HAVE_X11_EXTENSIONS_SHAPE_H',
x11_target and cc.has_header('X11/extensions/shape.h'))
conf.set('HAVE_X11_XMU_WINUTIL_H',
x11_target and cc.has_header('X11/Xmu/WinUtil.h'))
have_print = get_option('print')
# Features requiring x11
have_doc_shooter= x11_target
################################################################################
# Plugins (optional dependencies)
# The list of MIME types that are supported by plug-ins
MIMEtypes = [
'image/bmp',
'image/g3fax',
'image/gif',
'image/svg+xml',
'image/x-compressed-xcf',
'image/x-fits',
'image/x-gimp-gbr',
'image/x-gimp-gih',
'image/x-gimp-pat',
'image/x-pcx',
'image/x-portable-anymap',
'image/x-portable-bitmap',
'image/x-portable-graymap',
'image/x-portable-pixmap',
'image/x-psd',
'image/x-sgi',
'image/x-sun-raster',
'image/x-tga',
'image/x-xbitmap',
'image/x-xcf',
'image/x-xwindowdump',
]
libtiff_minver = '4.0.0'
libtiff = dependency('libtiff-4', version: '>=' + libtiff_minver)
MIMEtypes += 'image/tiff'
libjpeg = dependency('libjpeg')
MIMEtypes += 'image/jpeg'
zlib = dependency('zlib')
MIMEtypes += 'image/x-psp'
# Compiler-provided headers can't be found in crossroads environment
if not meson.is_cross_build()
bz2 = cc.find_library('bz2')
else
bz2 = dependency('bzip2')
endif
liblzma_minver = '5.0.0'
liblzma = dependency('liblzma', version: '>='+liblzma_minver)
ghostscript = cc.find_library('gs', required: get_option('ghostscript'))
if ghostscript.found()
MIMEtypes += 'application/postscript'
else
ghostscript = disabler()
endif
libpng_minver = '1.6.25'
libpng = dependency('libpng', version: '>='+libpng_minver)
MIMEtypes += [ 'image/png', 'image/x-icon']
libmng = dependency('libmng', required: get_option('mng'))
if not libmng.found()
libmng = cc.find_library('mng', required: get_option('mng'),)
mng_test_prefix = ''
if platform_windows
mng_test_prefix = '#define MNG_USE_DLL\n#include <libmng.h>'
endif
if libmng.found() and not cc.has_function('mng_create', dependencies: libmng,
prefix: mng_test_prefix)
libmng = no_dep
endif
endif
libaa = cc.find_library('aa', required: get_option('aa'))
libxpm = dependency('xpm', required: get_option('xpm'))
if libxpm.found()
MIMEtypes += 'image/x-xpixmap'
endif
have_qoi = cc.has_header('qoi.h')
if have_qoi
MIMEtypes += 'image/qoi'
endif
libiff = dependency('libiff', required: get_option('ilbm'))
libilbm = dependency('libilbm', required: get_option('ilbm'))
if libiff.found() and libilbm.found()
have_ilbm = true
else
have_ilbm = cc.has_header('libilbm/ilbm.h', required: get_option('ilbm'))
endif
if have_ilbm
MIMEtypes += 'image/x-ilbm'
endif
openexr_minver = '1.6.1'
openexr = dependency('OpenEXR', version: '>='+openexr_minver,
required: get_option('openexr')
)
if openexr.found()
MIMEtypes += 'image/x-exr'
endif
webp_minver = '0.6.0'
webp_libs = [
dependency('libwebp', version: '>='+webp_minver, required: get_option('webp')),
dependency('libwebpmux', version: '>='+webp_minver, required: get_option('webp')),
dependency('libwebpdemux',version: '>='+webp_minver, required: get_option('webp')),
]
webp_found = true
foreach lib : webp_libs
webp_found = webp_found and lib.found()
endforeach
if webp_found
MIMEtypes += [
'image/x-webp',
'image/webp'
]
endif
libheif_minver = '1.15.1'
libheif = dependency('libheif', version: '>='+libheif_minver,
required: get_option('heif')
)
can_import_heic = false
can_export_heic = false
can_import_avif = false
can_export_avif = false
have_heif = libheif.found()
if have_heif
have_heif = true
if meson.can_run_host_binaries()
can_import_heic = cc.run('''
#include <libheif/heif.h>
int main() {
int success;
heif_init (NULL);
success = heif_have_decoder_for_format (heif_compression_HEVC);
heif_deinit ();
if (success)
return 0;
else
return 1;
}
''',
dependencies: [ libheif ],
name: 'import HEIC').returncode() == 0
can_export_heic = cc.run('''
#include <libheif/heif.h>
int main() {
int success;
heif_init (NULL);
success = heif_have_encoder_for_format (heif_compression_HEVC);
heif_deinit ();
if (success)
return 0;
else
return 1;
}
''',
dependencies: [ libheif ],
name: 'export HEIC').returncode() == 0
can_import_avif = cc.run('''
#include <libheif/heif.h>
int main() {
int success;
heif_init (NULL);
success = heif_have_decoder_for_format (heif_compression_AV1);
heif_deinit ();
if (success)
return 0;
else
return 1;
}
''',
dependencies: [ libheif ],
name: 'import AVIF').returncode() == 0
can_export_avif = cc.run('''
#include <libheif/heif.h>
int main() {
int success;
heif_init (NULL);
success = heif_have_encoder_for_format (heif_compression_AV1);
heif_deinit ();
if (success)
return 0;
else
return 1;
}
''',
dependencies: [ libheif ],
name: 'export AVIF').returncode() == 0
else
# When cross-compiling and we can't run our test binaries.
can_import_heic = true
can_export_heic = true
can_import_avif = true
can_export_avif = true
endif
if not can_import_heic and not can_import_avif
have_heif = false
endif
if have_heif
# Listing support for both HEIC and AVIF if we build with HEIF support,
# because codecs can be added at any time later and we won't be able to edit
# the desktop file once it's installed. See discussion in #9080.
MIMEtypes += [
'image/heif',
'image/heic',
'image/avif'
]
endif
endif
have_vala = add_languages('vala', required: get_option('vala'), native: false)
if have_vala
babl = declare_dependency(
dependencies: [
babl,
meson.get_compiler('vala').find_library('babl-0.1'),
]
)
# TODO: remove this once we release 3.0
valac = meson.get_compiler('vala')
if valac.version().version_compare('>= 0.31.1')
add_project_arguments('--disable-since-check', language: 'vala')
endif
endif
# We disable WebkitGTK as default for now and discourage its use because
# it is just a horror to build, is not available on Windows anymore
# (AFAIK), and features brought are not worth the pain. We still leave
# the code because mitch wants us to be able to look at it later, maybe
# reinstate it through some shape or another. Yet for now, it is to be
# considered non-existing feature for packager point of view. It is only
# there in the hope developers get it back in shape.
webkit_minver = '2.20.3'
if get_option('webkit-unmaintained')
webkit = dependency('webkit2gtk-4.0', version: '>=' + webkit_minver)
endif
conf.set('HAVE_WEBKIT', get_option('webkit-unmaintained'))
poppler_minver = '0.69.0'
poppler_data_minver = '0.4.9'
poppler = [
dependency('poppler-glib', version: '>='+poppler_minver),
dependency('poppler-data', version: '>='+poppler_data_minver),
]
cairopdf_minver = '1.12.2'
cairopdf = dependency('cairo-pdf', version: '>='+cairopdf_minver,
required: get_option('cairo-pdf')
)
# PDF import support is a granted feature.
MIMEtypes += 'application/pdf'
wmf_minver = '0.2.8'
wmf = dependency('libwmf', version: '>='+wmf_minver,
required: get_option('wmf')
)
if wmf.found()
MIMEtypes += 'image/x-wmf'
endif
openjpeg_minver = '2.1.0'
openjpeg = dependency('libopenjp2', version: '>='+openjpeg_minver,
required: get_option('jpeg2000')
)
if openjpeg.found()
MIMEtypes += [ 'image/jp2', 'image/jpeg2000', 'image/jpx', ]
endif
jpegxl_minver = '0.7.0'
libjxl = dependency('libjxl',
version: '>='+jpegxl_minver,
required: get_option('jpeg-xl')
)
libjxl_threads = dependency('libjxl_threads',
version: '>='+jpegxl_minver,
required: get_option('jpeg-xl')