From cb2268ab21e1aed70361b37bbbc3308ea7b5db70 Mon Sep 17 00:00:00 2001 From: Jehan Date: Mon, 19 Oct 2020 18:52:18 +0200 Subject: [PATCH] meson: separate line for HEIC and AVIF support. libheif pc files provides variables which are actually older than our minimum libheif requirement (so it's usable generically) to determinate if libheif was built for HEIC/AVIF support. This is quite useful as we had our share of annoyance with missing support of some encoder/decoder even when libheif requirement was alright. Also adding image/avif (if relevant decoder is present) to list of supported mimetypes. --- meson.build | 57 ++++++++++++++++++++++++++----------- plug-ins/common/meson.build | 2 +- 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/meson.build b/meson.build index 08caeb0e8f..21cffaf761 100644 --- a/meson.build +++ b/meson.build @@ -728,22 +728,45 @@ libheif = dependency('libheif', version: '>='+libheif_minver, conf.set('HAVE_LIBHEIF_1_4_0', libheif.version().version_compare('>=1.4.0')) conf.set('HAVE_LIBHEIF_1_6_0', libheif.version().version_compare('>=1.6.0')) -if libheif.found() - MIMEtypes += [ - 'image/heif', - 'image/heic', - ] -endif +can_import_heic = 'no' +can_export_heic = 'no' +can_import_avif = 'no' +can_export_avif = 'no' +have_heif = libheif.found() libheif_warning='' -if libheif.version().version_compare('==1.5.0') or libheif.version().version_compare('==1.5.1') - libheif_warning=''' +if have_heif + have_heif = true + can_import_heic = libheif.get_pkgconfig_variable('builtin_h265_decoder') + can_export_heic = libheif.get_pkgconfig_variable('builtin_h265_encoder') + if can_import_heic == 'yes' + MIMEtypes += [ + 'image/heif', + 'image/heic', + ] + endif - libheif version 1.5.0 and 1.5.1 are known to crash when - exporting (bug #4185). Please update. - ''' - warning(libheif_warning) - warnings += libheif_warning + can_import_avif = libheif.get_pkgconfig_variable('builtin_avif_decoder') + can_export_avif = libheif.get_pkgconfig_variable('builtin_avif_encoder') + if can_import_avif == 'yes' + MIMEtypes += [ + 'image/avif' + ] + endif + + if can_import_heic != 'yes' and can_import_avif != 'yes' + have_heif = false + endif + + if have_heif and (libheif.version().version_compare('==1.5.0') or libheif.version().version_compare('==1.5.1')) + libheif_warning=''' + + libheif version 1.5.0 and 1.5.1 are known to crash when + exporting (bug #4185). Please update. + ''' + warning(libheif_warning) + warnings += libheif_warning + endif endif have_vala = add_languages('vala', required: get_option('vala-plugins')) @@ -1752,10 +1775,12 @@ final_message = [ ''' MNG: @0@'''.format(libmng.found()), ''' OpenEXR: @0@'''.format(openexr.found()), ''' WebP: @0@'''.format(webp_found), -''' Heif: @0@ [profile support: @1@@2@]''' - .format(libheif.found(), +''' HEIC: import: @0@ - export: @1@ [profile support: @2@]@3@''' + .format(can_import_heic, can_export_heic, libheif.version().version_compare('>=1.4.0'), - libheif_warning != '' ? ' (see warning below)' : ''), + libheif_warning != '' ? ' (see warning below)' : ''), +''' AVIF: import: @0@ - export: @1@''' + .format(can_import_avif, can_export_avif), ''' PDF (export): @0@'''.format(cairopdf.found()), ''' Print: @0@'''.format(have_print), ''' Python 3 plug-ins: @0@'''.format(have_python), diff --git a/plug-ins/common/meson.build b/plug-ins/common/meson.build index 1e11436d0f..f459aa9f92 100644 --- a/plug-ins/common/meson.build +++ b/plug-ins/common/meson.build @@ -91,7 +91,7 @@ if libaa.found() } endif -if libheif.found() +if have_heif common_plugins_list += { 'name': 'file-heif', 'deps': [ gtk3, gegl, libheif, gexiv2, lcms, ], }