commit:     40c5fd9857ca17b583abc7627acfa9547f2f4283
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 20 17:02:30 2023 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sun Aug 20 17:07:09 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=40c5fd98

sci-geosciences/gpscorrelate: Fix build with >=exiv2-0.28

Closes: https://bugs.gentoo.org/906498
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../files/gpscorrelate-2.0-exiv2-0.28.patch        | 135 +++++++++++++++++++++
 .../gpscorrelate/gpscorrelate-2.0.ebuild           |   1 +
 2 files changed, 136 insertions(+)

diff --git 
a/sci-geosciences/gpscorrelate/files/gpscorrelate-2.0-exiv2-0.28.patch 
b/sci-geosciences/gpscorrelate/files/gpscorrelate-2.0-exiv2-0.28.patch
new file mode 100644
index 000000000000..f15032fd7c77
--- /dev/null
+++ b/sci-geosciences/gpscorrelate/files/gpscorrelate-2.0-exiv2-0.28.patch
@@ -0,0 +1,135 @@
+From 7c945a5c9116325dad795dbe9682c2c4a4dea2d9 Mon Sep 17 00:00:00 2001
+From: Andreas Sturmlechner <[email protected]>
+Date: Sun, 20 Aug 2023 18:57:43 +0200
+Subject: [PATCH] Fix build with >=exiv2-0.28
+
+Fixes https://github.com/dfandrich/gpscorrelate/issues/22
+
+Signed-off-by: Andreas Sturmlechner <[email protected]>
+---
+ exif-gps.cpp | 37 +++++++++++++++++++++++++++++++++++++
+ 1 file changed, 37 insertions(+)
+
+diff --git a/exif-gps.cpp b/exif-gps.cpp
+index d464d62..71b46ef 100644
+--- a/exif-gps.cpp
++++ b/exif-gps.cpp
+@@ -44,6 +44,7 @@
+ #include "exiv2/image.hpp"
+ #include "exiv2/exif.hpp"
+ #include "exiv2/error.hpp"
++#include "exiv2/version.hpp"
+ 
+ #include "gpsstructure.h"
+ #include "exif-gps.h"
+@@ -97,7 +98,11 @@ int main(int argc, char* argv[])
+ char* ReadExifDate(const char* File, int* IncludesGPS)
+ {
+       // Open and read the file.
++#if EXIV2_TEST_VERSION(0, 28, 0)
++      Exiv2::Image::UniquePtr Image;
++#else
+       Exiv2::Image::AutoPtr Image;
++#endif
+ 
+       try {
+               Image = Exiv2::ImageFactory::open(File);
+@@ -154,7 +159,11 @@ char* ReadExifData(const char* File, double* Lat, double* 
Long, double* Elev, in
+       // much more data than the last, specifically
+       // for display purposes. For the GUI version.
+       // Open and read the file.
++#if EXIV2_TEST_VERSION(0, 28, 0)
++      Exiv2::Image::UniquePtr Image;
++#else
+       Exiv2::Image::AutoPtr Image;
++#endif
+ 
+       try {
+               Image = Exiv2::ImageFactory::open(File);
+@@ -273,7 +282,11 @@ char* ReadExifData(const char* File, double* Lat, double* 
Long, double* Elev, in
+ 
+               // Is the altitude below sea level? If so, negate the value.
+               GPSData = ExifRead["Exif.GPSInfo.GPSAltitudeRef"];
++#if EXIV2_TEST_VERSION(0, 28, 0)
++              if (GPSData.count() >= 1 && GPSData.toUint32() == 1)
++#else
+               if (GPSData.count() >= 1 && GPSData.toLong() == 1)
++#endif
+               {
+                               // Negate the elevation.
+                               *Elev = -*Elev;
+@@ -292,7 +305,11 @@ char* ReadGPSTimestamp(const char* File, char* DateStamp, 
char* TimeStamp, int*
+       // much more data than the last, specifically
+       // for display purposes. For the GUI version.
+       // Open and read the file.
++#if EXIV2_TEST_VERSION(0, 28, 0)
++      Exiv2::Image::UniquePtr Image;
++#else
+       Exiv2::Image::AutoPtr Image;
++#endif
+ 
+       try {
+               Image = Exiv2::ImageFactory::open(File);
+@@ -463,7 +480,11 @@ int WriteGPSData(const char* File, const struct GPSPoint* 
Point,
+       struct utimbuf utb;
+       if (NoChangeMtime)
+               stat(File, &statbuf);
++#if EXIV2_TEST_VERSION(0, 28, 0)
++      Exiv2::Image::UniquePtr Image;
++#else
+       Exiv2::Image::AutoPtr Image;
++#endif
+ 
+       try {
+               Image = Exiv2::ImageFactory::open(File);
+@@ -493,7 +514,11 @@ int WriteGPSData(const char* File, const struct GPSPoint* 
Point,
+       // Do all the easy constant ones first.
+       // GPSVersionID tag: standard says it should be four bytes: 02 02 00 00
+       //  (and, must be present).
++#if EXIV2_TEST_VERSION(0, 28, 0)
++      Exiv2::Value::UniquePtr Value = 
Exiv2::Value::create(Exiv2::unsignedByte);
++#else
+       Exiv2::Value::AutoPtr Value = Exiv2::Value::create(Exiv2::unsignedByte);
++#endif
+       Value->read("2 2 0 0");
+       replace(ExifToWrite, Exiv2::ExifKey("Exif.GPSInfo.GPSVersionID"), 
Value.get());
+       // Datum: the datum of the measured data. The default is WGS-84.
+@@ -643,7 +668,11 @@ int WriteFixedDatestamp(const char* File, time_t Time)
+       struct utimbuf utb;
+       stat(File, &statbuf);
+ 
++#if EXIV2_TEST_VERSION(0, 28, 0)
++      Exiv2::Image::UniquePtr Image;
++#else
+       Exiv2::Image::AutoPtr Image;
++#endif
+ 
+       try {
+               Image = Exiv2::ImageFactory::open(File);
+@@ -672,7 +701,11 @@ int WriteFixedDatestamp(const char* File, time_t Time)
+       
ExifToWrite.erase(ExifToWrite.findKey(Exiv2::ExifKey("Exif.GPSInfo.GPSDateStamp")));
+       ExifToWrite["Exif.GPSInfo.GPSDateStamp"] = ScratchBuf;
+ 
++#if EXIV2_TEST_VERSION(0, 28, 0)
++      Exiv2::Value::UniquePtr Value = 
Exiv2::Value::create(Exiv2::unsignedRational);
++#else
+       Exiv2::Value::AutoPtr Value = 
Exiv2::Value::create(Exiv2::unsignedRational);
++#endif
+       snprintf(ScratchBuf, sizeof(ScratchBuf), "%d/1 %d/1 %d/1",
+                       TimeStamp.tm_hour, TimeStamp.tm_min,
+                       TimeStamp.tm_sec);
+@@ -705,7 +738,11 @@ int RemoveGPSExif(const char* File, int NoChangeMtime, 
int NoWriteExif)
+               stat(File, &statbuf);
+ 
+       // Open the file and start reading.
++#if EXIV2_TEST_VERSION(0, 28, 0)
++      Exiv2::Image::UniquePtr Image;
++#else
+       Exiv2::Image::AutoPtr Image;
++#endif
+       
+       try {
+               Image = Exiv2::ImageFactory::open(File);
+-- 
+2.41.0
+

diff --git a/sci-geosciences/gpscorrelate/gpscorrelate-2.0.ebuild 
b/sci-geosciences/gpscorrelate/gpscorrelate-2.0.ebuild
index 982684d854bb..f2d065010f21 100644
--- a/sci-geosciences/gpscorrelate/gpscorrelate-2.0.ebuild
+++ b/sci-geosciences/gpscorrelate/gpscorrelate-2.0.ebuild
@@ -29,6 +29,7 @@ RDEPEND="${DEPEND}"
 PATCHES=(
        "${FILESDIR}/${P}-desktop-pass-validation.patch"
        "${FILESDIR}/${P}-respect-users-flags.patch"
+       "${FILESDIR}/${P}-exiv2-0.28.patch" # bug 906498
 )
 
 src_compile() {

Reply via email to