commit:     b483c31b42645fe35fcf6808f196ab20564dd780
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Fri Oct  7 00:36:55 2022 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Fri Oct  7 00:55:08 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b483c31b

media-gfx/imv: add 4.3.1_p20211221

Mostly to include libgrapheme support for those that don't want
to pull icu on minimal systems (with a minimal image viewer).
Uptream had no activity since 2021, so not expecting a release soon.

Also add workaround to display animated gifs even if USE=freeimage
is set (which prevented using libnsgif with animation support).

Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 media-gfx/imv/Manifest                             |  1 +
 .../files/imv-4.3.1_p20211221-animated-gif.patch   | 19 +++++
 .../files/imv-4.3.1_p20211221-libgrapheme2.patch   | 13 ++++
 media-gfx/imv/imv-4.3.1_p20211221.ebuild           | 89 ++++++++++++++++++++++
 4 files changed, 122 insertions(+)

diff --git a/media-gfx/imv/Manifest b/media-gfx/imv/Manifest
index e75c2e6a9fb6..a6bf38bedfbc 100644
--- a/media-gfx/imv/Manifest
+++ b/media-gfx/imv/Manifest
@@ -1 +1,2 @@
 DIST imv-4.3.1.tar.gz 79123 BLAKE2B 
9c818a5a29457313c3d0ed1a8558555b2069aec837939dc1d2b71668ec2fd39867c8ad4fcf8605243ded96e27d346af4307d83c8854538981b62c968e9ec0ede
 SHA512 
f70b95f3f99d7d6a9276370650cef0885938464e3a40ab1768231292ba35d9040f7196a5853ea1268fe6d47cf08d129b3fbae1ca215df96d12ccd85b7efd1ee6
+DIST imv-4.3.1_p20211221.tar.gz 80082 BLAKE2B 
2b4f3cdb0b7123b978cdbc588cf686c38d65053e3fadb6532da45be3e24b35a297639ca8ddb7d05945f92763cc014a232eb0ca0af0da059b2dac48d2b3c9939d
 SHA512 
7579930a406d2ba1dca7f043d635ea89301606d06ca5ebe5779fffd1410789bb07ef8228beb2ef08af2783e64deda8b67aa991fc56333c0e60051f7666fbb19f

diff --git a/media-gfx/imv/files/imv-4.3.1_p20211221-animated-gif.patch 
b/media-gfx/imv/files/imv-4.3.1_p20211221-animated-gif.patch
new file mode 100644
index 000000000000..3b7ac34a3a80
--- /dev/null
+++ b/media-gfx/imv/files/imv-4.3.1_p20211221-animated-gif.patch
@@ -0,0 +1,19 @@
+Upstream priorizes freeimage in general, but nsgif supports animated
+gif while freeimage displays them as a static image. This allows setting
+USE=freeimage while still getting animations if (optional) USE=gif.
+--- a/src/main.c
++++ b/src/main.c
+@@ -20,2 +20,6 @@
+ 
++#ifdef IMV_BACKEND_LIBNSGIF
++  imv_install_backend(imv, &imv_backend_libnsgif);
++#endif
++
+ #ifdef IMV_BACKEND_FREEIMAGE
+@@ -39,6 +43,2 @@
+ #endif
+-
+-#ifdef IMV_BACKEND_LIBNSGIF
+-  imv_install_backend(imv, &imv_backend_libnsgif);
+-#endif
+ 

diff --git a/media-gfx/imv/files/imv-4.3.1_p20211221-libgrapheme2.patch 
b/media-gfx/imv/files/imv-4.3.1_p20211221-libgrapheme2.patch
new file mode 100644
index 000000000000..ba02c27ef82e
--- /dev/null
+++ b/media-gfx/imv/files/imv-4.3.1_p20211221-libgrapheme2.patch
@@ -0,0 +1,13 @@
+Changed with v2 and would become an error with clang16.
+--- a/src/console.c
++++ b/src/console.c
+@@ -54,3 +54,3 @@
+   if (buffer[position] != 0) {
+-    return position + grapheme_next_character_break(buffer + position, 
SIZE_MAX);
++    return position + grapheme_next_character_break((uint_least32_t *)buffer 
+ position, SIZE_MAX);
+   } else {
+@@ -87,3 +87,3 @@
+   do {
+-    step = grapheme_next_character_break(buffer + result, SIZE_MAX);
++    step = grapheme_next_character_break((uint_least32_t *)buffer + result, 
SIZE_MAX);
+     if (result + step >= position)

diff --git a/media-gfx/imv/imv-4.3.1_p20211221.ebuild 
b/media-gfx/imv/imv-4.3.1_p20211221.ebuild
new file mode 100644
index 000000000000..efc26ac19ee5
--- /dev/null
+++ b/media-gfx/imv/imv-4.3.1_p20211221.ebuild
@@ -0,0 +1,89 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit meson xdg
+
+if [[ ${PV} == 9999 ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://git.sr.ht/~exec64/imv/";
+else
+       IMV_HASH=4448fb6104d67e3dfff3e71babe257992fce556
+       SRC_URI="https://git.sr.ht/~exec64/imv/archive/${IMV_HASH}.tar.gz -> 
${P}.tar.gz"
+       S="${WORKDIR}/${PN}-${IMV_HASH}"
+       KEYWORDS="~amd64 ~x86"
+fi
+
+DESCRIPTION="Minimal image viewer designed for tiling window manager users"
+HOMEPAGE="https://sr.ht/~exec64/imv/";
+
+LICENSE="MIT-with-advertising"
+SLOT="0"
+IUSE="+X +freeimage gif heif icu jpeg png svg test tiff wayland"
+REQUIRED_USE="|| ( X wayland )"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+       dev-libs/glib:2
+       dev-libs/inih
+       media-libs/libglvnd[X?]
+       x11-libs/cairo
+       x11-libs/libxkbcommon[X?]
+       x11-libs/pango
+       X? (
+               x11-libs/libX11
+               x11-libs/libxcb:=
+       )
+       freeimage? ( media-libs/freeimage )
+       gif? ( media-libs/libnsgif )
+       heif? ( media-libs/libheif:= )
+       icu? ( dev-libs/icu:= )
+       !icu? ( >=dev-libs/libgrapheme-2:= )
+       jpeg? ( media-libs/libjpeg-turbo:= )
+       png? ( media-libs/libpng:= )
+       svg? ( >=gnome-base/librsvg-2.44:2 )
+       tiff? ( media-libs/tiff )
+       wayland? ( dev-libs/wayland )
+       !sys-apps/renameutils"
+DEPEND="
+       ${RDEPEND}
+       X? ( x11-base/xorg-proto )
+       test? ( dev-util/cmocka )"
+BDEPEND="
+       app-text/asciidoc
+       wayland? ( dev-util/wayland-scanner )"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-animated-gif.patch
+       "${FILESDIR}"/${P}-libgrapheme2.patch
+)
+
+src_prepare() {
+       default
+
+       # if wayland-only, don't automagic on libGL and force libOpenGL
+       if ! use X; then
+               sed -i "/dependency('gl'/{s/'gl'/'opengl'/;s/false/true/}" 
meson.build || die
+       fi
+
+       # glu isn't used by anything
+       sed -i "/dependency('glu')/d" meson.build || die
+}
+
+src_configure() {
+       local emesonargs=(
+               $(meson_feature freeimage)
+               $(meson_feature gif libnsgif)
+               $(meson_feature heif libheif)
+               $(meson_feature jpeg libjpeg)
+               $(meson_feature png libpng)
+               $(meson_feature svg librsvg)
+               $(meson_feature test)
+               $(meson_feature tiff libtiff)
+               -Dunicode=$(usex icu{,} grapheme)
+               -Dwindows=$(usex X $(usex wayland all x11) wayland)
+       )
+
+       meson_src_configure
+}

Reply via email to