diff options
author | tastytea <gentoo@tastytea.de> | 2023-05-16 12:01:01 +0200 |
---|---|---|
committer | Andreas Sturmlechner <asturm@gentoo.org> | 2023-05-17 22:31:49 +0200 |
commit | 1ef5f799601b66d7fcc5cf24167ba5d0d21dc9aa (patch) | |
tree | e0001a4e1a74b5d091a1f28fc99e51d60f8b9db1 /media-gfx | |
parent | sci-geosciences/qgis: add 3.28.6, fixes build with GCC-13 (diff) | |
download | gentoo-1ef5f799601b66d7fcc5cf24167ba5d0d21dc9aa.tar.gz gentoo-1ef5f799601b66d7fcc5cf24167ba5d0d21dc9aa.tar.bz2 gentoo-1ef5f799601b66d7fcc5cf24167ba5d0d21dc9aa.zip |
media-gfx/viewnior: fix building with >=media-gfx/exiv2-0.28.0
Closes: https://bugs.gentoo.org/906495
Signed-off-by: tastytea <gentoo@tastytea.de>
Closes: https://github.com/gentoo/gentoo/pull/31055
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'media-gfx')
3 files changed, 204 insertions, 0 deletions
diff --git a/media-gfx/viewnior/files/viewnior-1.8-add-support-for-exiv-0.28.0-errors.patch b/media-gfx/viewnior/files/viewnior-1.8-add-support-for-exiv-0.28.0-errors.patch new file mode 100644 index 000000000000..41b478f95caf --- /dev/null +++ b/media-gfx/viewnior/files/viewnior-1.8-add-support-for-exiv-0.28.0-errors.patch @@ -0,0 +1,62 @@ +# upstream PR: <https://github.com/hellosiyan/Viewnior/pull/130> + +From 60312f7435492338299d519e739da1f33df02f8c Mon Sep 17 00:00:00 2001 +From: tastytea <tastytea@tastytea.de> +Date: Tue, 16 May 2023 11:17:00 +0200 +Subject: [PATCH] add support for exiv-0.28.0 errors + +exiv2-0.28.0 changed Exiv2::AnyError to Exiv2::Error. +--- + src/uni-exiv2.cpp | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +diff --git a/src/uni-exiv2.cpp b/src/uni-exiv2.cpp +index 77064c2..567a50f 100644 +--- a/src/uni-exiv2.cpp ++++ b/src/uni-exiv2.cpp +@@ -28,6 +28,15 @@ + + #define ARRAY_SIZE(array) (sizeof array/sizeof(array[0])) + ++#define EXIV_ERROR Exiv2::AnyError ++#ifdef EXIV2_VERSION ++ #ifdef EXIV2_TEST_VERSION ++ #if EXIV2_TEST_VERSION(0,28,0) ++ #define EXIV_ERROR Exiv2::Error ++ #endif ++ #endif ++#endif ++ + static std::unique_ptr<Exiv2::Image> cached_image; + + extern "C" +@@ -81,7 +90,7 @@ uni_read_exiv2_map(const char *uri, void (*callback)(const char*, const char*, v + } + } + } +- } catch (Exiv2::AnyError& e) { ++ } catch (EXIV_ERROR& e) { + std::cerr << "Exiv2: '" << e << "'\n"; + } + } +@@ -104,7 +113,7 @@ uni_read_exiv2_to_cache(const char *uri) + } + + cached_image->readMetadata(); +- } catch (Exiv2::AnyError& e) { ++ } catch (EXIV_ERROR& e) { + std::cerr << "Exiv2: '" << e << "'\n"; + } + +@@ -134,7 +143,7 @@ uni_write_exiv2_from_cache(const char *uri) + cached_image.reset(nullptr); + + return 0; +- } catch (Exiv2::AnyError& e) { ++ } catch (EXIV_ERROR& e) { + std::cerr << "Exiv2: '" << e << "'\n"; + } + +-- +2.39.3 + diff --git a/media-gfx/viewnior/files/viewnior-1.8-change-exiv2-AutoPtr-to-unique_ptr.patch b/media-gfx/viewnior/files/viewnior-1.8-change-exiv2-AutoPtr-to-unique_ptr.patch new file mode 100644 index 000000000000..a49748e39f36 --- /dev/null +++ b/media-gfx/viewnior/files/viewnior-1.8-change-exiv2-AutoPtr-to-unique_ptr.patch @@ -0,0 +1,92 @@ +# upstream PR: <https://github.com/hellosiyan/Viewnior/pull/130> + +From e98d86aecf20a1651552090c7b25d5fcdd41133a Mon Sep 17 00:00:00 2001 +From: tastytea <tastytea@tastytea.de> +Date: Tue, 16 May 2023 10:54:40 +0200 +Subject: [PATCH] change exiv2 AutoPtr to unique_ptr + +exiv2-0.28.0 removed Exiv2::Image::AutoPtr and added +Exiv2::Image::UniquePtr instead. since it's a typedef for +std::unique_ptr<Image>, i'm using that directly instead of adding a +condition on the exiv2 version. +--- + src/uni-exiv2.cpp | 21 +++++++++++---------- + 1 file changed, 11 insertions(+), 10 deletions(-) + +diff --git a/src/uni-exiv2.cpp b/src/uni-exiv2.cpp +index 0d14b9f..77064c2 100644 +--- a/src/uni-exiv2.cpp ++++ b/src/uni-exiv2.cpp +@@ -22,12 +22,13 @@ + + #include <exiv2/exiv2.hpp> + #include <iostream> ++#include <memory> + + #include "uni-exiv2.hpp" + + #define ARRAY_SIZE(array) (sizeof array/sizeof(array[0])) + +-static Exiv2::Image::AutoPtr cached_image; ++static std::unique_ptr<Exiv2::Image> cached_image; + + extern "C" + void +@@ -35,8 +36,8 @@ uni_read_exiv2_map(const char *uri, void (*callback)(const char*, const char*, v + { + Exiv2::LogMsg::setLevel(Exiv2::LogMsg::mute); + try { +- Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(uri); +- if ( image.get() == 0 ) { ++ std::unique_ptr<Exiv2::Image> image = Exiv2::ImageFactory::open(uri); ++ if (image == nullptr) { + return; + } + +@@ -91,14 +92,14 @@ uni_read_exiv2_to_cache(const char *uri) + { + Exiv2::LogMsg::setLevel(Exiv2::LogMsg::mute); + +- if ( cached_image.get() != NULL ) { ++ if (cached_image != nullptr) { + cached_image->clearMetadata(); +- cached_image.reset(NULL); ++ cached_image.reset(nullptr); + } + + try { + cached_image = Exiv2::ImageFactory::open(uri); +- if ( cached_image.get() == 0 ) { ++ if (cached_image == nullptr) { + return 1; + } + +@@ -116,13 +117,13 @@ uni_write_exiv2_from_cache(const char *uri) + { + Exiv2::LogMsg::setLevel(Exiv2::LogMsg::mute); + +- if ( cached_image.get() == NULL ) { ++ if (cached_image == nullptr) { + return 1; + } + + try { +- Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(uri); +- if ( image.get() == 0 ) { ++ std::unique_ptr<Exiv2::Image> image = Exiv2::ImageFactory::open(uri); ++ if (image == nullptr) { + return 2; + } + +@@ -130,7 +131,7 @@ uni_write_exiv2_from_cache(const char *uri) + image->writeMetadata(); + + cached_image->clearMetadata(); +- cached_image.reset(NULL); ++ cached_image.reset(nullptr); + + return 0; + } catch (Exiv2::AnyError& e) { +-- +2.39.3 + diff --git a/media-gfx/viewnior/viewnior-1.8-r1.ebuild b/media-gfx/viewnior/viewnior-1.8-r1.ebuild new file mode 100644 index 000000000000..b2520150b2f9 --- /dev/null +++ b/media-gfx/viewnior/viewnior-1.8-r1.ebuild @@ -0,0 +1,50 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit meson xdg + +DESCRIPTION="Fast and simple image viewer" +HOMEPAGE="https://siyanpanayotov.com/project/viewnior" +SRC_URI="https://github.com/hellosiyan/${PN^}/archive/${P}.tar.gz" +S="${WORKDIR}/${PN^}-${P}" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~riscv ~x86" +IUSE="" + +RDEPEND=" + dev-libs/glib:2 + media-gfx/exiv2:0= + x11-libs/gdk-pixbuf:2 + x11-libs/gtk+:2 +" +DEPEND="${RDEPEND}" +BDEPEND=" + dev-util/glib-utils + sys-devel/gettext + virtual/pkgconfig +" + +PATCHES=( + "${FILESDIR}"/${PN}-1.8-change-exiv2-AutoPtr-to-unique_ptr.patch + "${FILESDIR}"/${PN}-1.8-add-support-for-exiv-0.28.0-errors.patch +) + +src_prepare() { + # That script would update icon cache and desktop database. + sed -i "s/meson.add_install_script('meson_post_install.py')//" meson.build \ + || die 'Failed to remove post-install-script invocation from meson.build' + # Don't let meson compress the manpage. + sed -i "s/subdir('man')//" meson.build \ + || die 'Failed to remove manpage compression from meson.build' + + default +} + +src_install() { + meson_src_install + doman man/viewnior.1 +} |