# Generated by rust2rpm 27
%bcond check 0

%global crate niri-taskbar
%global crate_version 0.2.0+niri.25.05

Name:           rust-niri-taskbar
Version:        %(echo %crate_version | sed 's/\+.*//g')
Release:        1%?dist
Summary:        Niri taskbar module for Waybar

License:        MIT
URL:            https://crates.io/crates/niri-taskbar
Source:         %{crates_source %{crate} %{crate_version}}
# Automatically generated patch to strip dependencies and normalize metadata
Patch:          niri-taskbar-fix-metadata-auto.diff

BuildRequires:  cargo-rpm-macros >= 24
BuildRequires:  pkgconfig(cairo-gobject)
BuildRequires:  pkgconfig(cairo)
BuildRequires:  pkgconfig(gdk-pixbuf-2.0)
BuildRequires:  pkgconfig(gtk4)
BuildRequires:  pkgconfig(atk)
BuildRequires:  pkgconfig(gdk-3.0)

%global _description %{expand:
Niri taskbar module for Waybar.}

%description %{_description}

%package     -n waybar-%{crate}
Summary:        %{summary}
License:        ((MIT OR Apache-2.0) AND Unicode-3.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 (BSD-2-Clause OR Apache-2.0 OR MIT) AND GPL-3.0-or-later AND MIT AND (MIT OR Apache-2.0) AND (MIT OR Apache-2.0 OR LGPL-2.1-or-later) AND MPL-2.0 AND (Unlicense OR MIT)
# LICENSE.dependencies contains a full license breakdown

%description -n waybar-%{crate} %{_description}

%files       -n waybar-%{crate}
%license LICENSE
%license LICENSE.dependencies
%doc README.md
%doc USAGE
%_libdir/waybar/libniri_taskbar.so

%prep
%autosetup -n %{crate}-%{crate_version} -p1
%cargo_prep_online
cat<<EOF > USAGE
The module is installed to:
 %_libdir/waybar/libniri_taskbar.so

See https://crates.io/crates/niri-taskbar#configuration for more info.
EOF

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

%install
install -Dm755 target/rpm/libniri_taskbar.so -t %buildroot%_libdir/waybar/

%posttrans
[ $1 -eq 1 ] && cat %_pkgdocdir/USAGE

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