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

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