Blame SOURCES/gegl-build-without-exiv2.patch

0b49ef
diff --git a/configure.ac b/configure.ac
0b49ef
index d18859b..d6dc63b 100644
0b49ef
--- a/configure.ac
0b49ef
+++ b/configure.ac
0b49ef
@@ -971,25 +971,6 @@ AM_CONDITIONAL(HAVE_SPIRO, test "$spiro_ok" = "yes")
0b49ef
 
0b49ef
 AC_SUBST(LIBSPIRO)
0b49ef
 
0b49ef
-###################
0b49ef
-# Check for exiv2
0b49ef
-###################
0b49ef
-
0b49ef
-AC_ARG_WITH(exiv2, [  --without-exiv2         build without libexiv2 support])
0b49ef
-
0b49ef
-have_libexiv2="no"
0b49ef
-if test "x$with_libexiv2" != "xno"; then
0b49ef
-  PKG_CHECK_MODULES(EXIV2, exiv2,
0b49ef
-    have_exiv2="yes",
0b49ef
-    have_exiv2="no  (exiv2 library not found)")
0b49ef
-fi
0b49ef
-
0b49ef
-AM_CONDITIONAL(HAVE_EXIV2, test "$have_exiv2" = "yes")
0b49ef
-
0b49ef
-AC_SUBST(EXIV2_CFLAGS)
0b49ef
-AC_SUBST(EXIV2_CXXFLAGS)
0b49ef
-AC_SUBST(EXIV2_LIBS)
0b49ef
-
0b49ef
 ###################
0b49ef
 # Check for UMFPACK
0b49ef
 ###################
0b49ef
diff --git a/tools/Makefile.am b/tools/Makefile.am
0b49ef
index 8f1077d..93d83fc 100644
0b49ef
--- a/tools/Makefile.am
0b49ef
+++ b/tools/Makefile.am
0b49ef
@@ -26,9 +26,9 @@ AM_LDFLAGS = \
0b49ef
 
0b49ef
 noinst_PROGRAMS = introspect operation_reference img_cmp
0b49ef
 
0b49ef
-if HAVE_EXIV2
0b49ef
+if HAVE_GEXIV2
0b49ef
 noinst_PROGRAMS     += exp_combine 
0b49ef
 exp_combine_SOURCES  = exp_combine.cpp
0b49ef
-exp_combine_LDADD    = $(EXIV2_LIBS) 
0b49ef
-exp_combine_CXXFLAGS = $(AM_CFLAGS) $(EXIV2_CFLAGS)
0b49ef
+exp_combine_LDADD    = $(GEXIV2_LIBS) 
0b49ef
+exp_combine_CXXFLAGS = $(AM_CFLAGS) $(GEXIV2_CFLAGS)
0b49ef
 endif
0b49ef
diff --git a/tools/exp_combine.cpp b/tools/exp_combine.cpp
0b49ef
index efd8e3c..58649b6 100644
0b49ef
--- a/tools/exp_combine.cpp
0b49ef
+++ b/tools/exp_combine.cpp
0b49ef
@@ -8,8 +8,7 @@
0b49ef
 
0b49ef
 #include <iostream>
0b49ef
 
0b49ef
-#include <exiv2/image.hpp>
0b49ef
-#include <exiv2/exif.hpp>
0b49ef
+#include <gexiv2/gexiv2.h>
0b49ef
 
0b49ef
 using namespace std;
0b49ef
 
0b49ef
@@ -54,35 +53,32 @@ die:
0b49ef
 static gfloat
0b49ef
 expcombine_get_file_ev (const gchar *path)
0b49ef
 {
0b49ef
-  /* Open the file and read in the metadata */
0b49ef
-  Exiv2::Image::AutoPtr image;
0b49ef
-  try 
0b49ef
-    {
0b49ef
-      image = Exiv2::ImageFactory::open (path);
0b49ef
-      image->readMetadata ();
0b49ef
-    }
0b49ef
-  catch (Exiv2::Error ex)
0b49ef
-    {
0b49ef
-      g_print ("Error: unable to read metadata from path: '%s'\n", path);
0b49ef
-      exit (EXIT_FAILURE);
0b49ef
-    }
0b49ef
+  GError *error = NULL;
0b49ef
+  GExiv2Metadata *e2m = gexiv2_metadata_new ();
0b49ef
+  gfloat time, aperture, gain = 1.0f;
0b49ef
 
0b49ef
-  Exiv2::ExifData &exifData = image->exifData ();
0b49ef
-  if (exifData.empty ())
0b49ef
-      return NAN;
0b49ef
+  gexiv2_metadata_open_path (e2m, path, &error);
0b49ef
+  if (error)
0b49ef
+  {
0b49ef
+    g_warning ("%s", error->message);
0b49ef
+    exit (EXIT_FAILURE);
0b49ef
+  }
0b49ef
 
0b49ef
   /* Calculate the APEX brightness / EV */
0b49ef
-  gfloat time, aperture, gain = 1.0f;
0b49ef
 
0b49ef
-  time     = exifData["Exif.Photo.ExposureTime"].value().toFloat();
0b49ef
-  aperture = exifData["Exif.Photo.FNumber"     ].value().toFloat();
0b49ef
+  {
0b49ef
+    gint nom, den;
0b49ef
+    gexiv2_metadata_get_exposure_time (e2m, &nom, &den;;
0b49ef
+    time = nom * 1.0f / den;
0b49ef
+  }
0b49ef
+  aperture = gexiv2_metadata_get_fnumber (e2m);
0b49ef
 
0b49ef
   /* iso */
0b49ef
-  try
0b49ef
+  if (gexiv2_metadata_has_tag (e2m, "Exif.Image.ISOSpeedRatings"))
0b49ef
     {
0b49ef
-      gain = exifData["Exif.Photo.ISOSpeedRatings"].value().toLong() / 100.0f;
0b49ef
+      gain = gexiv2_metadata_get_iso_speed (e2m) / 100.0f;
0b49ef
     }
0b49ef
-  catch (Exiv2::Error ex)
0b49ef
+  else
0b49ef
     {
0b49ef
       // Assume ISO is set at 100. It's reasonably likely that the ISO is the
0b49ef
       // same across all images anyway, and for our purposes the relative