git: 4b15a96231c6 - main - graphics/upscaler: add new port

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Tue, 03 Jan 2023 07:37:16 UTC
The branch main has been updated by jbeich:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4b15a96231c6a389a6080127d3f9a7fcedbf9315

commit 4b15a96231c6a389a6080127d3f9a7fcedbf9315
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2022-12-10 21:01:05 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2023-01-03 07:36:42 +0000

    graphics/upscaler: add new port
    
    Upscaler is a GTK4 + libadwaita application that allows you to upscale
    and enhance a given image. It is a front-end for Real-ESRGAN ncnn Vulkan.
    
    https://gitlab.com/TheEvilSkeleton/Upscaler
---
 graphics/Makefile                                |  1 +
 graphics/upscaler/Makefile                       | 27 ++++++++++++++++++++++++
 graphics/upscaler/distinfo                       |  3 +++
 graphics/upscaler/files/patch-upscaler_window.py | 14 ++++++++++++
 graphics/upscaler/pkg-descr                      |  2 ++
 graphics/upscaler/pkg-plist                      | 20 ++++++++++++++++++
 6 files changed, 67 insertions(+)

diff --git a/graphics/Makefile b/graphics/Makefile
index 480d8e7f6b70..95f7d04c4a1b 100644
--- a/graphics/Makefile
+++ b/graphics/Makefile
@@ -1124,6 +1124,7 @@
     SUBDIR += tweeny
     SUBDIR += ufraw
     SUBDIR += unpaper
+    SUBDIR += upscaler
     SUBDIR += urho3d
     SUBDIR += urt
     SUBDIR += vapoursynth-fmtconv
diff --git a/graphics/upscaler/Makefile b/graphics/upscaler/Makefile
new file mode 100644
index 000000000000..ac220a66690b
--- /dev/null
+++ b/graphics/upscaler/Makefile
@@ -0,0 +1,27 @@
+PORTNAME=	upscaler
+DISTVERSION=	1.1.2
+CATEGORIES=	graphics
+
+MAINTAINER=	jbeich@FreeBSD.org
+COMMENT=	Upscale and enhance images
+WWW=		https://gitlab.com/TheEvilSkeleton/Upscaler
+
+LICENSE=	GPLv3
+LICENSE_FILE=	${WRKSRC}/COPYING
+
+BUILD_DEPENDS=	blueprint-compiler:devel/blueprint-compiler
+RUN_DEPENDS=	realesrgan-ncnn-vulkan:graphics/realesrgan-ncnn-vulkan
+
+USES=		desktop-file-utils gettext-tools gnome meson python
+USE_GITLAB=	yes
+USE_GNOME=	gtk40 libadwaita pygobject3
+GL_ACCOUNT=	TheEvilSkeleton
+GL_PROJECT=	Upscaler
+GL_COMMIT=	5aaab9ccaf56b3c7a0eb7d1dbba372d8ff970d69
+GLIB_SCHEMAS=	io.gitlab.theevilskeleton.Upscaler.gschema.xml
+
+post-patch:
+# Derive Python version from Meson
+	@${REINPLACE_CMD} -e "s,'python3',," ${WRKSRC}/${PORTNAME}/meson.build
+
+.include <bsd.port.mk>
diff --git a/graphics/upscaler/distinfo b/graphics/upscaler/distinfo
new file mode 100644
index 000000000000..c7b1328a255e
--- /dev/null
+++ b/graphics/upscaler/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1670706065
+SHA256 (TheEvilSkeleton-Upscaler-5aaab9ccaf56b3c7a0eb7d1dbba372d8ff970d69_GL0.tar.gz) = d92ad00e1e652c543ae5e819c6ef0f72d4348e4014013344c75e49275048d25a
+SIZE (TheEvilSkeleton-Upscaler-5aaab9ccaf56b3c7a0eb7d1dbba372d8ff970d69_GL0.tar.gz) = 130006
diff --git a/graphics/upscaler/files/patch-upscaler_window.py b/graphics/upscaler/files/patch-upscaler_window.py
new file mode 100644
index 000000000000..f14c1b3ebd4d
--- /dev/null
+++ b/graphics/upscaler/files/patch-upscaler_window.py
@@ -0,0 +1,14 @@
+Avoid spurious error "Algorithm failed" as poll() returns None when
+the subprocess hasn't finished yet.
+
+--- upscaler/window.py.orig	2022-12-10 21:01:05 UTC
++++ upscaler/window.py
+@@ -203,7 +203,7 @@ class UpscalerWindow(Adw.ApplicationWindow):
+                             bad = True
+                             continue
+             """ Process algorithm output. """
+-            result = self.process.poll()
++            result = self.process.wait(1)
+             if result != 0:
+                 raise AlgorithmFailed(result, output)
+             if bad:
diff --git a/graphics/upscaler/pkg-descr b/graphics/upscaler/pkg-descr
new file mode 100644
index 000000000000..17ef7fa92336
--- /dev/null
+++ b/graphics/upscaler/pkg-descr
@@ -0,0 +1,2 @@
+Upscaler is a GTK4 + libadwaita application that allows you to upscale
+and enhance a given image. It is a front-end for Real-ESRGAN ncnn Vulkan.
diff --git a/graphics/upscaler/pkg-plist b/graphics/upscaler/pkg-plist
new file mode 100644
index 000000000000..8141abe3deb2
--- /dev/null
+++ b/graphics/upscaler/pkg-plist
@@ -0,0 +1,20 @@
+bin/upscaler
+share/applications/io.gitlab.theevilskeleton.Upscaler.desktop
+share/icons/hicolor/scalable/apps/io.gitlab.theevilskeleton.Upscaler.svg
+share/icons/hicolor/symbolic/apps/io.gitlab.theevilskeleton.Upscaler-symbolic.svg
+share/locale/de/LC_MESSAGES/upscaler.mo
+share/locale/fr/LC_MESSAGES/upscaler.mo
+share/locale/id/LC_MESSAGES/upscaler.mo
+share/locale/it/LC_MESSAGES/upscaler.mo
+share/locale/nl/LC_MESSAGES/upscaler.mo
+share/locale/ru/LC_MESSAGES/upscaler.mo
+share/locale/tr/LC_MESSAGES/upscaler.mo
+share/metainfo/io.gitlab.theevilskeleton.Upscaler.metainfo.xml
+%%DATADIR%%/upscaler.gresource
+%%DATADIR%%/upscaler/__init__.py
+%%DATADIR%%/upscaler/app_profile.py
+%%DATADIR%%/upscaler/file_chooser.py
+%%DATADIR%%/upscaler/filters.py
+%%DATADIR%%/upscaler/main.py
+%%DATADIR%%/upscaler/threading.py
+%%DATADIR%%/upscaler/window.py