Radix cross Linux

The main Radix cross Linux repository contains the build scripts of packages, which have the most complete and common functionality for desktop machines

452 Commits   2 Branches   1 Tag
   362         kx project('gimp',
   362         kx   'c', 'cpp',
   362         kx   version: '2.99.16',
   362         kx   meson_version: '>=0.59.0',
   362         kx   default_options: [
   362         kx     'cpp_std=gnu++14',
   362         kx     'buildtype=debugoptimized',
   362         kx   ],
   362         kx )
   362         kx 
   362         kx project_url = 'https://gitlab.gnome.org/GNOME/gimp'
   362         kx project_url_issues = project_url + '/issues/new'
   362         kx 
   362         kx conf = configuration_data()
   362         kx 
   362         kx warnings = []
   362         kx 
   362         kx ################################################################################
   362         kx # Project info
   362         kx 
   362         kx prettyname = 'GIMP'
   362         kx full_name  = 'GNU Image Manipulation Program'
   362         kx 
   362         kx # General version
   362         kx gimp_version = meson.project_version()
   362         kx 
   362         kx package_string= prettyname + ' ' + gimp_version
   362         kx 
   362         kx gimp_app_version_arr = gimp_version.split('.')
   362         kx gimp_app_version_major = gimp_app_version_arr[0].to_int()
   362         kx gimp_app_version_minor = gimp_app_version_arr[1].to_int()
   362         kx gimp_app_version_micro = gimp_app_version_arr[2].to_int()
   362         kx 
   362         kx # Override for Release-candidates
   362         kx gimp_app_version = '@0@.@1@'.format(
   362         kx   gimp_app_version_major,
   362         kx   gimp_app_version_minor
   362         kx )
   362         kx 
   362         kx 
   362         kx # API & pkg-config version
   362         kx api_version_major = gimp_app_version_major
   362         kx api_version_minor = gimp_app_version_minor
   362         kx 
   362         kx if api_version_minor == 99
   362         kx   api_version_major += 1
   362         kx   api_version_minor = 0
   362         kx endif
   362         kx 
   362         kx gimp_api_version = '@0@.@1@'.format(api_version_major, api_version_minor)
   362         kx gimp_api_name = 'gimp-' + gimp_api_version
   362         kx 
   362         kx 
   362         kx # Libtool versioning
   362         kx gimp_interface_age = 16
   362         kx 
   362         kx gimp_binary_age = 100 * gimp_app_version_minor + gimp_app_version_micro
   362         kx lt_current      = 100 * gimp_app_version_minor + gimp_app_version_micro - gimp_interface_age
   362         kx lt_revision     = gimp_interface_age
   362         kx lt_age          = gimp_binary_age - gimp_interface_age
   362         kx 
   362         kx # libtool's -version-info transforms "current:revision:age" into "(current - age).age.revision".
   362         kx # Let's compute this ourselves.
   362         kx so_version = '@0@.@1@.@2@'.format(lt_current - lt_age, lt_age, lt_revision)
   362         kx 
   362         kx 
   362         kx gimp_command  = 'gimp-' + gimp_app_version
   362         kx 
   362         kx gettext_package= 'gimp@0@@1@'.format(api_version_major, api_version_minor)
   362         kx conf.set_quoted('GETTEXT_PACKAGE', gettext_package)
   362         kx 
   362         kx conf.set_quoted('GIMP_VERSION', gimp_version)
   362         kx 
   362         kx # GIMP_UNSTABLE tells if we are on an unstable or stable development branch.
   362         kx stable = (gimp_app_version_minor % 2 == 0)
   362         kx conf.set('GIMP_UNSTABLE', stable ? false : 1)
   362         kx 
   362         kx # GIMP_RELEASE tells if this is a release or in-between release (git) code.
   362         kx release = (gimp_app_version_micro % 2 == 0)
   362         kx conf.set('GIMP_RELEASE', release ? 1 : false)
   362         kx 
   362         kx versionconfig = configuration_data()
   362         kx versionconfig.set('GIMP_FULL_NAME',     full_name)
   362         kx versionconfig.set('GIMP_MAJOR_VERSION', gimp_app_version_major)
   362         kx versionconfig.set('GIMP_MINOR_VERSION', gimp_app_version_minor)
   362         kx versionconfig.set('GIMP_MICRO_VERSION', gimp_app_version_micro)
   362         kx versionconfig.set('GIMP_VERSION',       gimp_version)
   362         kx versionconfig.set('GIMP_API_VERSION',   gimp_api_version)
   362         kx 
   362         kx 
   362         kx ################################################################################
   362         kx # Get configuration and Meson modules
   362         kx 
   362         kx pkgconfig = import('pkgconfig')
   362         kx i18n      = import('i18n')
   362         kx gnome     = import('gnome')
   362         kx pythonmod = import('python')
   362         kx simd      = import('unstable-simd')
   362         kx fs        = import('fs')
   362         kx 
   362         kx cc        = meson.get_compiler('c')
   362         kx cxx       = meson.get_compiler('cpp')
   362         kx prefix    = get_option('prefix')
   362         kx buildtype = get_option('buildtype')
   362         kx exec_ver  = '-' + gimp_app_version
   362         kx 
   362         kx compiler_args = []
   362         kx linker_args = []
   362         kx 
   362         kx ################################################################################
   362         kx # Host system detection
   362         kx 
   362         kx host_cpu_family = host_machine.cpu_family()
   362         kx message('Host machine cpu family: ' + host_cpu_family)
   362         kx 
   362         kx host_cpu_family = host_machine.cpu_family()
   362         kx if   host_cpu_family == 'x86'
   362         kx   have_x86 = true
   362         kx   conf.set10('ARCH_X86',    true)
   362         kx elif host_cpu_family == 'x86_64'
   362         kx   have_x86 = true
   362         kx   conf.set10('ARCH_X86',    true)
   362         kx   conf.set10('ARCH_X86_64', true)
   362         kx elif host_cpu_family == 'ppc'
   362         kx   have_ppc = true
   362         kx   conf.set10('ARCH_PPC',    true)
   362         kx elif host_cpu_family == 'ppc64'
   362         kx   have_ppc = true
   362         kx   conf.set10('ARCH_PPC',    true)
   362         kx   conf.set10('ARCH_PPC64',  true)
   362         kx endif
   362         kx 
   362         kx 
   362         kx host_os = host_machine.system().to_lower()
   362         kx message('Host os: ' + host_os)
   362         kx 
   362         kx platform_linux = (
   362         kx   host_os.contains('linux')
   362         kx )
   362         kx 
   362         kx platform_windows = (
   362         kx   host_os.contains('mingw') or
   362         kx   host_os.contains('cygwin') or
   362         kx   host_os.contains('windows')
   362         kx )
   362         kx 
   362         kx platform_osx = (
   362         kx   host_os.contains('machten') or
   362         kx   host_os.contains('rhapsody') or
   362         kx   host_os.contains('darwin')
   362         kx )
   362         kx 
   362         kx if platform_osx
   362         kx   conf.set('PLATFORM_OSX', 1)
   362         kx endif
   362         kx 
   362         kx if platform_windows
   362         kx   windows = import('windows')
   362         kx   # AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
   362         kx   # AM_CONDITIONAL(MS_LIB_AVAILABLE, test "x$ms_librarian" = xyes)
   362         kx   # compiler_args += '-Wl,--large-address-aware'
   362         kx endif
   362         kx 
   362         kx # on OSX ObjC and C sources are mixed so adding objc to the linkflags
   362         kx 
   362         kx osx_ldflags = []
   362         kx if platform_osx
   362         kx   add_languages('objc')
   362         kx   osx_ldflags += ['-Wl,-framework,Foundation', '-Wl,-framework,AppKit', '-ObjC']
   362         kx   add_project_link_arguments(osx_ldflags, language : ['objc', 'c'])
   362         kx endif
   362         kx 
   362         kx if cc.get_id() == 'gcc' and cc.version() == '7.2.0'
   362         kx   gcc_warning = '''
   362         kx     GCC 7.2.0 has a serious bug affecting GEGL/GIMP. We advise
   362         kx     against using this version of the compiler (previous and
   362         kx     further versions are fine).
   362         kx     See https://bugzilla.gnome.org/show_bug.cgi?id=787222
   362         kx   '''
   362         kx   warning(gcc_warning)
   362         kx   warnings += gcc_warning
   362         kx endif
   362         kx 
   362         kx 
   362         kx 
   362         kx ################################################################################
   362         kx # Compiler CPU extensions for optimizations
   362         kx #
   362         kx # -- Don't enable these flags project-wide, only files needing them
   362         kx # should be built with a given extension, which we do with meson simd
   362         kx # module. Otherwise GIMP would end up crashing when run on CPUs which
   362         kx # don't support all the flags supported by the compiler.
   362         kx # See merge request !262 for more details.
   362         kx 
   362         kx # Note that Meson has a SIMD module which can also do this for us, but it uses
   362         kx # its own #defines and we want to stay compatible with the autotools build
   362         kx conf.set('USE_MMX', cc.has_argument('-mmmx'))
   362         kx conf.set('USE_SSE', cc.has_argument('-msse'))
   362         kx conf.set10('COMPILE_SSE2_INTRINISICS', cc.has_argument('-msse2'))
   362         kx conf.set10('COMPILE_SSE4_1_INTRINISICS', cc.has_argument('-msse4.1'))
   362         kx 
   362         kx if host_cpu_family == 'ppc'
   362         kx   altivec_args = cc.get_supported_arguments([
   362         kx     '-faltivec',
   362         kx     '-maltivec',
   362         kx     '-mabi=altivec',
   362         kx   ])
   362         kx 
   362         kx   if altivec_args != []
   362         kx     if host_os.contains('darwin')
   362         kx       conf.set('USE_ALTIVEC', true)
   362         kx       conf.set('HAVE_ALTIVEC_SYSCTL', true)
   362         kx     elif cc.compiles('''
   362         kx       int main() { asm ("vand %v0, %v0, %v0"); return 0; }
   362         kx       ''')
   362         kx       conf.set('USE_ALTIVEC', true)
   362         kx     endif
   362         kx   endif
   362         kx endif
   362         kx 
   362         kx 
   362         kx ################################################################################
   362         kx # CFlags
   362         kx 
   362         kx 
   362         kx if get_option('profiling') and cc.get_id() == 'gcc'
   362         kx   compiler_args += '-pg'
   362         kx   linker_args   += '-pg'
   362         kx endif
   362         kx 
   362         kx if get_option('ansi')
   362         kx   compiler_args += [ '-ansi', '-pedantic']
   362         kx endif
   362         kx 
   362         kx warning_cflags_common = [
   362         kx   '-fdiagnostics-show-option',
   362         kx   '-fno-common',
   362         kx 
   362         kx   '-Wformat',
   362         kx   '-Wformat-security',
   362         kx   '-Winit-self',
   362         kx   '-Wlogical-op',
   362         kx   '-Wmissing-declarations',
   362         kx   '-Wmissing-format-attribute',
   362         kx   '-Wpointer-arith',
   362         kx   '-Wreturn-type',
   362         kx   '-Wtype-limits',
   362         kx ]
   362         kx warning_cflags_c = [
   362         kx   '-Wabsolute-value',
   362         kx   '-Wdeclaration-after-statement',
   362         kx   '-Wenum-conversion',
   362         kx   '-Wliteral-conversion',
   362         kx   '-Wno-strict-prototypes',
   362         kx   '-Wold-style-definition',
   362         kx   '-Wparentheses-equality',
   362         kx   '-W#pragma-messages',
   362         kx   '-Wsometimes-uninitialized',
   362         kx   '-Wtautological-unsigned-enum-zero-compare',
   362         kx   '-Wunneeded-internal-declaration',
   362         kx   '-Wunused-function',
   362         kx   '-Wunused-value',
   362         kx 
   362         kx   '-Werror=implicit-function-declaration',
   362         kx ]
   362         kx warning_cflags_cpp = [
   362         kx ]
   362         kx 
   362         kx compiler_args += cc.get_supported_arguments(warning_cflags_common)
   362         kx add_project_arguments(cc .get_supported_arguments(warning_cflags_c),   language: 'c')
   362         kx add_project_arguments(cxx.get_supported_arguments(warning_cflags_cpp), language: 'cpp')
   362         kx 
   362         kx 
   362         kx # Ensure MSVC-compatible struct packing convention is used when
   362         kx # compiling for Win32 with gcc.
   362         kx if platform_windows and cc.get_id() == 'gcc'
   362         kx   msvc_compat_args = cc.first_supported_argument([
   362         kx     '-fnative-struct',
   362         kx     '-mms-bitfields',
   362         kx   ])
   362         kx   if msvc_compat_args == []
   362         kx     error('''
   362         kx       GCC does not support '-fnative-struct' nor '-mms-bitfields'.
   362         kx       Build will be incompatible with GTK DLLs.
   362         kx     ''')
   362         kx   endif
   362         kx   compiler_args += msvc_compat_args
   362         kx endif
   362         kx 
   362         kx 
   362         kx conf.set('HAVE__NL_MEASUREMENT_MEASUREMENT',
   362         kx   cc.compiles('''
   362         kx     #include<langinfo.h>
   362         kx     int main() {
   362         kx       char c = *((unsigned char *)  nl_langinfo(_NL_MEASUREMENT_MEASUREMENT));
   362         kx     }
   362         kx   ''')
   362         kx )
   362         kx 
   362         kx conf.set('HAVE__NL_IDENTIFICATION_LANGUAGE',
   362         kx   cc.compiles('''
   362         kx     #include<langinfo.h>
   362         kx     int main() {
   362         kx       char c = *((unsigned char *) nl_langinfo(_NL_IDENTIFICATION_LANGUAGE));
   362         kx     }
   362         kx   ''')
   362         kx )
   362         kx 
   362         kx 
   362         kx ################################################################################
   362         kx # Dependencies
   362         kx no_dep = dependency('', required: false)
   362         kx 
   362         kx ################################################################################
   362         kx # Mandatory Dependencies
   362         kx 
   362         kx if get_option('relocatable-bundle') == 'yes'
   362         kx   relocatable_bundle = true
   362         kx elif get_option('relocatable-bundle') == 'no'
   362         kx   relocatable_bundle = false
   362         kx else # == 'platform-default'
   362         kx   # By default, assume building for Windows or macOS everything to be on
   362         kx   # the same prefix and can be relocated.
   362         kx   # On other platforms, build-time paths are meaningful.
   362         kx   if platform_windows or platform_osx
   362         kx       relocatable_bundle = true
   362         kx   else
   362         kx       relocatable_bundle = false
   362         kx   endif
   362         kx endif
   362         kx conf.set('ENABLE_RELOCATABLE_RESOURCES', relocatable_bundle)
   362         kx 
   362         kx 
   362         kx math              = cc.find_library('m')
   362         kx # libdl is only required on Linux. On Windows and some (all?) BSD, it
   362         kx # doesn't exist, but the API exists in libc by default (see #8604). On
   362         kx # macOS, it apparently exists but linking it explicitly is actually
   362         kx # unneeded as well.
   362         kx dl                = cc.find_library('dl', required: platform_linux)
   362         kx rpc               = platform_windows ? cc.find_library('rpcrt4') : no_dep
   362         kx dbghelp           = platform_windows ? cc.find_library('dbghelp') : no_dep
   362         kx winsock           = platform_windows ? cc.find_library('ws2_32') : no_dep
   362         kx mscms             = platform_windows ? cc.find_library('mscms') : no_dep
   362         kx atk_minver        = '2.4.0'
   362         kx atk               = dependency('atk',                version: '>='+atk_minver)
   362         kx babl_minver       = '0.1.98'
   362         kx babl              = dependency('babl-0.1',           version: '>='+babl_minver, required: false)
   362         kx if not babl.found()
   362         kx   # babl changed its pkg-config name from 'babl' to 'babl-0.1' in version
   362         kx   # 0.1.100 (0.1.99 dev cycle more exactly). 'babl-0.1' is checked in priority
   362         kx   # because it would be a newer version.
   362         kx   babl            = dependency('babl',               version: '>='+babl_minver)
   362         kx endif
   362         kx cairo_minver      = '1.14.0'
   362         kx cairo             = dependency('cairo',              version: '>='+cairo_minver)
   362         kx 
   362         kx # fontconfig_name   = platform_windows ? 'fontconfig_win32' : 'fontconfig'
   362         kx fontconfig_name   = 'fontconfig'
   362         kx fontconfig_minver = '2.12.4'
   362         kx fontconfig        = dependency(fontconfig_name,      version: '>='+fontconfig_minver)
   362         kx freetype2_minver  = '2.1.7'
   362         kx freetype2         = dependency('freetype2',          version: '>='+freetype2_minver)
   362         kx gdk_pixbuf_minver = '2.30.8'
   362         kx gdk_pixbuf        = dependency('gdk-pixbuf-2.0',     version: '>='+gdk_pixbuf_minver)
   362         kx gegl_minver       = '0.4.46'
   362         kx gegl              = dependency('gegl-0.4',           version: '>='+gegl_minver)
   362         kx exiv2_minver      = '0.27.4'
   362         kx exiv2             = dependency('exiv2',              version: '>='+exiv2_minver)
   362         kx gexiv2_minver     = '0.14.0'
   362         kx gexiv2            = dependency('gexiv2',             version: '>='+gexiv2_minver)
   362         kx 
   362         kx gio               = dependency('gio-2.0')
   362         kx gio_specific_name = platform_windows ? 'gio-windows-2.0' : 'gio-unix-2.0'
   362         kx gio_specific      = dependency(gio_specific_name)
   362         kx 
   362         kx glib_minver       = '2.70.0'
   362         kx glib              = dependency('glib-2.0',           version: '>='+glib_minver)
   362         kx gi                = dependency('gobject-introspection-1.0')
   362         kx 
   362         kx conf.set('G_DISABLE_DEPRECATED', glib.version().version_compare('>=2.57'))
   362         kx 
   362         kx gobject           = dependency('gobject-2.0',        version: '>='+glib_minver)
   362         kx gmodule           = dependency('gmodule-no-export-2.0')
   362         kx 
   362         kx gtk3_minver       = '3.24.0'
   362         kx gtk3              = dependency('gtk+-3.0',           version: '>='+gtk3_minver)
   362         kx harfbuzz_minver   = '1.0.5'
   362         kx harfbuzz          = dependency('harfbuzz',           version: '>='+harfbuzz_minver)
   362         kx json_glib         = dependency('json-glib-1.0',      version: '>=1.2.6')
   362         kx lcms_minver       = '2.8'
   362         kx lcms              = dependency('lcms2',              version: '>='+lcms_minver)
   362         kx libmypaint_minver = '1.3.0'
   362         kx libmypaint        = dependency('libmypaint',         version: '>='+libmypaint_minver)
   362         kx mypaint_brushes   = dependency('mypaint-brushes-1.0',version: '>='+libmypaint_minver)
   362         kx if not libmypaint.version().version_compare('>=1.4.0')
   362         kx   libmypaint_warning='''
   362         kx 
   362         kx         libmypaint lower than version 1.4.0 is known to crash when
   362         kx         parsing MyPaint 2 brushes. Please update.
   362         kx     '''
   362         kx     warning(libmypaint_warning)
   362         kx     warnings += libmypaint_warning
   362         kx endif
   362         kx 
   362         kx 
   362         kx if relocatable_bundle
   362         kx   mypaint_brushes_dir = '${gimp_installation_dir}'\
   362         kx                         /'share'/'mypaint-data'/'1.0'/'brushes'
   362         kx else
   362         kx   mypaint_brushes_dir = mypaint_brushes.get_variable(pkgconfig: 'brushesdir')
   362         kx endif
   362         kx 
   362         kx conf.set_quoted('MYPAINT_BRUSHES_DIR', mypaint_brushes_dir)
   362         kx 
   362         kx pangocairo_minver = '1.44.0'
   362         kx pangocairo        = dependency('pangocairo',         version: '>='+pangocairo_minver)
   362         kx pangoft2          = dependency('pangoft2',           version: '>=1.29.4')
   362         kx rsvg_minver       = '2.40.6'
   362         kx rsvg              = dependency('librsvg-2.0',        version: '>='+rsvg_minver)
   362         kx 
   362         kx conf.set('PANGO_DISABLE_DEPRECATED',pangocairo.version().version_compare('<1.43'))
   362         kx 
   362         kx 
   362         kx ################################################################################
   362         kx # Check for GLib Networking
   362         kx 
   362         kx glib_networking_works_run=false
   362         kx glib_networking_works = true
   362         kx 
   362         kx if not glib_networking_works
   362         kx   error('Test for glib-networking failed. This is required.')
   362         kx endif
   362         kx 
   362         kx ################################################################################
   362         kx # Check if Pango is built with a recent fontconfig
   362         kx 
   362         kx pango_check = cc.links(
   362         kx   '''#include <fontconfig/fontconfig.h>
   362         kx   int main() {
   362         kx     FcObjectSet *os; os = FcObjectSetBuild (FC_FAMILY, FC_WIDTH);
   362         kx   }''',
   362         kx   dependencies: fontconfig,
   362         kx )
   362         kx 
   362         kx if not pango_check
   362         kx   pango_warning = '\n  *** '.join([
   362         kx   'You have a fontconfig >= fontconfig_required_version installed on your',
   362         kx   'system, but your Pango library is using an older version. This old version',
   362         kx   'is probably in /usr/X11R6. Look at the above output, and note that the',
   362         kx   'result for FONTCONFIG_CFLAGS is not in the result for PANGOCAIRO_CFLAGS,',
   362         kx   'and that there is likely an extra -I line, other than the ones for GLIB,',
   362         kx   'Freetype, and Pango itself. That\'s where your old fontconfig files are.',
   362         kx   'Rebuild pango, and make sure that it uses the newer fontconfig.',
   362         kx   'The easiest way be sure of this is to simply get rid of the old',
   362         kx   'fontconfig. When you rebuild pango, make sure the result for',
   362         kx   'FONTCONFIG_CFLAGS is the same as the result here.',
   362         kx   ])
   362         kx   warning(pango_warning)
   362         kx   warnings += pango_warning
   362         kx endif
   362         kx 
   362         kx ################################################################################
   362         kx # Optional Dependencies
   362         kx 
   362         kx libsocket         = cc.find_library('socket', required: false)
   362         kx conf.set('HAVE_LIBSOCKET', libsocket.found())
   362         kx 
   362         kx ################################################################################
   362         kx # Check for extension support
   362         kx 
   362         kx appstream_glib_minver = '0.7.7'
   362         kx appstream_glib = dependency('appstream-glib', version: '>='+appstream_glib_minver)
   362         kx 
   362         kx libarchive = dependency('libarchive')
   362         kx 
   362         kx 
   362         kx ################################################################################
   362         kx # Check for debug console (Win32)
   362         kx 
   362         kx if platform_windows
   362         kx   conf.set('ENABLE_WIN32_DEBUG_CONSOLE', get_option('win32-debug-console'))
   362         kx endif
   362         kx 
   362         kx ################################################################################
   362         kx # Check for 32-bit DLLs (Win32 64-bit)
   362         kx 
   362         kx if platform_windows and host_cpu_family == 'x86_64'
   362         kx   conf.set_quoted('WIN32_32BIT_DLL_FOLDER', get_option('win32-32bits-dll-folder'))
   362         kx endif
   362         kx 
   362         kx ################################################################################
   362         kx # Check for detailed backtraces support
   362         kx 
   362         kx ## Check for libbacktrace
   362         kx 
   362         kx if get_option('libbacktrace')
   362         kx   libbacktrace = cc.find_library('backtrace', required: false)
   362         kx 
   362         kx   if libbacktrace.found()
   362         kx     libbacktrace_links = cc.links('''
   362         kx         #include <stddef.h>
   362         kx         #include <backtrace.h>
   362         kx         #include <backtrace-supported.h>
   362         kx 
   362         kx         #if ! BACKTRACE_SUPPORTED
   362         kx         #   error ! BACKTRACE_SUPPORTED
   362         kx         #endif
   362         kx 
   362         kx         int main() {
   362         kx           (void) backtrace_create_state (NULL, 0, NULL, NULL);
   362         kx           return 0;
   362         kx         }
   362         kx       ''',
   362         kx       dependencies: libbacktrace,
   362         kx     )
   362         kx 
   362         kx     if not libbacktrace_links
   362         kx       warning(
   362         kx         'libbacktrace was found, but the test compilation failed.\n' +
   362         kx         'You can find more info in meson-logs/meson-logs.txt.'
   362         kx       )
   362         kx       libbacktrace = no_dep
   362         kx     endif
   362         kx 
   362         kx   endif
   362         kx else
   362         kx   libbacktrace = no_dep
   362         kx endif
   362         kx conf.set('HAVE_LIBBACKTRACE', libbacktrace.found())
   362         kx 
   362         kx ## Check for libunwind
   362         kx libunwind = ( get_option('libunwind')
   362         kx   ? dependency('libunwind', version: '>=1.1.0', required: false)
   362         kx   : no_dep
   362         kx )
   362         kx conf.set('HAVE_LIBUNWIND', libunwind.found())
   362         kx 
   362         kx 
   362         kx ## Check for Dr. Mingw
   362         kx drmingw = no_dep
   362         kx if platform_windows
   362         kx   exchndl = cc.find_library('exchndl', required: false)
   362         kx   exchndl_fn = cc.has_function('ExcHndlSetLogFileNameW', dependencies: exchndl)
   362         kx   if exchndl.found() and exchndl_fn
   362         kx     drmingw = declare_dependency(dependencies: exchndl)
   362         kx   endif
   362         kx endif
   362         kx conf.set('HAVE_EXCHNDL', drmingw.found())
   362         kx 
   362         kx 
   362         kx detailed_backtraces = (
   362         kx   libbacktrace.found() or
   362         kx   libunwind.found() or
   362         kx   drmingw.found()
   362         kx )
   362         kx 
   362         kx ################################################################################
   362         kx # Check for x11 support
   362         kx 
   362         kx x11_target = gtk3.get_variable(pkgconfig: 'targets').contains('x11')
   362         kx 
   362         kx x11   = x11_target ? dependency('x11')    : no_dep
   362         kx xmu   = x11_target ? dependency('xmu')    : no_dep
   362         kx xext  = x11_target ? dependency('xext')   : no_dep
   362         kx xfixes= x11_target ? dependency('xfixes') : no_dep
   362         kx x11_deps = [ x11, xmu, xext, xfixes ]
   362         kx conf.set('HAVE_XFIXES', xfixes.found())
   362         kx 
   362         kx if x11_target
   362         kx   foreach header : [ 'X11/Xmu/WinUtil.h', 'X11/extensions/shape.h', ]
   362         kx     if not cc.has_header(header, dependencies: [ xext, xmu ])
   362         kx       error('x11 install does not provide required header ' + header)
   362         kx     endif
   362         kx   endforeach
   362         kx 
   362         kx   foreach function : [ 'XmuClientWindow', 'XShapeGetRectangles', ]
   362         kx     if not cc.has_function(function, dependencies: [ xext, xmu ])
   362         kx       error('x11 install does not provide required function ' + function)
   362         kx     endif
   362         kx   endforeach
   362         kx endif
   362         kx conf.set('HAVE_X11_EXTENSIONS_SHAPE_H',
   362         kx   x11_target and cc.has_header('X11/extensions/shape.h'))
   362         kx conf.set('HAVE_X11_XMU_WINUTIL_H',
   362         kx   x11_target and cc.has_header('X11/Xmu/WinUtil.h'))
   362         kx 
   362         kx 
   362         kx have_print = get_option('print')
   362         kx 
   362         kx # Features requiring x11
   362         kx 
   362         kx have_doc_shooter= x11_target
   362         kx 
   362         kx ################################################################################
   362         kx # Plugins (optional dependencies)
   362         kx 
   362         kx # The list of MIME types that are supported by plug-ins
   362         kx MIMEtypes = [
   362         kx   'image/bmp',
   362         kx   'image/g3fax',
   362         kx   'image/gif',
   362         kx   'image/svg+xml',
   362         kx   'image/x-compressed-xcf',
   362         kx   'image/x-fits',
   362         kx   'image/x-gimp-gbr',
   362         kx   'image/x-gimp-gih',
   362         kx   'image/x-gimp-pat',
   362         kx   'image/x-pcx',
   362         kx   'image/x-portable-anymap',
   362         kx   'image/x-portable-bitmap',
   362         kx   'image/x-portable-graymap',
   362         kx   'image/x-portable-pixmap',
   362         kx   'image/x-psd',
   362         kx   'image/x-sgi',
   362         kx   'image/x-sun-raster',
   362         kx   'image/x-tga',
   362         kx   'image/x-xbitmap',
   362         kx   'image/x-xcf',
   362         kx   'image/x-xwindowdump',
   362         kx ]
   362         kx 
   362         kx 
   362         kx 
   362         kx libtiff_minver = '4.0.0'
   362         kx libtiff = dependency('libtiff-4', version: '>=' + libtiff_minver)
   362         kx MIMEtypes += 'image/tiff'
   362         kx 
   362         kx 
   362         kx libjpeg = dependency('libjpeg')
   362         kx MIMEtypes += 'image/jpeg'
   362         kx 
   362         kx 
   362         kx zlib = dependency('zlib')
   362         kx MIMEtypes += 'image/x-psp'
   362         kx 
   362         kx bz2 = cc.find_library('bz2')
   362         kx 
   362         kx liblzma_minver = '5.0.0'
   362         kx liblzma = dependency('liblzma', version: '>='+liblzma_minver)
   362         kx 
   362         kx 
   362         kx ghostscript = cc.find_library('gs', required: get_option('ghostscript'))
   362         kx if ghostscript.found()
   362         kx   MIMEtypes += 'application/postscript'
   362         kx else
   362         kx   ghostscript = disabler()
   362         kx endif
   362         kx 
   362         kx libpng_minver = '1.6.25'
   362         kx libpng = dependency('libpng', version: '>='+libpng_minver)
   362         kx MIMEtypes += [ 'image/png', 'image/x-icon']
   362         kx 
   362         kx libmng = dependency('libmng', required: get_option('mng'))
   362         kx 
   362         kx if not libmng.found()
   362         kx   libmng = cc.find_library('mng', required: get_option('mng'),)
   362         kx 
   362         kx   mng_test_prefix = ''
   362         kx   if platform_windows
   362         kx     mng_test_prefix = '#define MNG_USE_DLL\n#include <libmng.h>'
   362         kx   endif
   362         kx   if libmng.found() and not cc.has_function('mng_create', dependencies: libmng,
   362         kx                                             prefix: mng_test_prefix)
   362         kx     libmng = no_dep
   362         kx   endif
   362         kx endif
   362         kx 
   362         kx libaa = cc.find_library('aa', required: get_option('aa'))
   362         kx 
   362         kx libxpm = dependency('xpm', required: get_option('xpm'))
   362         kx if libxpm.found()
   362         kx   MIMEtypes += 'image/x-xpixmap'
   362         kx endif
   362         kx 
   362         kx have_qoi = cc.has_header('qoi.h')
   362         kx if have_qoi
   362         kx   MIMEtypes += 'image/qoi'
   362         kx endif
   362         kx 
   362         kx have_ilbm = cc.has_header('libilbm/ilbm.h')
   362         kx if have_ilbm
   362         kx   MIMEtypes += 'image/x-ilbm'
   362         kx endif
   362         kx 
   362         kx openexr_minver = '1.6.1'
   362         kx openexr = dependency('OpenEXR', version: '>='+openexr_minver,
   362         kx   required: get_option('openexr')
   362         kx )
   362         kx if openexr.found()
   362         kx   MIMEtypes += 'image/x-exr'
   362         kx endif
   362         kx 
   362         kx webp_minver = '0.6.0'
   362         kx webp_libs = [
   362         kx   dependency('libwebp',     version: '>='+webp_minver, required: get_option('webp')),
   362         kx   dependency('libwebpmux',  version: '>='+webp_minver, required: get_option('webp')),
   362         kx   dependency('libwebpdemux',version: '>='+webp_minver, required: get_option('webp')),
   362         kx ]
   362         kx webp_found = true
   362         kx foreach lib : webp_libs
   362         kx   webp_found = webp_found and  lib.found()
   362         kx endforeach
   362         kx 
   362         kx if webp_found
   362         kx   MIMEtypes += [
   362         kx     'image/x-webp',
   362         kx     'image/webp'
   362         kx   ]
   362         kx endif
   362         kx 
   362         kx libheif_minver = '1.3.2'
   362         kx libheif = dependency('libheif', version: '>='+libheif_minver,
   362         kx   required: get_option('heif')
   362         kx )
   362         kx conf.set('HAVE_LIBHEIF_1_4_0', libheif.version().version_compare('>=1.4.0'))
   362         kx conf.set('HAVE_LIBHEIF_1_6_0', libheif.version().version_compare('>=1.6.0'))
   362         kx 
   362         kx can_import_heic = false
   362         kx can_export_heic = false
   362         kx can_import_avif = false
   362         kx can_export_avif = false
   362         kx 
   362         kx have_heif = libheif.found()
   362         kx libheif_warning=''
   362         kx if have_heif
   362         kx   have_heif = true
   362         kx 
   362         kx   if meson.can_run_host_binaries()
   362         kx     can_import_heic = cc.run('''
   362         kx     #include <libheif/heif.h>
   362         kx     int main() {
   362         kx       int success;
   362         kx       #if LIBHEIF_HAVE_VERSION(1,13,0)
   362         kx       heif_init (NULL);
   362         kx       #endif
   362         kx       success = heif_have_decoder_for_format (heif_compression_HEVC);
   362         kx       #if LIBHEIF_HAVE_VERSION(1,13,0)
   362         kx       heif_deinit ();
   362         kx       #endif
   362         kx 
   362         kx       if (success)
   362         kx         return 0;
   362         kx       else
   362         kx         return 1;
   362         kx     }
   362         kx     ''',
   362         kx     dependencies: [ libheif ],
   362         kx     name: 'import HEIC').returncode() == 0
   362         kx 
   362         kx     can_export_heic = cc.run('''
   362         kx     #include <libheif/heif.h>
   362         kx     int main() {
   362         kx       int success;
   362         kx       #if LIBHEIF_HAVE_VERSION(1,13,0)
   362         kx       heif_init (NULL);
   362         kx       #endif
   362         kx       success = heif_have_encoder_for_format (heif_compression_HEVC);
   362         kx       #if LIBHEIF_HAVE_VERSION(1,13,0)
   362         kx       heif_deinit ();
   362         kx       #endif
   362         kx 
   362         kx       if (success)
   362         kx         return 0;
   362         kx       else
   362         kx         return 1;
   362         kx     }
   362         kx     ''',
   362         kx     dependencies: [ libheif ],
   362         kx     name: 'export HEIC').returncode() == 0
   362         kx 
   362         kx     can_import_avif = cc.run('''
   362         kx     #include <libheif/heif.h>
   362         kx     int main() {
   362         kx       int success;
   362         kx       #if LIBHEIF_HAVE_VERSION(1,13,0)
   362         kx       heif_init (NULL);
   362         kx       #endif
   362         kx       success = heif_have_decoder_for_format (heif_compression_AV1);
   362         kx       #if LIBHEIF_HAVE_VERSION(1,13,0)
   362         kx       heif_deinit ();
   362         kx       #endif
   362         kx 
   362         kx       if (success)
   362         kx         return 0;
   362         kx       else
   362         kx         return 1;
   362         kx     }
   362         kx     ''',
   362         kx     dependencies: [ libheif ],
   362         kx     name: 'import AVIF').returncode() == 0
   362         kx 
   362         kx     can_export_avif = cc.run('''
   362         kx     #include <libheif/heif.h>
   362         kx     int main() {
   362         kx       int success;
   362         kx       #if LIBHEIF_HAVE_VERSION(1,13,0)
   362         kx       heif_init (NULL);
   362         kx       #endif
   362         kx       success = heif_have_encoder_for_format (heif_compression_AV1);
   362         kx       #if LIBHEIF_HAVE_VERSION(1,13,0)
   362         kx       heif_deinit ();
   362         kx       #endif
   362         kx 
   362         kx       if (success)
   362         kx         return 0;
   362         kx       else
   362         kx         return 1;
   362         kx     }
   362         kx     ''',
   362         kx     dependencies: [ libheif ],
   362         kx     name: 'export AVIF').returncode() == 0
   362         kx   else
   362         kx     # When cross-compiling and we can't run our test binaries.
   362         kx     can_import_heic = true
   362         kx     can_export_heic = true
   362         kx     can_import_avif = true
   362         kx     can_export_avif = true
   362         kx   endif
   362         kx 
   362         kx   if not can_import_heic and not can_import_avif
   362         kx     have_heif = false
   362         kx   endif
   362         kx 
   362         kx   if have_heif
   362         kx     # Listing support for both HEIC and AVIF if we build with HEIF support,
   362         kx     # because codecs can be added at any time later and we won't be able to edit
   362         kx     # the desktop file once it's installed. See discussion in #9080.
   362         kx     MIMEtypes += [
   362         kx       'image/heif',
   362         kx       'image/heic',
   362         kx       'image/avif'
   362         kx     ]
   362         kx   endif
   362         kx 
   362         kx   if have_heif and (libheif.version().version_compare('==1.5.0') or libheif.version().version_compare('==1.5.1'))
   362         kx     libheif_warning='''
   362         kx 
   362         kx           libheif version 1.5.0 and 1.5.1 are known to crash when
   362         kx           exporting (bug #4185). Please update.
   362         kx       '''
   362         kx       warning(libheif_warning)
   362         kx       warnings += libheif_warning
   362         kx   endif
   362         kx endif
   362         kx 
   362         kx have_vala = add_languages('vala', required: get_option('vala'), native: false)
   362         kx if have_vala
   362         kx   babl = declare_dependency(
   362         kx     dependencies: [
   362         kx       babl,
   362         kx       meson.get_compiler('vala').find_library('babl-0.1'),
   362         kx     ]
   362         kx   )
   362         kx 
   362         kx   # TODO: remove this once we release 3.0
   362         kx   valac = meson.get_compiler('vala')
   362         kx   if valac.version().version_compare('>= 0.31.1')
   362         kx     add_project_arguments('--disable-since-check', language: 'vala')
   362         kx   endif
   362         kx endif
   362         kx 
   362         kx # We disable WebkitGTK as default for now and discourage its use because
   362         kx # it is just a horror to build, is not available on Windows anymore
   362         kx # (AFAIK), and features brought are not worth the pain. We still leave
   362         kx # the code because mitch wants us to be able to look at it later, maybe
   362         kx # reinstate it through some shape or another. Yet for now, it is to be
   362         kx # considered non-existing feature for packager point of view. It is only
   362         kx # there in the hope developers get it back in shape.
   362         kx webkit_minver = '2.20.3'
   362         kx if get_option('webkit-unmaintained')
   362         kx   webkit = dependency('webkit2gtk-4.0', version: '>=' + webkit_minver)
   362         kx endif
   362         kx conf.set('HAVE_WEBKIT', get_option('webkit-unmaintained'))
   362         kx 
   362         kx poppler_minver = '0.69.0'
   362         kx poppler_data_minver = '0.4.9'
   362         kx poppler = [
   362         kx   dependency('poppler-glib', version: '>='+poppler_minver),
   362         kx   dependency('poppler-data', version: '>='+poppler_data_minver),
   362         kx ]
   362         kx 
   362         kx cairopdf_minver = '1.12.2'
   362         kx cairopdf = dependency('cairo-pdf', version: '>='+cairopdf_minver,
   362         kx   required: get_option('cairo-pdf')
   362         kx )
   362         kx 
   362         kx # PDF import support is a granted feature.
   362         kx MIMEtypes += 'application/pdf'
   362         kx 
   362         kx wmf_minver = '0.2.8'
   362         kx wmf = dependency('libwmf', version: '>='+wmf_minver,
   362         kx   required: get_option('wmf')
   362         kx )
   362         kx if wmf.found()
   362         kx   MIMEtypes += 'image/x-wmf'
   362         kx endif
   362         kx 
   362         kx openjpeg_minver = '2.1.0'
   362         kx openjpeg = dependency('libopenjp2', version: '>='+openjpeg_minver,
   362         kx   required: get_option('jpeg2000')
   362         kx )
   362         kx if openjpeg.found()
   362         kx   MIMEtypes += [ 'image/jp2', 'image/jpeg2000', 'image/jpx', ]
   362         kx endif
   362         kx 
   362         kx jpegxl_minver  = '0.7.0'
   362         kx libjxl         = dependency('libjxl',
   362         kx                             version: '>='+jpegxl_minver,
   362         kx                             required: get_option('jpeg-xl')
   362         kx )
   362         kx libjxl_threads = dependency('libjxl_threads',
   362         kx                             version: '>='+jpegxl_minver,
   362         kx                             required: get_option('jpeg-xl')
   362         kx )
   362         kx if libjxl.found() and libjxl_threads.found()
   362         kx   MIMEtypes += 'image/jxl'
   362         kx endif
   362         kx 
   362         kx xmc = dependency('xcursor', required: get_option('xcursor'))
   362         kx if xmc.found()
   362         kx   MIMEtypes += 'image/x-xcursor'
   362         kx endif
   362         kx 
   362         kx 
   362         kx alsa = dependency('alsa', version: '>=1.0.0', required: get_option('alsa'))
   362         kx conf.set('HAVE_ALSA', alsa.found())
   362         kx 
   362         kx # Linux Input
   362         kx 
   362         kx if get_option('linux-input').disabled()
   362         kx   have_linuxinput = false
   362         kx else
   362         kx   have_linuxinput = cc.has_header('linux/input.h',
   362         kx                                   required: get_option('linux-input'))
   362         kx endif
   362         kx 
   362         kx if have_linuxinput
   362         kx   gudev = dependency('gudev-1.0', version: '>=167', required: get_option('gudev'))
   362         kx else
   362         kx   gudev = no_dep
   362         kx endif
   362         kx conf.set('HAVE_LIBGUDEV', gudev.found())
   362         kx 
   362         kx 
   362         kx # DirectX DirectInput
   362         kx directx = no_dep
   362         kx directx_sdk_path = get_option('directx-sdk-dir')
   362         kx if directx_sdk_path != '' and platform_windows
   362         kx   if directx_sdk_path.contains(' ') or directx_sdk_path.contains('\\')
   362         kx     error('\n'.join([
   362         kx       'The DirectX SDK path should be given :',
   362         kx       '* without spaces (use MSys mounts)',
   362         kx       '* with plain (forward) slashes only,'
   362         kx     ]))
   362         kx   endif
   362         kx 
   362         kx   directx = declare_dependency(
   362         kx     dependencies: cc.find_library('dxguid',
   362         kx                                   dirs: directx_sdk_path / 'Lib' / 'x86'),
   362         kx     include_directories: directx_sdk_path / 'Include',
   362         kx   )
   362         kx endif
   362         kx conf.set('HAVE_DX_DINPUT', directx.found())
   362         kx 
   362         kx cfitsio_dep = dependency('cfitsio', required: false)
   362         kx if cfitsio_dep.found()
   362         kx   MIMEtypes += 'image/fits'
   362         kx endif
   362         kx 
   362         kx 
   362         kx ################################################################################
   362         kx # Email sending
   362         kx email_message = false
   362         kx 
   362         kx sendmail_choice = get_option('with-sendmail')
   362         kx if not [ '', 'false', 'no', ].contains(sendmail_choice)
   362         kx   if [ 'true', 'yes' ].contains(sendmail_choice)
   362         kx     sendmail_path = 'sendmail'
   362         kx   else
   362         kx     sendmail_path = sendmail_choice
   362         kx   endif
   362         kx 
   362         kx   sendmail = find_program(sendmail_path, required: false)
   362         kx   if sendmail.found()
   362         kx     sendmail_path = sendmail.path()
   362         kx   else
   362         kx     mail_warning = 'Sendmail specified but not found. It should be installed at runtime!'
   362         kx     warning(mail_warning)
   362         kx     warnings += mail_warning
   362         kx   endif
   362         kx 
   362         kx   email_message = '@0@ (@1@)'.format(true, sendmail_path)
   362         kx   conf.set_quoted('SENDMAIL', sendmail_path)
   362         kx else
   362         kx   xdg_email_path = 'xdg-email'
   362         kx   xdg_email = find_program(xdg_email_path, required: false)
   362         kx   if xdg_email.found()
   362         kx     xdg_email_path = xdg_email.full_path()
   362         kx   else
   362         kx     mail_warning = 'Xdg-email not found, but required at runtime for email sending.'
   362         kx     warning(mail_warning)
   362         kx     warnings += mail_warning
   362         kx   endif
   362         kx 
   362         kx   email_message = '@0@ (@1@)'.format(true, xdg_email_path)
   362         kx endif
   362         kx 
   362         kx 
   362         kx ################################################################################
   362         kx # ISO codes
   362         kx 
   362         kx isocodes = dependency('iso-codes', required: false)
   362         kx if isocodes.found()
   362         kx   isocodes_prefix = isocodes.get_variable(pkgconfig: 'prefix')
   362         kx   isocodes_location = isocodes_prefix / get_option('datadir') / 'xml' / 'iso-codes'
   362         kx   isocodes_localedir= isocodes_prefix / get_option('datadir') / 'locale'
   362         kx endif
   362         kx conf.set('HAVE_ISO_CODES', isocodes.found())
   362         kx 
   362         kx 
   362         kx ################################################################################
   362         kx # Program tools
   362         kx 
   362         kx perl = find_program('perl5', 'perl', 'perl5.005', 'perl5.004', 'perl')
   362         kx 
   362         kx ## Python
   362         kx 
   362         kx # By default, we want packagers to install Python plug-ins to get the
   362         kx # optimum experience. -Dpython=true will check for a Python 3
   362         kx # interpreter and PyGObject, and warns without.
   362         kx # It is up to the packager to ensure they are available at run time.
   362         kx # This can be useful in particular when cross-compiling since anyway
   362         kx # the interpreter is not useful at build time.
   362         kx 
   362         kx python3_minver = '>=3.6'
   362         kx 
   362         kx python = pythonmod.find_installation('python3')
   362         kx message('Found Python @0@'.format(python.language_version()))
   362         kx 
   362         kx have_python = get_option('python').enabled()
   362         kx 
   362         kx python_found = true
   362         kx MIMEtypes += 'image/openraster'
   362         kx 
   362         kx ## Javascript
   362         kx 
   362         kx gjs = find_program('gjs', required: get_option('javascript'))
   362         kx have_javascript = get_option('javascript').enabled() or (gjs.found() and get_option('javascript').auto())
   362         kx if not gjs.found() and have_javascript
   362         kx   gjs = find_program('gjs', required: false)
   362         kx   if not gjs.found()
   362         kx     js_warning = '''
   362         kx     GJS was not found.
   362         kx     JavaScript plug-ins will be installed anyway but you should make sure that
   362         kx     the JavaScript interpreter GJS is available at installation, otherwise
   362         kx     installed plug-ins won't be usable.
   362         kx     '''
   362         kx     warning(js_warning)
   362         kx     warnings += js_warning
   362         kx   endif
   362         kx endif
   362         kx 
   362         kx ## Lua
   362         kx 
   362         kx lua = find_program('luajit', required: get_option('lua'))
   362         kx have_lua = get_option('lua').enabled() or (lua.found() and get_option('lua').auto())
   362         kx if not lua.found() and have_lua
   362         kx   lua_warning = '''
   362         kx   Luajit was not found.
   362         kx   Lua plug-ins will be installed anyway but you should make sure that
   362         kx   luajit and LGI are available at installation, otherwise
   362         kx   installed plug-ins won't be usable.
   362         kx   '''
   362         kx   warning(lua_warning)
   362         kx   warnings += lua_warning
   362         kx endif
   362         kx 
   362         kx 
   362         kx # Check for XML tools
   362         kx xmllint             = find_program('xmllint', required: false)
   362         kx xsltproc            = find_program('xsltproc')
   362         kx desktop_validate    = find_program('desktop-file-validate', required: false)
   362         kx 
   362         kx appstreamcli = find_program('appstreamcli', version: '>=0.15.3', required: get_option('appdata-test'))
   362         kx 
   362         kx # Check for doc generation tools
   362         kx 
   362         kx gi_docgen = find_program('gi-docgen', required: get_option('gi-docgen'))
   362         kx 
   362         kx if get_option('g-ir-doc')
   362         kx   gir_doc_tool = find_program('g-ir-doc-tool', required: true)
   362         kx   yelp_build   = find_program('yelp-build', required: true)
   362         kx endif
   362         kx 
   362         kx # Check for vector icons
   362         kx have_vector_icons = get_option('vector-icons')
   362         kx if have_vector_icons
   362         kx   # shared-mime-info is needed to correctly detect SVG files
   362         kx   # (except on Windows, apparently).
   362         kx   if platform_windows
   362         kx     vec_warning = '''
   362         kx       You enabled vector icons on Win32. Make sure to run:
   362         kx       $ gdk-pixbuf-query-loaders.exe --update-cache
   362         kx       on the target machine (this command generates loaders.cache)
   362         kx       so that GdkPixbuf knows where to find the SVG loader.
   362         kx     '''
   362         kx     warning(vec_warning)
   362         kx     warnings += vec_warning
   362         kx   else
   362         kx     shared_mime_info = dependency('shared-mime-info')
   362         kx   endif
   362         kx else
   362         kx   # The trick when disabling vector icons is that librsvg is still
   362         kx   # needed at compile time (on build machine) to generate PNG, even
   362         kx   # though it won't be needed at runtime for icon display.
   362         kx   #
   362         kx   # The tool gtk-encode-symbolic-svg also requires a SVG GdkPixbuf
   362         kx   # loader, which usually uses librsvg as well anyway.
   362         kx   vec_warning = '''
   362         kx     Vector icons are disabled. Be aware that librsvg is still
   362         kx     needed to create the PNG icons on the build machine, yet it
   362         kx     won't be needed for runtime icon display of distributed themes.
   362         kx   '''
   362         kx   warning(vec_warning)
   362         kx   warnings += vec_warning
   362         kx endif
   362         kx 
   362         kx native_glib_minver = '2.2.0'
   362         kx native_glib = dependency('glib-2.0',    version: '>='+native_glib_minver, native: true)
   362         kx native_rsvg = dependency('librsvg-2.0', version: '>='+rsvg_minver, native: true)
   362         kx 
   362         kx # Running tests headless
   362         kx xvfb_run = find_program('xvfb-run', required: get_option('headless-tests'))
   362         kx dbus_run_session = find_program('dbus-run-session', required: get_option('headless-tests'))
   362         kx if xvfb_run.found() and dbus_run_session.found()
   362         kx   conf.set('HAVE_XVFB_RUN', true)
   362         kx   add_test_setup('headless',
   362         kx     exe_wrapper: find_program('build' / 'meson' / 'run_test_env.sh'),
   362         kx     is_default: true,
   362         kx   )
   362         kx endif
   362         kx 
   362         kx # Set bug report URL
   362         kx 
   362         kx # Allowing third-party packagers to set their own bugtracker URL, in
   362         kx # order to filter first packaging bugs from core bugs.
   362         kx bug_report_url = get_option('bug-report-url')
   362         kx 
   362         kx if bug_report_url == ''
   362         kx   message('''
   362         kx     NOTE: if you plan on packaging GIMP for distribution, it is recommended
   362         kx     to override the bug report URL with option:
   362         kx       -Dbug-report-url=https://example.com/
   362         kx     so that you can filter packaging bugs from core bugs before reporting upstream.
   362         kx   ''')
   362         kx 
   362         kx   bug_report_url = project_url_issues
   362         kx endif
   362         kx conf.set_quoted('PACKAGE_BUGREPORT', project_url_issues)
   362         kx conf.set_quoted('BUG_REPORT_URL', bug_report_url)
   362         kx 
   362         kx # Build identifiers #
   362         kx 
   362         kx conf.set_quoted('GIMP_BUILD_ID', get_option('build-id'))
   362         kx conf.set_quoted('GIMP_BUILD_PLATFORM', host_os)
   362         kx if platform_linux
   362         kx   conf.set_quoted('GIMP_BUILD_PLATFORM_FAMILY', 'linux')
   362         kx elif platform_windows
   362         kx   conf.set_quoted('GIMP_BUILD_PLATFORM_FAMILY', 'windows')
   362         kx elif platform_osx
   362         kx   conf.set_quoted('GIMP_BUILD_PLATFORM_FAMILY', 'macos')
   362         kx else
   362         kx   conf.set_quoted('GIMP_BUILD_PLATFORM_FAMILY', 'other')
   362         kx endif
   362         kx 
   362         kx if get_option('check-update') == 'yes'
   362         kx   check_update = true
   362         kx elif get_option('check-update') == 'no'
   362         kx   check_update = false
   362         kx else # == 'platform-default'
   362         kx   if platform_windows or platform_osx
   362         kx     check_update = true
   362         kx   else
   362         kx     # Other packages usually have their own update system (software
   362         kx     # repositories on Linux and other *BSDs for instance) so we
   362         kx     # shouldn't notify about new versions, at least not as a default.
   362         kx     check_update = false
   362         kx   endif
   362         kx endif
   362         kx conf.set('CHECK_UPDATE', check_update)
   362         kx 
   362         kx # Default ICC directory #
   362         kx 
   362         kx # This is necessary because some Unix systems may have a different
   362         kx # standard path for color profiles. And in particular, sandbox builds
   362         kx # might mount the host system at a different root. This is for
   362         kx # instance the case of flatpak which mount the host root at /run/host/.
   362         kx 
   362         kx # if not (platform_osx or platform_windows)
   362         kx 
   362         kx icc_directory = get_option('icc-directory')
   362         kx if icc_directory == ''
   362         kx   icc_directory = '/usr/share/color/icc'
   362         kx endif
   362         kx conf.set_quoted('COLOR_PROFILE_DIRECTORY', icc_directory)
   362         kx 
   362         kx # endif
   362         kx 
   362         kx if get_option('enable-default-bin').auto()
   362         kx   enable_default_bin = stable
   362         kx elif get_option('enable-default-bin').enabled()
   362         kx   enable_default_bin = true
   362         kx else
   362         kx   enable_default_bin = false
   362         kx endif
   362         kx 
   362         kx enable_console_bin = get_option('enable-console-bin')
   362         kx 
   362         kx if enable_default_bin and meson.version().version_compare('<0.61.0')
   362         kx   error('"enable-default-bin" build option requires meson 0.61 or later. Please disable the option or update meson.')
   362         kx endif
   362         kx 
   362         kx # Possibly change default gimpdir from $XDG_CONFIG_HOME/GIMP/gimp_user_version
   362         kx gimpdir = get_option('gimpdir')
   362         kx if gimpdir == ''
   362         kx   # Default value
   362         kx   gimpdir = meson.project_name().to_upper()
   362         kx endif
   362         kx 
   362         kx project_subdir = meson.project_name() / gimp_app_version
   362         kx gimpdatadir    = get_option('datadir')    / project_subdir
   362         kx gimpplugindir  = get_option('libdir')     / project_subdir
   362         kx gimpsysconfdir = get_option('sysconfdir') / project_subdir
   362         kx gimpmanpagedir = gimpdir
   362         kx localedir      = get_option('datadir') / 'locale'
   362         kx 
   362         kx 
   362         kx 
   362         kx # Check for internal tools
   362         kx extract_vector_icon = find_program('tools'/'extract-vector-icon.sh')
   362         kx generate_changelog  = find_program('tools'/'generate_changelog.sh')
   362         kx generate_news       = find_program('tools'/'generate-news')
   362         kx gimppath2svg        = find_program('tools'/'gimppath2svg.py')
   362         kx module_dependencies = find_program('tools'/'module-dependencies.py')
   362         kx meson_install_subdir= find_program('tools'/'meson_install_subdir.py')
   362         kx 
   362         kx gimp_mkenums = find_program('tools' / 'gimp-mkenums')
   362         kx mkenums_wrap = find_program(meson.current_source_dir() / 'tools' / 'meson-mkenums.sh')
   362         kx 
   362         kx libgimp_mkenums_dtails = \
   362         kx     '    { 0, NULL, NULL }\n'                                                      + \
   362         kx     '  };\n'                                                                       + \
   362         kx     '\n'                                                                           + \
   362         kx     '  static GType type = 0;\n'                                                   + \
   362         kx     '\n'                                                                           + \
   362         kx     '  if (G_UNLIKELY (! type))\n'                                                 + \
   362         kx     '    {\n'                                                                      + \
   362         kx     '      type = g_@type@_register_static ("@EnumName@", values);\n'              + \
   362         kx     '      gimp_type_set_translation_domain (type, GETTEXT_PACKAGE "-libgimp");\n' + \
   362         kx     '      gimp_type_set_translation_context (type, "@enumnick@");\n'              + \
   362         kx     '      gimp_@type@_set_value_descriptions (type, descs);\n'                    + \
   362         kx     '    }\n'                                                                      + \
   362         kx     '\n'                                                                           + \
   362         kx     '  return type;\n'                                                             + \
   362         kx     '}\n'
   362         kx 
   362         kx conf.set('ENABLE_NLS',   true)
   362         kx conf.set('HAVE_GETTEXT', true)
   362         kx 
   362         kx # localedir = get_option('prefix') / get_option('localedir')
   362         kx 
   362         kx 
   362         kx ################################################################################
   362         kx # Miscellaneous configuration
   362         kx 
   362         kx #     #
   362         kx ##   ## #  ####   ####
   362         kx # # # # # #      #    #
   362         kx #  #  # #  ####  #
   362         kx #     # #      # #
   362         kx #     # # #    # #    #
   362         kx #     # #  ####   ####
   362         kx 
   362         kx 
   362         kx 
   362         kx # Enable support for multiprocessing
   362         kx conf.set10('ENABLE_MP', get_option('enable-multiproc'))
   362         kx 
   362         kx # Enable support for OpenMP
   362         kx openmp = dependency('openmp', required : false)
   362         kx if openmp.found()
   362         kx   have_openmp = true
   362         kx else
   362         kx   have_openmp = false
   362         kx endif
   362         kx conf.set('HAVE_OPENMP', have_openmp)
   362         kx 
   362         kx # Check for available functions
   362         kx foreach fn : [
   362         kx     { 'm': 'HAVE_ALLOCA',                   'v': 'alloca', },
   362         kx     { 'm': 'HAVE_DCGETTEXT',                'v': 'dcgettext', },
   362         kx     { 'm': 'HAVE_DIFFTIME',                 'v': 'difftime', },
   362         kx     { 'm': 'HAVE_FSYNC',                    'v': 'fsync', },
   362         kx     { 'm': 'HAVE_GETADDRINFO',              'v': 'getaddrinfo', },
   362         kx     { 'm': 'HAVE_GETNAMEINFO',              'v': 'getnameinfo', },
   362         kx     { 'm': 'HAVE_GETTEXT',                  'v': 'gettext', },
   362         kx     { 'm': 'HAVE_MMAP',                     'v': 'mmap', },
   362         kx     { 'm': 'HAVE_RINT',                     'v': 'rint', },
   362         kx     { 'm': 'HAVE_THR_SELF',                 'v': 'thr_self', },
   362         kx     { 'm': 'HAVE_VFORK',                    'v': 'vfork', },
   362         kx   ]
   362         kx   conf.set(fn['m'],
   362         kx     cc.has_function(fn['v']) ? 1 : false
   362         kx   )
   362         kx endforeach
   362         kx 
   362         kx conf.set('HAVE_BIND_TEXTDOMAIN_CODESET',
   362         kx   cc.has_header_symbol('libintl.h', 'bind_textdomain_codeset') ? 1 : false
   362         kx )
   362         kx conf.set('HAVE_VPRINTF',
   362         kx   cc.has_header_symbol('libintl.h', 'vprintf') ? 1 : false
   362         kx )
   362         kx 
   362         kx 
   362         kx # Check for available headers
   362         kx foreach header : [
   362         kx     { 'm': 'HAVE_ALLOCA_H',       'v': 'alloca.h' },
   362         kx     { 'm': 'HAVE_DLFCN_H',        'v': 'dlfcn.h' },
   362         kx     { 'm': 'HAVE_FCNTL_H',        'v': 'fcntl.h' },
   362         kx     { 'm': 'HAVE_IEEEFP_H',       'v': 'ieeefp.h' },
   362         kx     { 'm': 'HAVE_INTTYPES_H',     'v': 'inttypes.h' },
   362         kx     { 'm': 'HAVE_LOCALE_H',       'v': 'locale.h' },
   362         kx     { 'm': 'HAVE_MATH_H',         'v': 'math.h' },
   362         kx     { 'm': 'HAVE_MEMORY_H',       'v': 'memory.h' },
   362         kx     { 'm': 'HAVE_STDINT_H',       'v': 'stdint.h' },
   362         kx     { 'm': 'HAVE_STDLIB_H',       'v': 'stdlib.h' },
   362         kx     { 'm': 'HAVE_STRING_H',       'v': 'string.h' },
   362         kx     { 'm': 'HAVE_STRINGS_H',      'v': 'strings.h' },
   362         kx     { 'm': 'HAVE_SYS_PARAM_H',    'v': 'sys/param.h' },
   362         kx     { 'm': 'HAVE_SYS_PRCTL_H',    'v': 'sys/prctl.h' },
   362         kx     { 'm': 'HAVE_SYS_SELECT_H',   'v': 'sys/select.h' },
   362         kx     { 'm': 'HAVE_SYS_STAT_H',     'v': 'sys/stat.h' },
   362         kx     { 'm': 'HAVE_SYS_THR_H',      'v': 'sys/thr.h' },
   362         kx     { 'm': 'HAVE_SYS_TIME_H',     'v': 'sys/time.h' },
   362         kx     { 'm': 'HAVE_SYS_TIMES_H',    'v': 'sys/times.h' },
   362         kx     { 'm': 'HAVE_SYS_TYPES_H',    'v': 'sys/types.h' },
   362         kx     { 'm': 'HAVE_SYS_WAIT_H',     'v': 'sys/wait.h' },
   362         kx     { 'm': 'HAVE_UNISTD_H',       'v': 'unistd.h' },
   362         kx     { 'm': 'HAVE_MMAN_H',         'v': 'sys/mman.h' },
   362         kx     { 'm': 'HAVE_IPC_H',          'v': 'sys/ipc.h' },
   362         kx     { 'm': 'HAVE_SHM_H',          'v': 'sys/shm.h' },
   362         kx   ]
   362         kx   conf.set(header['m'], cc.has_header(header['v']) ? 1 : false)
   362         kx endforeach
   362         kx 
   362         kx # In musl, backtrace() is in the libexecinfo library.
   362         kx # In glibc, it is internal (there we only need the header).
   362         kx # So we look for both cases, so that we are able to link to libexecinfo
   362         kx # if it exists. Cf. !455.
   362         kx opt_execinfo = cc.find_library('execinfo', has_headers: ['execinfo.h'], required: false)
   362         kx conf.set('HAVE_EXECINFO_H', opt_execinfo.found() or cc.has_header('execinfo.h') ? 1 : false)
   362         kx 
   362         kx 
   362         kx ################################################################################
   362         kx # Check for shared memory handling
   362         kx 
   362         kx shmem_choice = get_option('shmem-type')
   362         kx if shmem_choice == 'auto'
   362         kx   shmem_choice = 'sysv'
   362         kx 
   362         kx   # MacOS X has broken SysV shm
   362         kx   if platform_osx
   362         kx     shmem_choice = 'posix'
   362         kx   endif
   362         kx   if platform_windows
   362         kx     shmem_choice = 'win32'
   362         kx   endif
   362         kx endif
   362         kx 
   362         kx conf.set('USE_SYSV_SHM', true)
   362         kx 
   362         kx conf.set('NO_FD_SET',
   362         kx   not platform_windows
   362         kx   and not cc.compiles('''
   362         kx     #include <sys/types.h>
   362         kx     int main() { fd_set readMask, writeMask; return 0; }
   362         kx   ''')
   362         kx )
   362         kx 
   362         kx # GCC attributes
   362         kx conf.set('HAVE_FUNC_ATTRIBUTE_DESTRUCTOR',
   362         kx   cc.compiles('''__attribute__ ((destructor)) void destructor_fn(void) { }''')
   362         kx )
   362         kx 
   362         kx 
   362         kx 
   362         kx 
   362         kx ################################################################################
   362         kx # Set/regroup common CFlags for subdirs
   362         kx 
   362         kx ######
   362         kx #     # ###### ###### # #    # ######  ####
   362         kx #     # #      #      # ##   # #      #
   362         kx #     # #####  #####  # # #  # #####   ####
   362         kx #     # #      #      # #  # # #           #
   362         kx #     # #      #      # #   ## #      #    #
   362         kx ######  ###### #      # #    # ######  ####
   362         kx 
   362         kx # Compiler
   362         kx conf.set_quoted('CC',             cc.get_id())
   362         kx 
   362         kx cc_version=''
   362         kx if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
   362         kx   cc_cmd = run_command(cc, '-v', check: false)
   362         kx   # Note: the call might actually fail when using ccache.
   362         kx   # See: https://github.com/mesonbuild/meson/issues/6174
   362         kx   if cc_cmd.returncode() == 0
   362         kx     cc_version = cc_cmd.stdout() + cc_cmd.stderr()
   362         kx   endif
   362         kx else
   362         kx   # Various compilers have various options. Try most common ones. This
   362         kx   # list of options comes from autotools checks.
   362         kx   foreach arg : [ '--version', '-v', '-V', '-qversion' ]
   362         kx     cc_cmd = run_command(cc, arg, check: false)
   362         kx     if cc_cmd.returncode() == 0
   362         kx       cc_version = cc_cmd.stdout()
   362         kx     endif
   362         kx   endforeach
   362         kx endif
   362         kx if cc_version == ''
   362         kx   # We didn't manage to get a meaningful verbose version from the
   362         kx   # compiler. Just save its name and version.
   362         kx   cc_version = cc.get_id() + ' ' + cc.version()
   362         kx else
   362         kx   if platform_windows
   362         kx     # On Windows the CC_VERSION string can contain backslashes in paths,
   362         kx     # specifically in COLLECT_GCC. Replace by slashes.
   362         kx     cc_version = '/'.join(cc_version.split('\\'))
   362         kx   endif
   362         kx   # See also: https://github.com/mesonbuild/meson/pull/6179
   362         kx   cc_version = '\\n'.join(cc_version.split('\n'))
   362         kx endif
   362         kx conf.set_quoted('CC_VERSION',     cc_version.strip())
   362         kx 
   362         kx # Names
   362         kx conf.set_quoted('GIMP_PACKAGE',   meson.project_name())
   362         kx conf.set_quoted('PACKAGE_NAME',   meson.project_name())
   362         kx conf.set_quoted('PACKAGE_STRING', package_string)
   362         kx conf.set_quoted('GIMP_COMMAND',   gimp_command)
   362         kx 
   362         kx # Versions
   362         kx conf.set_quoted('GIMP_APP_VERSION_STRING',gimp_app_version)
   362         kx conf.set_quoted('GIMP_APP_VERSION',       gimp_app_version)
   362         kx conf.set_quoted('GIMP_USER_VERSION',      gimp_app_version)
   362         kx 
   362         kx conf.set_quoted('GIMP_DATA_VERSION',      gimp_app_version)
   362         kx conf.set_quoted('GIMP_PLUGIN_VERSION',    gimp_app_version)
   362         kx conf.set_quoted('GIMP_SYSCONF_VERSION',   gimp_app_version)
   362         kx conf.set_quoted('GIMP_TOOL_VERSION',      gimp_app_version)
   362         kx conf.set_quoted('GIMP_PKGCONFIG_VERSION', gimp_api_version)
   362         kx 
   362         kx # Directories
   362         kx conf.set_quoted('PREFIX',          prefix)
   362         kx conf.set_quoted('EXEC_PREFIX',     prefix)
   362         kx conf.set_quoted('GIMPDIR',         gimpdir)
   362         kx conf.set_quoted('GIMPSYSCONFDIR',  prefix / gimpsysconfdir)
   362         kx conf.set_quoted('GIMPDATADIR',     prefix / gimpdatadir)
   362         kx conf.set_quoted('GIMPPLUGINDIR',   prefix / gimpplugindir)
   362         kx conf.set_quoted('PLUGINDIR',       prefix / gimpplugindir)
   362         kx conf.set_quoted('LOCALEDIR',       prefix / localedir)
   362         kx conf.set_quoted('DESKTOP_DATADIR', prefix / get_option('datadir'))
   362         kx 
   362         kx conf.set_quoted('LOCALSTATEDIR',   prefix / get_option('localstatedir'))
   362         kx # /usr/com?
   362         kx conf.set_quoted('SHAREDSTATEDIR',  prefix / get_option('sharedstatedir'))
   362         kx conf.set_quoted('SYSCONFDIR',      prefix / get_option('sysconfdir'))
   362         kx conf.set_quoted('BINDIR',          prefix / get_option('bindir'))
   362         kx conf.set_quoted('DATAROOTDIR',     prefix / get_option('datadir'))
   362         kx conf.set_quoted('INFODIR',         prefix / get_option('infodir'))
   362         kx conf.set_quoted('LIBDIR',          prefix / get_option('libdir'))
   362         kx conf.set_quoted('LIBEXECDIR',      prefix / get_option('libexecdir'))
   362         kx conf.set_quoted('MANDIR',          prefix / get_option('mandir'))
   362         kx conf.set_quoted('SBINDIR',         prefix / get_option('sbindir'))
   362         kx conf.set_quoted('SYSDATADIR',      prefix / get_option('datadir'))
   362         kx 
   362         kx # Third-party/Misc
   362         kx if isocodes.found()
   362         kx   conf.set_quoted('ISO_CODES_LOCATION',    isocodes_location)
   362         kx   conf.set_quoted('ISO_CODES_LOCALEDIR',   isocodes_localedir)
   362         kx endif
   362         kx 
   362         kx 
   362         kx if platform_osx
   362         kx   # libgimp_cflags += '-xobjective-c'
   362         kx   # libgimp_lflags += ['-framework', 'Cocoa']
   362         kx endif
   362         kx 
   362         kx 
   362         kx ################################################################################
   362         kx # Generate files
   362         kx 
   362         kx   #####                                   #######
   362         kx  #     #  ####  #    # ###### #  ####     #       # #      ######  ####
   362         kx  #       #    # ##   # #      # #    #    #       # #      #      #
   362         kx  #       #    # # #  # #####  # #         #####   # #      #####   ####
   362         kx  #       #    # #  # # #      # #  ###    #       # #      #           #
   362         kx  #     # #    # #   ## #      # #    #    #       # #      #      #    #
   362         kx   #####   ####  #    # #      #  ####     #       # ###### ######  ####
   362         kx 
   362         kx 
   362         kx # git-version.h is already present and not generated if dist tarball
   362         kx is_git_repository = run_command(python, '-c',
   362         kx   'import sys,os; sys.exit(0 if os.path.exists(".git") else 1)',
   362         kx   check: false
   362         kx ).returncode() == 0
   362         kx 
   362         kx has_version_h = run_command(python, '-c',
   362         kx   'import sys,os; sys.exit(0 if os.path.exists("git-version.h") else 1)',
   362         kx   check: false
   362         kx ).returncode() == 0
   362         kx 
   362         kx generate_version_h = is_git_repository or not has_version_h
   362         kx if generate_version_h
   362         kx   gitversion_h1 = vcs_tag(
   362         kx     input : 'app/git-version.h.in',
   362         kx     output: 'git-version.h.in.1',
   362         kx     command: [ 'git', 'describe', '--always', ],
   362         kx     replace_string: '@GIMP_GIT_VERSION@',
   362         kx     fallback: 'unknown (unsupported)',
   362         kx   )
   362         kx   gitversion_h2 = vcs_tag(
   362         kx     input : gitversion_h1,
   362         kx     output: 'git-version.h.in.2',
   362         kx     command: [ 'git', 'rev-parse', '--short', 'HEAD', ],
   362         kx     replace_string: '@GIMP_GIT_VERSION_ABBREV@',
   362         kx     fallback: 'unknown (unsupported)',
   362         kx   )
   362         kx   gitversion_h = vcs_tag(
   362         kx     input : gitversion_h2,
   362         kx     output: 'git-version.h',
   362         kx     command: [ 'git', 'log', '-n1', '--date=format:%Y', '--pretty=%cd', ],
   362         kx     replace_string: '@GIMP_GIT_LAST_COMMIT_YEAR@',
   362         kx     fallback: 'unknown (unsupported)',
   362         kx   )
   362         kx 
   362         kx   git = find_program('git', required: false)
   362         kx   if not is_git_repository or not git.found()
   362         kx   # We create git-version.h but know it will be useless because we are
   362         kx   # not in a git repository. Output a warning.
   362         kx   git_warning = '''
   362         kx 
   362         kx         UNSUPPORTED BUILD!
   362         kx 
   362         kx         This is not a distribution tarball (git-version.h missing) and
   362         kx         we could not establish the corresponding commit (either this is
   362         kx         not a git repository or git command is missing). Therefore
   362         kx         we have no reference for debugging.
   362         kx         Please either use release tarballs or build from the repository.
   362         kx   '''
   362         kx   warning(git_warning)
   362         kx   warnings += git_warning
   362         kx   endif
   362         kx else
   362         kx   gitversion_h = files('git-version.h')
   362         kx endif
   362         kx 
   362         kx install_conf = configuration_data()
   362         kx install_conf.set('GIMP_APP_VERSION', gimp_app_version)
   362         kx install_conf.set('GIMP_PKGCONFIG_VERSION', gimp_version)
   362         kx install_conf.set('GIMP_VERSION', gimp_version)
   362         kx install_conf.set('APPSTREAM_GLIB_REQUIRED_VERSION', appstream_glib_minver)
   362         kx install_conf.set('ATK_REQUIRED_VERSION',          atk_minver)
   362         kx install_conf.set('BABL_REQUIRED_VERSION',         babl_minver)
   362         kx install_conf.set('CAIRO_PDF_REQUIRED_VERSION',    cairopdf_minver)
   362         kx install_conf.set('CAIRO_REQUIRED_VERSION',        cairo_minver)
   362         kx install_conf.set('FONTCONFIG_REQUIRED_VERSION',   fontconfig_minver)
   362         kx install_conf.set('FREETYPE2_REQUIRED_VERSION',    freetype2_minver)
   362         kx install_conf.set('GDK_PIXBUF_REQUIRED_VERSION',   gdk_pixbuf_minver)
   362         kx install_conf.set('GEGL_REQUIRED_VERSION',         gegl_minver)
   362         kx install_conf.set('EXIV2_REQUIRED_VERSION',        exiv2_minver)
   362         kx install_conf.set('GEXIV2_REQUIRED_VERSION',       gexiv2_minver)
   362         kx install_conf.set('GLIB_REQUIRED_VERSION',         glib_minver)
   362         kx install_conf.set('GTK_REQUIRED_VERSION',          gtk3_minver)
   362         kx install_conf.set('HARFBUZZ_REQUIRED_VERSION',     harfbuzz_minver)
   362         kx install_conf.set('LCMS_REQUIRED_VERSION',         lcms_minver)
   362         kx install_conf.set('LIBHEIF_REQUIRED_VERSION',      libheif_minver)
   362         kx install_conf.set('LIBLZMA_REQUIRED_VERSION',      liblzma_minver)
   362         kx install_conf.set('LIBTIFF_REQUIRED_VERSION',      libtiff_minver)
   362         kx install_conf.set('LIBMYPAINT_REQUIRED_VERSION',   libmypaint_minver)
   362         kx install_conf.set('LIBPNG_REQUIRED_VERSION',       libpng_minver)
   362         kx install_conf.set('OPENEXR_REQUIRED_VERSION',      openexr_minver)
   362         kx install_conf.set('OPENJPEG_REQUIRED_VERSION',     openjpeg_minver)
   362         kx install_conf.set('PANGOCAIRO_REQUIRED_VERSION',   pangocairo_minver)
   362         kx install_conf.set('POPPLER_DATA_REQUIRED_VERSION', poppler_data_minver)
   362         kx install_conf.set('POPPLER_REQUIRED_VERSION',      poppler_minver)
   362         kx install_conf.set('PYTHON3_REQUIRED_VERSION',      python3_minver)
   362         kx install_conf.set('RSVG_REQUIRED_VERSION',         rsvg_minver)
   362         kx install_conf.set('WEBKITGTK_REQUIRED_VERSION',    webkit_minver)
   362         kx install_conf.set('WEBP_REQUIRED_VERSION',         webp_minver)
   362         kx install_conf.set('WMF_REQUIRED_VERSION',          wmf_minver)
   362         kx install_conf.set('XGETTEXT_REQUIRED_VERSION',     '0.19')
   362         kx 
   362         kx if is_git_repository
   362         kx   # Tarballs won't have INSTALL.in, only the generated INSTALL.
   362         kx   INSTALL = configure_file(
   362         kx     input : 'INSTALL.in',
   362         kx     output: 'INSTALL',
   362         kx     configuration: install_conf
   362         kx   )
   362         kx endif
   362         kx 
   362         kx 
   362         kx configure_file(
   362         kx   output: 'config.h',
   362         kx   configuration: conf
   362         kx )
   362         kx compiler_args +='-DHAVE_CONFIG_H'
   362         kx 
   362         kx 
   362         kx add_project_arguments(compiler_args, language: [ 'c', 'cpp' ])
   362         kx add_project_link_arguments(linker_args, language: [ 'c', 'cpp' ])
   362         kx 
   362         kx ################################################################################
   362         kx # Miscellaneous targets
   362         kx 
   362         kx 
   362         kx  #     #                    #######
   362         kx  ##   ## #  ####   ####        #      ##   #####   ####  ###### #####  ####
   362         kx  # # # # # #      #    #       #     #  #  #    # #    # #        #   #
   362         kx  #  #  # #  ####  #            #    #    # #    # #      #####    #    ####
   362         kx  #     # #      # #            #    ###### #####  #  ### #        #        #
   362         kx  #     # # #    # #    #       #    #    # #   #  #    # #        #   #    #
   362         kx  #     # #  ####   ####        #    #    # #    #  ####  ######   #    ####
   362         kx 
   362         kx 
   362         kx 
   362         kx custom_target('AUTHORS',
   362         kx   input : [ 'authors.xsl', 'authors.xml', ],
   362         kx   output: 'AUTHORS',
   362         kx   command: [
   362         kx     xsltproc,
   362         kx     '-o', '@OUTPUT@',
   362         kx     '@INPUT@',
   362         kx   ],
   362         kx   build_by_default: false,
   362         kx )
   362         kx custom_target('authors.md',
   362         kx   input : [ 'authors4gimp-web.xsl', 'authors.xml', ],
   362         kx   output: 'authors.md',
   362         kx   command: [
   362         kx     xsltproc,
   362         kx     '--stringparam', 'today', '`date --iso-8601=seconds`',
   362         kx     '-o', '@OUTPUT@',
   362         kx     '@INPUT@',
   362         kx   ],
   362         kx   build_by_default: false,
   362         kx )
   362         kx 
   362         kx if xmllint.found()
   362         kx   custom_target('validate-authors',
   362         kx     command: [
   362         kx       xmllint,
   362         kx       '--output', '@OUTPUT@',
   362         kx       '--valid', '@INPUT@',
   362         kx     ],
   362         kx     input : [ 'authors.xml', ],
   362         kx     output: [ 'validate-authors-output.xml' ],
   362         kx     build_by_default: true,
   362         kx     install: false
   362         kx   )
   362         kx endif
   362         kx 
   362         kx custom_target('Changelog',
   362         kx   input : [ ],
   362         kx   output: [ 'Changelog', ],
   362         kx   command: [
   362         kx     generate_changelog,
   362         kx     meson.project_source_root(),
   362         kx     '@OUTPUT@'
   362         kx   ],
   362         kx   build_by_default: false,
   362         kx )
   362         kx 
   362         kx meson.add_dist_script('meson_dist_script.sh',
   362         kx                       generate_version_h ?  gitversion_h.full_path() : gitversion_h,
   362         kx                       meson.project_source_root(), meson.project_build_root())
   362         kx 
   362         kx 
   362         kx ################################################################################
   362         kx # Subdirs
   362         kx 
   362         kx 
   362         kx rootInclude = include_directories('.')
   362         kx appInclude  = include_directories('app')
   362         kx 
   362         kx subdir('build/windows')
   362         kx 
   362         kx # Tools
   362         kx subdir('libgimpbase')
   362         kx subdir('tools')
   362         kx subdir('pdb')
   362         kx 
   362         kx # Translations
   362         kx subdir('po')
   362         kx subdir('po-libgimp')
   362         kx subdir('po-plug-ins')
   362         kx subdir('po-python')
   362         kx subdir('po-script-fu')
   362         kx subdir('po-tags')
   362         kx subdir('po-tips')
   362         kx # Data / Desktop / xml files
   362         kx subdir('cursors')
   362         kx subdir('data')
   362         kx subdir('desktop')
   362         kx subdir('etc')
   362         kx subdir('icons')
   362         kx subdir('menus')
   362         kx subdir('themes')
   362         kx 
   362         kx # Libraries (order here is important!)
   362         kx subdir('libgimpcolor')
   362         kx subdir('libgimpmath')
   362         kx subdir('libgimpconfig')
   362         kx subdir('libgimpmodule')
   362         kx subdir('libgimpthumb')
   362         kx subdir('libgimpwidgets')
   362         kx subdir('libgimp')
   362         kx 
   362         kx # Executables, plugins
   362         kx subdir('extensions')
   362         kx subdir('modules')
   362         kx subdir('plug-ins')
   362         kx subdir('app')
   362         kx subdir('app-tools')
   362         kx 
   362         kx # Docs
   362         kx subdir('docs')
   362         kx subdir('devel-docs')
   362         kx 
   362         kx # Windows installer
   362         kx if get_option('windows-installer')
   362         kx   subdir('po-windows-installer')
   362         kx   subdir('build/windows/installer')
   362         kx endif
   362         kx 
   362         kx pkgconfig.generate(libgimp,
   362         kx   filebase: 'gimp-' + gimp_api_version,
   362         kx   name: prettyname,
   362         kx   description: 'GIMP Library',
   362         kx   version: gimp_version,
   362         kx   requires: [
   362         kx     gdk_pixbuf,
   362         kx     cairo,
   362         kx     gegl,
   362         kx   ],
   362         kx   libraries: [
   362         kx     libgimpbase,
   362         kx     libgimpcolor,
   362         kx     libgimpconfig,
   362         kx     libgimpmath,
   362         kx   ],
   362         kx   subdirs: [
   362         kx     gimp_api_name,
   362         kx   ],
   362         kx   variables: [
   362         kx     'datarootdir='    +'${prefix}/'+ get_option('datadir'),
   362         kx     'gimpdatadir='    +'${prefix}/'+ gimpdatadir,
   362         kx     'gimplibdir='     +'${prefix}/'+ gimpplugindir,
   362         kx     'gimpsysconfdir=' + gimpsysconfdir,
   362         kx     'gimplocaledir='  +'${prefix}/'+ localedir,
   362         kx   ],
   362         kx )
   362         kx 
   362         kx pkgconfig.generate(libgimpthumb,
   362         kx   filebase: 'gimpthumb-' + gimp_api_version,
   362         kx   name: 'GIMP Thumb',
   362         kx   description: 'GIMP Thumbnail Library',
   362         kx   version: gimp_version,
   362         kx   requires: [
   362         kx     libgimp,
   362         kx     gdk_pixbuf,
   362         kx   ],
   362         kx   subdirs: [
   362         kx     gimp_api_name,
   362         kx   ],
   362         kx )
   362         kx 
   362         kx pkgconfig.generate(libgimpui,
   362         kx   filebase: 'gimpui-' + gimp_api_version,
   362         kx   name: 'GIMP UI',
   362         kx   description: 'GIMP User Interface Library',
   362         kx   version: gimp_version,
   362         kx   requires: [
   362         kx     libgimp,
   362         kx     gtk3,
   362         kx   ],
   362         kx   libraries: [
   362         kx     libgimpwidgets,
   362         kx     libgimpmodule,
   362         kx   ],
   362         kx   subdirs: [
   362         kx     gimp_api_name,
   362         kx   ],
   362         kx )
   362         kx 
   362         kx 
   362         kx 
   362         kx ################################################################################
   362         kx # Subdir installations
   362         kx 
   362         kx foreach dir : [
   362         kx     { 'dir': 'libgimp',        'deps': libgimp},
   362         kx     { 'dir': 'libgimpbase',    'deps': libgimpbase},
   362         kx     { 'dir': 'libgimpcolor',   'deps': libgimpcolor},
   362         kx     { 'dir': 'libgimpconfig',  'deps': libgimpconfig},
   362         kx     { 'dir': 'libgimpmath',    'deps': libgimpmath},
   362         kx     { 'dir': 'libgimpmodule',  'deps': libgimpmodule},
   362         kx     { 'dir': 'libgimpthumb',   'deps': libgimpthumb},
   362         kx     { 'dir': 'libgimpwidgets', 'deps': libgimpwidgets},
   362         kx     { 'dir': 'icons' },
   362         kx     { 'dir': 'plug-ins', },
   362         kx     { 'dir': 'extensions', },
   362         kx   ]
   362         kx   run_target('install-' + dir.get('dir'),
   362         kx     command: [
   362         kx       meson_install_subdir, '-v', dir.get('dir')
   362         kx     ],
   362         kx     depends: dir.get('deps', [])
   362         kx   )
   362         kx endforeach
   362         kx 
   362         kx ################################################################################
   362         kx 
   362         kx final_message = [
   362         kx '''Extra Binaries:''',
   362         kx '''  gimp-console:        @0@'''.format(enable_console_bin),
   362         kx '',
   362         kx '''Optional Features:''',
   362         kx '''  Check updates at startup:  @0@'''.format(check_update),
   362         kx '''  Language selection:        @0@'''.format(isocodes.found()),
   362         kx '''  Vector icons:              @0@'''.format(have_vector_icons),
   362         kx '''  Dr. Mingw (Win32):         @0@'''.format(drmingw.found()),
   362         kx '''  Relocatable Bundle:        @0@'''.format(relocatable_bundle),
   362         kx '''  Default ICC directory:     @0@'''.format(icc_directory),
   362         kx '''  32-bit DLL folder (Win32): @0@'''.format(get_option('win32-32bits-dll-folder')),
   362         kx '''  Detailed backtraces:       @0@'''.format(detailed_backtraces),
   362         kx '''  Binary symlinks:           @0@'''.format(enable_default_bin),
   362         kx '''  OpenMP:                    @0@'''.format(have_openmp),
   362         kx '',
   362         kx '''Optional Plug-Ins:''',
   362         kx '''  Ascii Art:           @0@'''.format(libaa.found()),
   362         kx '''  Ghostscript:         @0@'''.format(ghostscript.found()),
   362         kx '''  JPEG 2000:           @0@'''.format(openjpeg.found()),
   362         kx '''  JPEG XL:             @0@'''.format(libjxl.found()),
   362         kx '''  MNG:                 @0@'''.format(libmng.found()),
   362         kx '''  OpenEXR:             @0@'''.format(openexr.found()),
   362         kx '''  WebP:                @0@'''.format(webp_found),
   362         kx '''  HEIC:                import: @0@ - export: @1@ [profile support: @2@]@3@'''
   362         kx                                 .format(can_import_heic, can_export_heic,
   362         kx                                         (can_import_heic or can_export_heic) and
   362         kx                                         libheif.version().version_compare('>=1.4.0'),
   362         kx                                         libheif_warning != '' ? ' (see warning below)' : ''),
   362         kx '''  AVIF:                import: @0@ - export: @1@'''
   362         kx                                 .format(can_import_avif, can_export_avif),
   362         kx '''  PDF (export):        @0@'''.format(cairopdf.found()),
   362         kx '''  Print:               @0@'''.format(have_print),
   362         kx '''  Python 3 plug-ins:   @0@'''.format(have_python),
   362         kx '''  Javascript plug-ins: @0@'''.format(have_javascript),
   362         kx '''  Lua plug-ins:        @0@'''.format(have_lua),
   362         kx '''  Vala plug-ins:       @0@'''.format(have_vala),
   362         kx '''  TWAIN (Win32):       @0@'''.format(platform_windows),
   362         kx '''  WMF:                 @0@'''.format(wmf.found()),
   362         kx '''  X11 Mouse Cursor:    @0@'''.format(xmc.found()),
   362         kx '''  XPM:                 @0@'''.format(libxpm.found()),
   362         kx '''  Quite-OK Image:      @0@'''.format(have_qoi),
   362         kx '''  Amiga IFF/ILBM:      @0@'''.format(have_ilbm),
   362         kx '''  Email:               @0@'''.format(email_message),
   362         kx '''  FITS:                @0@'''.format(cfitsio_dep.found()),
   362         kx '',
   362         kx '''Unmaintained Plug-Ins (discouraged except for developers):''',
   362         kx '''  Help Browser:        @0@'''.format(get_option('webkit-unmaintained')),
   362         kx '''  Webpage:             @0@'''.format(get_option('webkit-unmaintained')),
   362         kx '',
   362         kx '''Optional Modules:''',
   362         kx '''  ALSA (MIDI Input):   @0@'''.format(alsa.found()),
   362         kx '''  Linux Input:         @0@ (GUdev support: @1@)'''
   362         kx                                 .format(have_linuxinput, gudev.found()),
   362         kx '''  DirectInput (Win32): @0@'''.format(directx.found()),
   362         kx '',
   362         kx '''Tests:''',
   362         kx '''  Use xvfb-run         @0@'''.format(xvfb_run.found()),
   362         kx '''  Test appdata         @0@'''.format(appstreamcli.found()),
   362         kx '',
   362         kx '''Documentation:''',
   362         kx '''  libgimp API Reference: @0@'''.format(gi_docgen.found() and have_gobject_introspection),
   362         kx '''  GObject Introspection: @0@'''.format(get_option('g-ir-doc')),
   362         kx '',
   362         kx '''Bug report URL: @0@'''.format(bug_report_url),
   362         kx ]
   362         kx 
   362         kx message('\n'.join(final_message))
   362         kx 
   362         kx if warnings.length() > 0
   362         kx   warning('Warnings occurred during configuration')
   362         kx   foreach warning : warnings
   362         kx     warning(warning)
   362         kx   endforeach
   362         kx endif