File upscaler.spec of Package Upscaler

#
# spec file for package Upscaler
#
# Copyright (c) 2025 mantarimay
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define appid   io.gitlab.theevilskeleton.Upscaler
%define bin_ver 20240601-103425
Name:           upscaler
Version:        1.5.0
Release:        0
Summary:        Upscale and enhance images
License:        GPL-3.0-only
URL:            https://gitlab.gnome.org/World/Upscaler
Source0:        %{url}/-/archive/%{version}/Upscaler-%{version}.tar.bz2
Source1:        https://github.com/upscayl/upscayl-ncnn/releases/download/%{bin_ver}/upscayl-bin-%{bin_ver}-linux.zip 
Source2:        https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesrgan-ncnn-vulkan-20220424-ubuntu.zip
BuildRequires:  blueprint-compiler
BuildRequires:  fdupes
BuildRequires:  meson >= 0.59.0
BuildRequires:  update-desktop-files
BuildRequires:  unzip
BuildRequires:  pkgconfig(gtk4)
BuildRequires:  pkgconfig(libadwaita-1)
Requires:       python3-vulkan 
Requires:       upscayl-bin
BuildArch:      noarch

%description
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.


%package -n upscayl-bin
Summary:        A CLI tool for upscaler image based NCNN Real-ESRGAN
License:        AGPL-3.0 AND MIT

%description -n upscayl-bin
The Upscayl backend powered by the NCNN framework and Real-ESRGAN architecture.

%lang_package

%prep
%autosetup -p1 -n Upscaler-%{version}
%__rpmuncompress -x %{SOURCE1}
%__rpmuncompress -x %{SOURCE2}

sed -i 's|./realesrgan-ncnn-vulkan|upscayl|' README_ubuntu.md

%build
%meson
%meson_build

%install
%meson_install
%find_lang %{name}

install -d %{buildroot}%{_datadir}/upscayl
cp -r models %{buildroot}%{_datadir}/upscayl

install -Dm755 upscayl-bin-20240601-103425-linux/upscayl-bin -t \
   %{buildroot}%{_datadir}/upscayl

ln -s %{_datadir}/upscayl/upscayl-bin %{buildroot}%{_bindir}/upscayl-bin

%fdupes %{buildroot}%{_datadir}

%files
%license COPYING
%doc PRESS* README*
%{_bindir}/%{name}
%{_datadir}/applications/*.desktop
%{_datadir}/glib-2.0/schemas/%{appid}.gschema.xml
%{_datadir}/icons/hicolor/*/apps/%{appid}*.svg
%{_datadir}/metainfo/%{appid}.metainfo.xml
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*

%files -n upscayl-bin
%license upscayl-bin-20240601-103425-linux/LICENSE
%doc README_ubuntu.md
%{_bindir}/upscayl-bin
%{_datadir}/upscayl

%files lang -f %{name}.lang

%changelog
openSUSE Build Service is sponsored by