diff -urN gimp-2.10.38-orig/app/core/gimpimage.c gimp-2.10.38/app/core/gimpimage.c
--- gimp-2.10.38-orig/app/core/gimpimage.c	2024-05-03 09:33:34 +0900
+++ gimp-2.10.38/app/core/gimpimage.c	2024-06-23 22:29:27 +0900
@@ -23,7 +23,9 @@
 #include <cairo.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <gegl.h>
+#if HAVE_GEXIV2
 #include <gexiv2/gexiv2.h>
+#endif
 
 #include "libgimpcolor/gimpcolor.h"
 #include "libgimpmath/gimpmath.h"
@@ -682,7 +684,11 @@
 
   g_object_class_install_property (object_class, PROP_METADATA,
                                    g_param_spec_object ("metadata", NULL, NULL,
+#if HAVE_GEXIV2
                                                         GEXIV2_TYPE_METADATA,
+#else
+                                                        G_TYPE_OBJECT,
+#endif
                                                         GIMP_PARAM_READABLE));
 
   g_object_class_override_property (object_class, PROP_BUFFER, "buffer");
diff -urN gimp-2.10.38-orig/app/sanity.c gimp-2.10.38/app/sanity.c
--- gimp-2.10.38-orig/app/sanity.c	2024-05-03 09:33:34 +0900
+++ gimp-2.10.38/app/sanity.c	2024-06-23 22:29:27 +0900
@@ -23,7 +23,9 @@
 #include <pango/pangoft2.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <lcms2.h>
+#if HAVE_GEXIV2
 #include <gexiv2/gexiv2.h>
+#endif
 #include <gegl.h>
 
 #include "libgimpbase/gimpbase.h"
diff -urN gimp-2.10.38-orig/config.h.in gimp-2.10.38/config.h.in
--- gimp-2.10.38-orig/config.h.in	2024-05-03 09:36:29 +0900
+++ gimp-2.10.38/config.h.in	2024-06-23 22:29:27 +0900
@@ -146,6 +146,9 @@
 /* Define if the GNU gettext() function is already present or preinstalled. */
 #undef HAVE_GETTEXT
 
+/* Define to 1 if the gexiv2 library is available. */
+#undef HAVE_GEXIV2
+
 /* Define to 1 if you have the <ieeefp.h> header file. */
 #undef HAVE_IEEEFP_H
 
diff -urN gimp-2.10.38-orig/configure gimp-2.10.38/configure
--- gimp-2.10.38-orig/configure	2024-05-03 09:36:33 +0900
+++ gimp-2.10.38/configure	2024-06-23 22:29:27 +0900
@@ -848,6 +848,8 @@
 HAVE_EXCHNDL_TRUE
 GEXIV2_LIBS
 GEXIV2_CFLAGS
+HAVE_GEXIV2_FALSE
+HAVE_GEXIV2_TRUE
 HARFBUZZ_LIBS
 HARFBUZZ_CFLAGS
 FREETYPE_LIBS
@@ -26280,33 +26282,13 @@
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
-        _pkg_short_errors_supported=yes
-else
-        _pkg_short_errors_supported=no
-fi
-        if test $_pkg_short_errors_supported = yes; then
-	        GEXIV2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gexiv2 >= 0.10.6" 2>&1`
-        else
-	        GEXIV2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gexiv2 >= 0.10.6" 2>&1`
-        fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$GEXIV2_PKG_ERRORS" >&5
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: Eeeeeeeeeeeeeeeeeeeeek! Missing dep: gexiv2 >= 0.10.6" >&5
-$as_echo "$as_me: Eeeeeeeeeeeeeeeeeeeeek! Missing dep: gexiv2 >= 0.10.6" >&6;}
-  required_deps="$required_deps
-  - Error: missing dependency gexiv2 >= 0.10.6"
+have_gexiv2=no
 
 elif test $pkg_failed = untried; then
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: Eeeeeeeeeeeeeeeeeeeeek! Missing dep: gexiv2 >= 0.10.6" >&5
-$as_echo "$as_me: Eeeeeeeeeeeeeeeeeeeeek! Missing dep: gexiv2 >= 0.10.6" >&6;}
-  required_deps="$required_deps
-  - Error: missing dependency gexiv2 >= 0.10.6"
+have_gexiv2=no
 
 else
 	GEXIV2_CFLAGS=$pkg_cv_GEXIV2_CFLAGS
@@ -26314,6 +26296,17 @@
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
+have_gexiv2=yes
+$as_echo "#define HAVE_GEXIV2 1" >>confdefs.h
+
+fi
+
+if test "x$have_gexiv2" = xyes; then
+  HAVE_GEXIV2_TRUE=
+  HAVE_GEXIV2_FALSE='#'
+else
+  HAVE_GEXIV2_TRUE='#'
+  HAVE_GEXIV2_FALSE=
 fi
 
 #################################
diff -urN gimp-2.10.38-orig/configure.ac gimp-2.10.38/configure.ac
--- gimp-2.10.38-orig/configure.ac	2024-05-03 09:33:34 +0900
+++ gimp-2.10.38/configure.ac	2024-06-23 22:29:27 +0900
@@ -910,8 +910,12 @@
 PKG_CHECK_MODULES(HARFBUZZ, harfbuzz >= harfbuzz_required_version,,
                  [add_deps_error([harfbuzz >= harfbuzz_required_version])])
 
-PKG_CHECK_MODULES(GEXIV2, gexiv2 >= gexiv2_required_version,,
-                 [add_deps_error([gexiv2 >= gexiv2_required_version])])
+PKG_CHECK_MODULES(GEXIV2, gexiv2 >= gexiv2_required_version,
+                 [have_gexiv2=yes
+                  AC_DEFINE(HAVE_GEXIV2, 1,
+                            [Define to 1 if the gexiv2 library is available.])],
+                 [have_gexiv2=no])
+AM_CONDITIONAL(HAVE_GEXIV2, test "x$have_gexiv2" = xyes)
 
 #################################
 # Check for debug console (Win32)
diff -urN gimp-2.10.38-orig/libgimp/gimpimagemetadata.c gimp-2.10.38/libgimp/gimpimagemetadata.c
--- gimp-2.10.38-orig/libgimp/gimpimagemetadata.c	2024-05-03 09:33:35 +0900
+++ gimp-2.10.38/libgimp/gimpimagemetadata.c	2024-06-23 22:29:27 +0900
@@ -24,7 +24,9 @@
 #include <sys/time.h>
 
 #include <gtk/gtk.h>
+#if HAVE_GEXIV2
 #include <gexiv2/gexiv2.h>
+#endif
 
 #include "gimp.h"
 #include "gimpui.h"
@@ -39,6 +41,7 @@
   gint  type;
 } XmpStructs;
 
+#if HAVE_GEXIV2
 static gchar *     gimp_image_metadata_interpret_comment    (gchar *comment);
 
 static void        gimp_image_metadata_rotate        (gint32             image_ID,
@@ -52,6 +55,7 @@
 static gboolean    gimp_image_metadata_rotate_dialog (gint32             image_ID,
                                                       GExiv2Orientation  orientation,
                                                       const gchar       *parasite_name);
+#endif
 
 
 /*  public functions  */
@@ -142,6 +146,7 @@
 {
   g_return_if_fail (image_ID > 0);
   g_return_if_fail (mime_type != NULL);
+#if HAVE_GEXIV2
   g_return_if_fail (GEXIV2_IS_METADATA (metadata));
 
   if (flags & GIMP_METADATA_LOAD_COMMENT)
@@ -230,6 +235,7 @@
     }
 
   gimp_image_set_metadata (image_ID, metadata);
+#endif
 }
 
 /**
@@ -269,6 +275,7 @@
   g_return_val_if_fail (mime_type != NULL, NULL);
   g_return_val_if_fail (suggested_flags != NULL, NULL);
 
+#if HAVE_GEXIV2
   *suggested_flags = GIMP_METADATA_SAVE_ALL;
 
   metadata = gimp_image_get_metadata (image_ID);
@@ -412,10 +419,16 @@
 
   if (! gimp_export_color_profile ())
     *suggested_flags &= ~GIMP_METADATA_SAVE_COLOR_PROFILE;
+#else  // !HAVE_GEXIV2
+  metadata = NULL;
+  *suggested_flags = 0;
+#endif
 
   return metadata;
 }
 
+#if HAVE_GEXIV2
+
 static const gchar *
 gimp_fix_xmp_tag (const gchar *tag)
 {
@@ -586,6 +599,8 @@
   g_free (prev_two);
 }
 
+#endif  // HAVE_GEXIV2
+
 /**
  * gimp_image_metadata_save_finish:
  * @image_ID:  The image
@@ -612,7 +627,9 @@
                                  GError                **error)
 {
   GimpMetadata   *new_metadata;
+#if HAVE_GEXIV2
   GExiv2Metadata *new_g2metadata;
+#endif
   gboolean        support_exif;
   gboolean        support_xmp;
   gboolean        support_iptc;
@@ -621,10 +638,13 @@
 
   g_return_val_if_fail (image_ID > 0, FALSE);
   g_return_val_if_fail (mime_type != NULL, FALSE);
+#if HAVE_GEXIV2
   g_return_val_if_fail (GEXIV2_IS_METADATA (metadata), FALSE);
+#endif
   g_return_val_if_fail (G_IS_FILE (file), FALSE);
   g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
+#if HAVE_GEXIV2
   if (! (flags & (GIMP_METADATA_SAVE_EXIF |
                   GIMP_METADATA_SAVE_XMP  |
                   GIMP_METADATA_SAVE_IPTC |
@@ -833,6 +853,9 @@
   success = gimp_metadata_save_to_file (new_metadata, file, error);
 
   g_object_unref (new_metadata);
+#else  // HAVE_GEXIV2
+  success = FALSE;
+#endif
 
   return success;
 }
@@ -851,6 +874,7 @@
   g_return_val_if_fail (G_IS_FILE (file), -1);
   g_return_val_if_fail (error == NULL || *error == NULL, -1);
 
+#if HAVE_GEXIV2
   metadata = gimp_metadata_load_from_file (file, error);
   if (! metadata)
     return -1;
@@ -892,6 +916,7 @@
     }
 
   g_object_unref (metadata);
+#endif
 
   return image_ID;
 }
@@ -899,6 +924,8 @@
 
 /*  private functions  */
 
+#if HAVE_GEXIV2
+
 static void
 gimp_image_metadata_rotate (gint32             image_ID,
                             GExiv2Orientation  orientation)
@@ -1202,3 +1229,5 @@
 
   return (response == GTK_RESPONSE_OK);
 }
+
+#endif  // HAVE_GEXIV2
diff -urN gimp-2.10.38-orig/libgimpbase/gimpmetadata.c gimp-2.10.38/libgimpbase/gimpmetadata.c
--- gimp-2.10.38-orig/libgimpbase/gimpmetadata.c	2024-05-03 09:33:35 +0900
+++ gimp-2.10.38/libgimpbase/gimpmetadata.c	2024-06-23 22:29:27 +0900
@@ -26,7 +26,9 @@
 #include <string.h>
 
 #include <gio/gio.h>
+#if HAVE_GEXIV2
 #include <gexiv2/gexiv2.h>
+#endif
 
 #include "libgimpmath/gimpmath.h"
 
@@ -43,7 +45,11 @@
 
 struct _GimpMetadata
 {
+#if HAVE_GEXIV2
   GExiv2Metadata parent_instance;
+#else
+  GObject parent_instance;
+#endif
 };
 
 struct _GimpMetadataPrivate
@@ -54,7 +60,11 @@
 
 struct _GimpMetadataClass
 {
+#if HAVE_GEXIV2
   GExiv2MetadataClass parent_class;
+#else
+  GObjectClass parent_class;
+#endif
 
   /* Padding for future expansion */
   void (*_gimp_reserved1) (void);
@@ -83,6 +93,7 @@
 #define GIMP_METADATA_ERROR gimp_metadata_error_quark ()
 
 static GQuark   gimp_metadata_error_quark (void);
+#if HAVE_GEXIV2
 static void     gimp_metadata_copy_tag    (GExiv2Metadata  *src,
                                            GExiv2Metadata  *dest,
                                            const gchar     *tag);
@@ -91,6 +102,7 @@
                                            const gchar    **tags);
 static void     gimp_metadata_add         (GimpMetadata    *src,
                                            GimpMetadata    *dest);
+#endif
 
 
 static const gchar *tiff_tags[] =
@@ -200,12 +212,17 @@
 
 static const guint wilber_jpg_len = G_N_ELEMENTS (wilber_jpg);
 
+#if HAVE_GEXIV2
 G_DEFINE_TYPE_WITH_PRIVATE (GimpMetadata, gimp_metadata, GEXIV2_TYPE_METADATA)
+#else
+G_DEFINE_TYPE_WITH_PRIVATE (GimpMetadata, gimp_metadata, G_TYPE_OBJECT)
+#endif
 
 
 static void
 gimp_metadata_class_init (GimpMetadataClass *klass)
 {
+#if HAVE_GEXIV2
   if (! gexiv2_metadata_register_xmp_namespace ("http://ns.adobe.com/DICOM/",
                                                 "DICOM"))
     {
@@ -224,6 +241,7 @@
     {
       g_printerr ("Failed to register XMP namespace 'GIMP'\n");
     }
+#endif
 }
 
 static void
@@ -336,6 +354,7 @@
 
   g_return_if_fail (GIMP_IS_METADATA (metadata));
 
+#if HAVE_GEXIV2
   /* Update new Instance ID */
   uuid = gimp_metadata_get_guid ();
 
@@ -489,6 +508,7 @@
 
   gexiv2_metadata_set_tag_string (GEXIV2_METADATA (metadata),
                                   tagstr, strdata);
+#endif
 }
 
 /**
@@ -505,6 +525,7 @@
 {
   GimpMetadata *metadata = NULL;
 
+#if HAVE_GEXIV2
   if (gexiv2_initialize ())
     {
       metadata = g_object_new (GIMP_TYPE_METADATA, NULL);
@@ -518,6 +539,7 @@
           return NULL;
         }
     }
+#endif
 
   return metadata;
 }
@@ -551,6 +573,8 @@
   return new_metadata;
 }
 
+#if HAVE_GEXIV2
+
 typedef struct
 {
   gchar         name[1024];
@@ -716,6 +740,8 @@
   g_printerr ("Metadata parse error: %s\n", error->message);
 }
 
+#endif  // HAVE_GEXIV2
+
 /**
  * gimp_metadata_deserialize:
  * @metadata_xml: A string of serialized metadata XML.
@@ -731,12 +757,15 @@
 gimp_metadata_deserialize (const gchar *metadata_xml)
 {
   GimpMetadata          *metadata;
+#if HAVE_GEXIV2
   GMarkupParser          markup_parser;
   GimpMetadataParseData  parse_data;
   GMarkupParseContext   *context;
+#endif
 
   g_return_val_if_fail (metadata_xml != NULL, NULL);
 
+#if HAVE_GEXIV2
   metadata = gimp_metadata_new ();
 
   parse_data.metadata = metadata;
@@ -755,10 +784,15 @@
                                 NULL);
 
   g_markup_parse_context_unref (context);
+#else
+  metadata = NULL;
+#endif
 
   return metadata;
 }
 
+#if HAVE_GEXIV2
+
 static gchar *
 gimp_metadata_escape (const gchar *name,
                       const gchar *value,
@@ -806,6 +840,8 @@
     }
 }
 
+#endif  // HAVE_GEXIV2
+
 /**
  * gimp_metadata_serialize:
  * @metadata: A #GimpMetadata instance.
@@ -831,6 +867,7 @@
 
   g_return_val_if_fail (GIMP_IS_METADATA (metadata), NULL);
 
+#if HAVE_GEXIV2
   string = g_string_new (NULL);
 
   g_string_append (string, "<?xml version='1.0' encoding='UTF-8'?>\n");
@@ -954,6 +991,9 @@
   g_string_append (string, "</metadata>\n");
 
   return g_string_free (string, FALSE);
+#else  // !HAVE_GEXIV2
+  return NULL;
+#endif
 }
 
 /**
@@ -978,6 +1018,7 @@
   g_return_val_if_fail (G_IS_FILE (file), NULL);
   g_return_val_if_fail (error == NULL || *error == NULL, NULL);
 
+#if HAVE_GEXIV2
   path = g_file_get_path (file);
 
   if (! path)
@@ -1005,6 +1046,7 @@
     }
 
   g_free (filename);
+#endif
 
   return meta;
 }
@@ -1034,6 +1076,7 @@
   g_return_val_if_fail (G_IS_FILE (file), FALSE);
   g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
+#if HAVE_GEXIV2
   path = g_file_get_path (file);
 
   if (! path)
@@ -1051,6 +1094,9 @@
                                        filename, error);
 
   g_free (filename);
+#else
+  success = FALSE;
+#endif
 
   return success;
 }
@@ -1084,6 +1130,7 @@
   g_return_val_if_fail (exif_data != NULL || exif_data_length == 0, FALSE);
   g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
+#if HAVE_GEXIV2
   if (exif_data_length < 0 || exif_data_length + 2 >= 65536)
     {
       g_set_error (error, GIMP_METADATA_ERROR, 0,
@@ -1127,6 +1174,9 @@
   g_byte_array_free (exif_bytes, TRUE);
 
   return TRUE;
+#else  // !HAVE_GEXIV2
+  return FALSE;
+#endif
 }
 
 /**
@@ -1154,6 +1204,7 @@
   g_return_val_if_fail (iptc_data != NULL || iptc_data_length == 0, FALSE);
   g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
+#if HAVE_GEXIV2
   iptc_metadata = gimp_metadata_new ();
 
   if (! gexiv2_metadata_open_buf (GEXIV2_METADATA (iptc_metadata),
@@ -1175,6 +1226,9 @@
   g_object_unref (iptc_metadata);
 
   return TRUE;
+#else  // !HAVE_GEXIV2
+  return FALSE;
+#endif
 }
 
 /**
@@ -1202,6 +1256,7 @@
   g_return_val_if_fail (xmp_data != NULL || xmp_data_length == 0, FALSE);
   g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
+#if HAVE_GEXIV2
   xmp_metadata = gimp_metadata_new ();
 
   if (! gexiv2_metadata_open_buf (GEXIV2_METADATA (xmp_metadata),
@@ -1223,6 +1278,9 @@
   g_object_unref (xmp_metadata);
 
   return TRUE;
+#else  // !HAVE_GEXIV2
+  return FALSE;
+#endif
 }
 
 /**
@@ -1246,6 +1304,7 @@
 
   g_return_if_fail (GIMP_IS_METADATA (metadata));
 
+#if HAVE_GEXIV2
   g_snprintf (buffer, sizeof (buffer), "%d", width);
   gexiv2_metadata_set_tag_string (GEXIV2_METADATA (metadata),
                                   "Exif.Image.ImageWidth", buffer);
@@ -1267,6 +1326,7 @@
                                       "Exif.Photo.PixelYDimension",
                                       buffer);
     }
+#endif
 }
 
 /**
@@ -1286,10 +1346,12 @@
 
   g_return_if_fail (GIMP_IS_METADATA (metadata));
 
+#if HAVE_GEXIV2
   g_snprintf (buffer, sizeof (buffer), "%d %d %d",
               bits_per_sample, bits_per_sample, bits_per_sample);
   gexiv2_metadata_set_tag_string (GEXIV2_METADATA (metadata),
                                   "Exif.Image.BitsPerSample", buffer);
+#endif
 }
 
 /**
@@ -1317,6 +1379,7 @@
 
   g_return_val_if_fail (GIMP_IS_METADATA (metadata), FALSE);
 
+#if HAVE_GEXIV2
   if (gexiv2_metadata_get_exif_tag_rational (GEXIV2_METADATA (metadata),
                                              "Exif.Image.XResolution",
                                              &xnom, &xdenom) &&
@@ -1370,6 +1433,7 @@
            }
         }
     }
+#endif
 
   return FALSE;
 }
@@ -1398,6 +1462,7 @@
 
   g_return_if_fail (GIMP_IS_METADATA (metadata));
 
+#if HAVE_GEXIV2
   if (gimp_unit_is_metric (unit))
     {
       xres /= 2.54;
@@ -1428,6 +1493,7 @@
   g_snprintf (buffer, sizeof (buffer), "%d", exif_unit);
   gexiv2_metadata_set_tag_string (GEXIV2_METADATA (metadata),
                                   "Exif.Image.ResolutionUnit", buffer);
+#endif
 }
 
 /**
@@ -1450,6 +1516,7 @@
   g_return_val_if_fail (GIMP_IS_METADATA (metadata),
                         GIMP_METADATA_COLORSPACE_UNSPECIFIED);
 
+#if HAVE_GEXIV2
   /*  the logic here was mostly taken from darktable and libkexiv2  */
 
   if (gexiv2_metadata_has_tag (GEXIV2_METADATA (metadata),
@@ -1537,6 +1604,7 @@
       if (exif_cs == 0xffff)
         return GIMP_METADATA_COLORSPACE_UNCALIBRATED;
     }
+#endif
 
   return GIMP_METADATA_COLORSPACE_UNSPECIFIED;
 }
@@ -1556,6 +1624,7 @@
 gimp_metadata_set_colorspace (GimpMetadata           *metadata,
                               GimpMetadataColorspace  colorspace)
 {
+#if HAVE_GEXIV2
   GExiv2Metadata *g2metadata = GEXIV2_METADATA (metadata);
 
   switch (colorspace)
@@ -1611,6 +1680,7 @@
         gexiv2_metadata_set_tag_long (g2metadata, "Exif.Canon.ColorSpace", 0x02);
       break;
     }
+#endif
 }
 
 /**
@@ -1633,6 +1703,7 @@
   g_return_val_if_fail (tag != NULL, FALSE);
   g_return_val_if_fail (mime_type != NULL, FALSE);
 
+#if HAVE_GEXIV2
   for (j = 0; j < G_N_ELEMENTS (unsupported_tags); j++)
     {
       if (g_str_has_prefix (tag, unsupported_tags[j]))
@@ -1663,6 +1734,9 @@
     }
 
   return TRUE;
+#else  // !HAVE_GEXIV2
+  return FALSE;
+#endif
 }
 
 
@@ -1679,6 +1753,8 @@
   return quark;
 }
 
+#if HAVE_GEXIV2
+
 static void
 gimp_metadata_copy_tag (GExiv2Metadata *src,
                         GExiv2Metadata *dest,
@@ -1814,3 +1890,5 @@
         }
     }
 }
+
+#endif  // HAVE_GEXIV2
diff -urN gimp-2.10.38-orig/plug-ins/Makefile.am gimp-2.10.38/plug-ins/Makefile.am
--- gimp-2.10.38-orig/plug-ins/Makefile.am	2024-05-03 09:33:35 +0900
+++ gimp-2.10.38/plug-ins/Makefile.am	2024-06-23 22:29:27 +0900
@@ -24,6 +24,10 @@
 file_webp = file-webp
 endif
 
+if HAVE_GEXIV2
+metadata = metadata
+endif
+
 SUBDIRS = \
 	script-fu		\
 	$(pygimp)		\
@@ -52,7 +56,7 @@
 	imagemap		\
 	lighting		\
 	map-object		\
-	metadata		\
+	$(metadata)		\
 	pagecurl		\
 	$(print)		\
 	screenshot		\
diff -urN gimp-2.10.38-orig/plug-ins/common/file-heif.c gimp-2.10.38/plug-ins/common/file-heif.c
--- gimp-2.10.38-orig/plug-ins/common/file-heif.c	2024-05-03 09:33:35 +0900
+++ gimp-2.10.38/plug-ins/common/file-heif.c	2024-06-23 22:29:27 +0900
@@ -20,7 +20,9 @@
 
 #include <libheif/heif.h>
 #include <lcms2.h>
+#if HAVE_GEXIV2
 #include <gexiv2/gexiv2.h>
+#endif
 
 #include <libgimp/gimp.h>
 #include <libgimp/gimpui.h>
@@ -1189,7 +1191,9 @@
           {
             const guint8 tiffHeaderBE[4] = { 'M', 'M', 0, 42 };
             const guint8 tiffHeaderLE[4] = { 'I', 'I', 42, 0 };
+#if HAVE_GEXIV2
             GExiv2Metadata *exif_metadata = GEXIV2_METADATA (metadata);
+#endif
             const guint8 *tiffheader = exif_data;
             glong new_exif_size = exif_data_size;
 
@@ -1211,11 +1215,13 @@
 
             if (new_exif_size > 4)   /* TIFF header + some data found*/
               {
+#if HAVE_GEXIV2
                 if (! gexiv2_metadata_open_buf (exif_metadata, tiffheader, new_exif_size, error))
                   {
                     g_printerr ("%s: Failed to set EXIF metadata: %s\n", G_STRFUNC, (*error)->message);
                     g_clear_error (error);
                   }
+#endif
               }
             else
               {
@@ -1233,12 +1239,14 @@
               }
           }
 
+#if HAVE_GEXIV2
         gexiv2_metadata_set_orientation (GEXIV2_METADATA (metadata),
                                          GEXIV2_ORIENTATION_NORMAL);
         gexiv2_metadata_set_metadata_pixel_width (GEXIV2_METADATA (metadata),
                                                   width);
         gexiv2_metadata_set_metadata_pixel_height (GEXIV2_METADATA (metadata),
                                                    height);
+#endif
         gimp_image_metadata_load_finish (image_ID, "image/heif",
                                          metadata, flags,
                                          interactive);
diff -urN gimp-2.10.38-orig/plug-ins/common/file-jpegxl.c gimp-2.10.38/plug-ins/common/file-jpegxl.c
--- gimp-2.10.38-orig/plug-ins/common/file-jpegxl.c	2024-05-03 09:33:35 +0900
+++ gimp-2.10.38/plug-ins/common/file-jpegxl.c	2024-06-23 22:29:27 +0900
@@ -20,7 +20,9 @@
 
 #include "config.h"
 
+#if HAVE_GEXIV2
 #include <gexiv2/gexiv2.h>
+#endif
 #include <glib/gstdio.h>
 
 #include <jxl/decode.h>
@@ -697,11 +699,13 @@
 
                       if (new_exif_size > 4) /* TIFF header + some data found*/
                         {
+#if HAVE_GEXIV2
                           if (! gexiv2_metadata_open_buf (GEXIV2_METADATA (metadata), tiffheader, new_exif_size, error))
                             {
                               g_printerr ("%s: Failed to set EXIF metadata: %s\n", G_STRFUNC, (*error)->message);
                               g_clear_error (error);
                             }
+#endif
                         }
                       else
                         {
@@ -718,12 +722,14 @@
                         }
                     }
 
+#if HAVE_GEXIV2
                   gexiv2_metadata_set_orientation (GEXIV2_METADATA (metadata),
                                                    GEXIV2_ORIENTATION_NORMAL);
                   gexiv2_metadata_set_metadata_pixel_width (GEXIV2_METADATA (metadata),
                                                             basicinfo.xsize);
                   gexiv2_metadata_set_metadata_pixel_height (GEXIV2_METADATA (metadata),
                                                              basicinfo.ysize);
+#endif
                   gimp_image_metadata_load_finish (image, "image/jxl", metadata,
                                                    GIMP_METADATA_LOAD_COMMENT | GIMP_METADATA_LOAD_RESOLUTION,
                                                    (run_mode == GIMP_RUN_INTERACTIVE));
diff -urN gimp-2.10.38-orig/plug-ins/file-jpeg/jpeg-load.c gimp-2.10.38/plug-ins/file-jpeg/jpeg-load.c
--- gimp-2.10.38-orig/plug-ins/file-jpeg/jpeg-load.c	2024-05-03 09:33:35 +0900
+++ gimp-2.10.38/plug-ins/file-jpeg/jpeg-load.c	2024-06-23 22:29:27 +0900
@@ -23,7 +23,6 @@
 
 #include <gio/gio.h>
 #include <glib/gstdio.h>
-#include <gexiv2/gexiv2.h>
 
 #include <jpeglib.h>
 #include <jerror.h>
diff -urN gimp-2.10.38-orig/plug-ins/file-tiff/file-tiff-save.c gimp-2.10.38/plug-ins/file-tiff/file-tiff-save.c
--- gimp-2.10.38-orig/plug-ins/file-tiff/file-tiff-save.c	2024-05-03 09:33:35 +0900
+++ gimp-2.10.38/plug-ins/file-tiff/file-tiff-save.c	2024-06-23 22:29:27 +0900
@@ -48,7 +48,9 @@
 #include <string.h>
 
 #include <tiffio.h>
+#if HAVE_GEXIV2
 #include <gexiv2/gexiv2.h>
+#endif
 
 #include <libgimp/gimp.h>
 #include <libgimp/gimpui.h>
@@ -833,6 +835,7 @@
   return status;
 }
 
+#if HAVE_GEXIV2
 /* FIXME Most of the stuff in save_metadata except the
  * thumbnail saving should probably be moved to
  * gimpmetadata.c and gimpmetadata-save.c.
@@ -930,6 +933,7 @@
                                    metadata, metadata_flags,
                                    file, NULL);
 }
+#endif
 
 gboolean
 save_image (GFile                  *file,
@@ -1056,8 +1060,10 @@
   TIFFFlushData (tif);
   TIFFClose (tif);
   tif = NULL;
+#if HAVE_GEXIV2
   if (metadata)
     save_metadata (file, tsvals, image, metadata, metadata_flags, *saved_bpp);
+#endif
 
   /* write the remaining layers */
   if (num_layers > 1)
