File czkawka.spec of Package czkawka

#
# spec file for package czkawka
#
# Copyright (c) 2025 mantarimay
#
# 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/
#


%bcond_with test
%define appid   com.github.qarmin.czkawka
Name:           czkawka
Version:        10.0.0
Release:        0
Summary:        Tool to find duplicates, empty folders, similar images
License:        MIT
URL:            https://github.com/qarmin/czkawka
Source:         %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
Source1:        vendor.tar.zst
BuildRequires:  appstream-glib
BuildRequires:  cargo-packaging
BuildRequires:  desktop-file-utils
BuildRequires:  gcc-c++
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(dav1d)
BuildRequires:  pkgconfig(gtk4)
BuildRequires:  pkgconfig(graphene-gobject-1.0)
BuildRequires:  pkgconfig(libavif)
BuildRequires:  pkgconfig(libheif)
BuildRequires:  pkgconfig(libraw)

%description
Czkawka is a simple, fast and free app to remove unnecessary files from
your computer.

%package cli
Summary:        CLI frontend of Czkawka
License:        MIT

%description cli
Czkawka is a simple, fast and free app to remove unnecessary files from
your computer.

CLI frontend of Czkawka.

%package -n krokiet
Summary:        Slint frontend of Czkawka
License:        MIT AND GPL-3.0-only

%description -n krokiet
Krokiet is new Czkawka frontend written in Slint, which uses Rust in
opposite to Gtk 4 frontend which uses mostly C code.

Czkawka is a simple, fast and free app to remove unnecessary files from
your computer.

%prep
%autosetup -a1

%build
%{cargo_build} --features "heif,libraw,libavif"

%install
install -Dm755 target/release/%{name}_{cli,gui} -t %{buildroot}%{_bindir}
install -Dm644 data/icons/%{appid}{,.Devel}.svg -t %{buildroot}%{_datadir}/icons/hicolor/scalable/apps
install -Dm644 data/icons/%{appid}-symbolic.svg -t %{buildroot}%{_datadir}/icons/hicolor/symbolic/apps
install -Dm644 data/%{appid}.desktop -t %{buildroot}%{_datadir}/applications
install -Dm644 data/%{appid}.metainfo.xml -t %{buildroot}%{_datadir}/metainfo

install -Dm755 target/release/krokiet -t %{buildroot}%{_bindir}
install -Dm644 krokiet/icons/krokiet_logo.png %{buildroot}%{_datadir}/icons/hicolor/512x512/apps/krokiet.png
install -d "%{buildroot}%{_datadir}/applications/"
cat > "%{buildroot}%{_datadir}/applications/krokiet.desktop" << _EOD
[Desktop Entry]
Type=Application
Name=Krokiet
GenericName=Krokiet
Comment=Slint frontend of Czkawka
Exec=krokiet
Icon=krokiet
Terminal=false
StartupNotify=false
Categories=Utility;
StartupWMClass=Unknown
_EOD

%check
%if %{with test}
%{cargo_test}
%endif

desktop-file-validate %{buildroot}/%{_datadir}/applications/*.desktop
appstream-util validate-relax --nonet \
      %{buildroot}%{_datadir}/metainfo/%{appid}.metainfo.xml 

%files
%license %{name}_gui/LICENSE*
%doc README.md instructions/Instruction.md Changelog.md %{name}_gui/README.md
%{_bindir}/%{name}_gui
%{_datadir}/icons/hicolor/{scalable,symbolic}/apps/*.svg
%{_datadir}/applications/%{appid}.desktop
%{_datadir}/metainfo/%{appid}.metainfo.xml

%files cli
%license %{name}_cli/LICENSE*
%doc %{name}_cli/README.md
%{_bindir}/%{name}_cli

%files -n krokiet
%license krokiet/LICENSE*
%doc krokiet/README.md
%{_bindir}/krokiet
%{_datadir}/icons/hicolor/512x512
%{_datadir}/applications/krokiet.desktop

%changelog
openSUSE Build Service is sponsored by