# Generated by rust2rpm 27
%bcond check 1

# prevent library files from being installed
%global cargo_install_lib 0

%global upstream_version v2.16.2
%global ver %{sub %upstream_version 2}

Name:           walker
Version:        %{gsub %{gsub %ver - ~ 1} - _}
Release:        %autorelease
Summary:        Multi-Purpose Launcher with a lot of features. Highly Customizable and fast.

SourceLicense:  GPL-3.0
License:        ((Apache-2.0 OR MIT) AND BSD-3-Clause) AND Apache-2.0 AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND CC0-1.0 AND ISC AND MIT AND (MIT OR Apache-2.0) AND MPL-2.0 AND (Unlicense OR MIT) AND Zlib
# LICENSE.dependencies contains a full license breakdown

URL:            https://github.com/abenz1267/walker
Source:         %url/archive/refs/tags/%upstream_version.tar.gz

Packager:       madonuko <mado@fyralabs.com>
Requires:       elephant

BuildRequires:  cargo-rpm-macros >= 26
BuildRequires:  pkgconfig(gtk4)
BuildRequires:  pkgconfig(gtk4-layer-shell-0)
BuildRequires:  pkgconfig(cairo)
BuildRequires:  protobuf-compiler
BuildRequires:  pkgconfig(poppler-glib)
%ifarch x86_64
# BUG: fedora rustc missing this dep
BuildRequires:  libedit(x86-64)
%endif

%global _description %{expand:
%{summary}.}

%description %{_description}

%prep
%autosetup -n walker-%{ver} -p1
%cargo_prep_online

%build
%{cargo_license_summary_online}
%{cargo_license_online} > LICENSE.dependencies

%install
%cargo_install

%define cfgdir %buildroot/etc/xdg/walker
%define themedir %cfgdir/themes/default

install -Dm644 resources/config.toml %cfgdir/config.toml
install -Dm644 resources/themes/default/item.xml %themedir/item.xml
install -Dm644 resources/themes/default/item_calc.xml %themedir/item_calc.xml
install -Dm644 resources/themes/default/item_clipboard.xml %themedir/item_clipboard.xml
install -Dm644 resources/themes/default/item_dmenu.xml %themedir/item_dmenu.xml
install -Dm644 resources/themes/default/item_files.xml %themedir/item_files.xml
install -Dm644 resources/themes/default/item_providerlist.xml %themedir/item_providerlist.xml
install -Dm644 resources/themes/default/item_symbols.xml %themedir/item_symbols.xml
install -Dm644 resources/themes/default/layout.xml %themedir/layout.xml
install -Dm644 resources/themes/default/preview.xml %themedir/preview.xml
install -Dm644 resources/themes/default/style.css %themedir/style.css


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

%files
%license LICENSE
%license LICENSE.dependencies
%doc README.md
%{_bindir}/walker
/etc/xdg/walker/
