commit:     23a191698ef4f34252517351dc92260bfb57ddc6
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 12 10:45:42 2023 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Mon Jun 12 17:44:50 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=23a19169

media-gfx/qimgv: Fix build with >=exiv2-0.28, fix apng can't play

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

 media-gfx/qimgv/files/qimgv-1.0.2-exiv2-0.28.patch | 49 +++++++++++++++++++
 .../files/qimgv-1.0.2-fix-apng-cannot-play.patch   | 56 ++++++++++++++++++++++
 media-gfx/qimgv/qimgv-1.0.2-r2.ebuild              | 46 ++++++++++++++++++
 3 files changed, 151 insertions(+)

diff --git a/media-gfx/qimgv/files/qimgv-1.0.2-exiv2-0.28.patch 
b/media-gfx/qimgv/files/qimgv-1.0.2-exiv2-0.28.patch
new file mode 100644
index 000000000000..86e60efe564c
--- /dev/null
+++ b/media-gfx/qimgv/files/qimgv-1.0.2-exiv2-0.28.patch
@@ -0,0 +1,49 @@
+Combined fixes from git master:
+
+From 9ffd34784b1fabe1569862b2d551d9cf06e46fa2 Mon Sep 17 00:00:00 2001
+From: adonais <[email protected]>
+Date: Tue, 2 Nov 2021 12:33:00 +0800
+Subject: [PATCH 1/3] reserve exiv2 exception capture
+
+(cherry picked from commit 3bd9571a0aff4611339eb57132e79b41af7acbb6)
+
+* asturmlechner 2023-06-12: Drop unrelated translation fix from commit
+---
+ qimgv/sourcecontainers/documentinfo.cpp | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+From abe43e0dc7ee6d120c3e052562748d5a2a9f7d46 Mon Sep 17 00:00:00 2001
+From: adonais <[email protected]>
+Date: Wed, 3 Nov 2021 09:07:30 +0800
+Subject: [PATCH 2/3] Fix exiv2 exception capture
+
+(cherry picked from commit 08d5dea2074d055f102002d1a8f705e2ad2292f1)
+---
+ qimgv/sourcecontainers/documentinfo.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+From c4d9d5b08341af6709fe6263e90f4237c67eb14c Mon Sep 17 00:00:00 2001
+From: DigitalDragon64 <[email protected]>
+Date: Thu, 8 Jun 2023 15:21:26 +0200
+Subject: [PATCH 3/3] Exiv2::AnyError was removed
+
+(cherry picked from commit bff220e6e8851482e383b71fe778a870c96cd5f8)
+---
+ qimgv/sourcecontainers/documentinfo.cpp | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/qimgv/sourcecontainers/documentinfo.cpp 
b/qimgv/sourcecontainers/documentinfo.cpp
+index 21979f01..9de2dd31 100644
+--- a/qimgv/sourcecontainers/documentinfo.cpp
++++ b/qimgv/sourcecontainers/documentinfo.cpp
+@@ -268,8 +268,9 @@ void DocumentInfo::loadExifTags() {
+             exifTags.insert("UserComment", comment);
+         }
+     }
++    // No exception was caught, which may cause QT crash
+     catch (Exiv2::Error& e) {
+-        //std::cout << "Caught Exiv2 exception '" << e.what() << "'\n";
++        qDebug() << "Caught Exiv2 exception:\n" << e.what() << "\n";
+         return;
+     }
+ #endif

diff --git a/media-gfx/qimgv/files/qimgv-1.0.2-fix-apng-cannot-play.patch 
b/media-gfx/qimgv/files/qimgv-1.0.2-fix-apng-cannot-play.patch
new file mode 100644
index 000000000000..7350fb626523
--- /dev/null
+++ b/media-gfx/qimgv/files/qimgv-1.0.2-fix-apng-cannot-play.patch
@@ -0,0 +1,56 @@
+From 0db15e8ae17a03d61652766ffe411c5d010161a1 Mon Sep 17 00:00:00 2001
+From: adonais <[email protected]>
+Date: Mon, 1 Nov 2021 08:50:51 +0800
+Subject: [PATCH] Fix apng cannot play
+
+(cherry picked from commit e9d306ffbf93d4b9d8cfd2906eaebe0fc949930f)
+
+* asturmlechner 2023-06-12: Drop unrelated [...and update translation file]
+  part of this commit.
+---
+ qimgv/sourcecontainers/documentinfo.cpp | 17 +++++++----------
+ 1 file changed, 7 insertions(+), 10 deletions(-)
+
+diff --git a/qimgv/sourcecontainers/documentinfo.cpp 
b/qimgv/sourcecontainers/documentinfo.cpp
+index 98a68f75..21979f01 100644
+--- a/qimgv/sourcecontainers/documentinfo.cpp
++++ b/qimgv/sourcecontainers/documentinfo.cpp
+@@ -128,10 +128,13 @@ inline
+ // dumb apng detector
+ bool DocumentInfo::detectAPNG() {
+     QFile f(fileInfo.filePath());
+-    if(f.open(QFile::ReadOnly | QFile::Text)) {
+-        QTextStream in(&f);
+-        QString header(in.read(120)); // 120 chars should be sufficient?
+-        return header.contains("acTL");
++    if(f.open(QFile::ReadOnly)) {
++        QDataStream in(&f);
++        const int len = 120;
++        QByteArray qbuf("\0", len);
++        if (in.readRawData(qbuf.data(), len) > 0) {
++            return qbuf.contains("acTL");
++        }
+     }
+     return false;
+ }
+@@ -264,17 +267,11 @@ void DocumentInfo::loadExifTags() {
+                 comment.remove(0, comment.indexOf(" ") + 1);
+             exifTags.insert("UserComment", comment);
+         }
+-
+-        return;
+     }
+     catch (Exiv2::Error& e) {
+         //std::cout << "Caught Exiv2 exception '" << e.what() << "'\n";
+         return;
+     }
+-    catch (Exiv2::BasicError<CharType> e) {
+-        //std::cout << "Caught BasicError Exiv2 exception '" << e.what() << 
"'\n";
+-        return;
+-    }
+ #endif
+ }
+ 
+-- 
+2.41.0
+

diff --git a/media-gfx/qimgv/qimgv-1.0.2-r2.ebuild 
b/media-gfx/qimgv/qimgv-1.0.2-r2.ebuild
new file mode 100644
index 000000000000..99e7b39a6c18
--- /dev/null
+++ b/media-gfx/qimgv/qimgv-1.0.2-r2.ebuild
@@ -0,0 +1,46 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake xdg
+
+DESCRIPTION="A cross-platform image viewer with webm support, written in qt5"
+HOMEPAGE="https://github.com/easymodo/qimgv";
+SRC_URI="https://github.com/easymodo/qimgv/archive/v${PV}.tar.gz -> 
${P}.tar.gz"
+
+LICENSE="GPL-3 BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="exif kde opencv video"
+
+DEPEND="
+       dev-qt/qtconcurrent:5
+       dev-qt/qtcore:5
+       dev-qt/qtgui:5
+       dev-qt/qtprintsupport:5
+       dev-qt/qtsvg:5
+       dev-qt/qtwidgets:5
+       exif? ( media-gfx/exiv2:= )
+       kde? ( kde-frameworks/kwindowsystem:5 )
+       opencv? ( media-libs/opencv:= )
+       video? ( media-video/mpv:=[libmpv] )
+"
+RDEPEND="${DEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=( # git master backports
+       "${FILESDIR}"/${P}-libmpv-api2.patch
+       "${FILESDIR}"/${P}-fix-apng-cannot-play.patch
+       "${FILESDIR}"/${P}-exiv2-0.28.patch # bug 906493
+)
+
+src_configure() {
+       local mycmakeargs=(
+               -DEXIV2=$(usex exif)
+               -DKDE_SUPPORT=$(usex kde)
+               -DOPENCV_SUPPORT=$(usex opencv)
+               -DVIDEO_SUPPORT=$(usex video)
+       )
+       cmake_src_configure
+}

Reply via email to