Control: tags -1 patch

Hi maintainers,

the attached patch changes the detection so that for libheif >= 1.14.0 (where the split 
up into codec plugins happened), support for heic/avif is assumed to be available at 
compile-time. The actual check for codec support happens at run-time, so if a libheif codec 
is missing then (e.g. because a "Recommended" plugin is not available), the Gimp 
plugin will not register the affected file types.

Best regards,
  Joachim
From: Joachim Bauch <[email protected]>
Date: Mon, 21 Oct 2024 08:47:12 +0200
Subject: libheif: Fix codec detection for libheif >= 1.14.0
Forwarded: https://gitlab.gnome.org/GNOME/gimp/-/issues/11929

Codecs are split up into plugins for libheif >= 1.14.0. Support will be checked
at runtime, so assume heic/avif codecs are available (which they will be for
packaged libheif).

Index: gimp-2.10.38/configure.ac
===================================================================
--- gimp-2.10.38.orig/configure.ac
+++ gimp-2.10.38/configure.ac
@@ -1808,6 +1808,9 @@ AM_CONDITIONAL(HAVE_WEBP, test "x$have_w
 AC_ARG_WITH(libheif, [  --without-libheif       build without libheif support])

 # Overcomplex tests, but basically:
+# - Codecs split up into plugins for libheif >= 1.14.0. Support will be checked
+# at runtime, so assume heic/avif codecs are available (which they will be for
+# packaged libheif).
 # - Profiles supported only for libheif >= 1.4.0.
 # - libheif 1.5.0 and 1.5.1 are very broken and easily crash.
 # As a consequence we prioritize any libheif other than these 2 versions
@@ -1815,25 +1818,31 @@ AC_ARG_WITH(libheif, [  --without-libhei
 # these as last resort, outputting a warning.
 have_libheif=no
 have_libheif_1_4_0=no
+have_libheif_plugins=no
 if test "x$with_libheif" != xno; then
   have_libheif_1_4_0=yes
+  have_libheif_plugins=yes
   have_libheif=yes
-  PKG_CHECK_MODULES(LIBHEIF, libheif > 1.5.1,,
+  PKG_CHECK_MODULES(LIBHEIF, libheif >= 1.14.0,,
     [
-      PKG_CHECK_MODULES(LIBHEIF, libheif = 1.4.0,,
+      have_libheif_plugins="no (libheif >= 1.14.0 not found)"
+      PKG_CHECK_MODULES(LIBHEIF, libheif > 1.5.1,,
         [
-          have_libheif_1_4_0="no (libheif >= 1.4.0 not found)"
-          PKG_CHECK_MODULES(LIBHEIF, libheif = libheif_required_version,,
-                            [
-                              PKG_CHECK_MODULES(LIBHEIF, libheif >= 1.5.0,
-                                                [
-                                                  have_libheif_1_4_0=yes
-                                                  warning_libheif="
+          PKG_CHECK_MODULES(LIBHEIF, libheif = 1.4.0,,
+            [
+              have_libheif_1_4_0="no (libheif >= 1.4.0 not found)"
+              PKG_CHECK_MODULES(LIBHEIF, libheif = libheif_required_version,,
+                                [
+                                  PKG_CHECK_MODULES(LIBHEIF, libheif >= 1.5.0,
+                                                    [
+                                                      have_libheif_1_4_0=yes
+                                                      warning_libheif="
 WARNING: libheif version 1.5.0 and 1.5.1 are known to crash when
          exporting (bug #4185). Please update."
-                                                ],
-                                                [ have_libheif="no (libheif not found)" ])
-                            ])
+                                                    ],
+                                                    [ have_libheif="no (libheif not found)" ])
+                                ])
+            ])
         ])
     ])
 fi
@@ -1843,13 +1852,23 @@ can_export_heic=no
 can_import_avif=no
 can_export_avif=no
 if test "x$have_libheif" = xyes; then
-  can_import_heic=`$PKG_CONFIG --variable=builtin_h265_decoder libheif`
-  can_export_heic=`$PKG_CONFIG --variable=builtin_h265_encoder libheif`
+  if test "x$have_libheif_plugins" = xyes; then
+    can_import_heic=yes
+    can_export_heic=yes
+  else
+    can_import_heic=`$PKG_CONFIG --variable=builtin_h265_decoder libheif`
+    can_export_heic=`$PKG_CONFIG --variable=builtin_h265_encoder libheif`
+  fi
   if test "x$can_import_heic" = xyes; then
     MIME_TYPES="$MIME_TYPES;image/heif;image/heic"
   fi
-  can_import_avif=`$PKG_CONFIG --variable=builtin_avif_decoder libheif`
-  can_export_avif=`$PKG_CONFIG --variable=builtin_avif_encoder libheif`
+  if test "x$have_libheif_plugins" = xyes; then
+    can_import_avif=yes
+    can_export_avif=yes
+  else
+    can_import_avif=`$PKG_CONFIG --variable=builtin_avif_decoder libheif`
+    can_export_avif=`$PKG_CONFIG --variable=builtin_avif_encoder libheif`
+  fi
   if test "x$can_import_avif" = xyes; then
     MIME_TYPES="$MIME_TYPES;image/avif"
   fi
@@ -1857,6 +1876,7 @@ if test "x$have_libheif" = xyes; then
   if test "x$can_import_heic" != xyes && test "x$can_import_avif" != xyes; then
     have_libheif=no
     have_libheif_1_4_0=no
+    have_libheif_plugins=no
     warning_libheif=""
   else
     FILE_HEIF='file-heif$(EXEEXT)'

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to