# Generated by rust2rpm 27
%bcond check 1
%global rustflags_debuginfo 1

Name:           lan-mouse
Version:        0.10.0
Release:        %autorelease
Summary:        Software KVM Switch / mouse & keyboard sharing software for Local Area Networks

License:        GPL-3.0-or-later
URL:            https://github.com/feschber/lan-mouse
Source0:        %{url}/archive/refs/tags/v%version.tar.gz
Packager:       ayykamp <kamp@ayyy.dev>

Requires:       gtk4
BuildRequires:  cargo-rpm-macros >= 24
BuildRequires:  anda-srpm-macros
BuildRequires:  cargo mold
BuildRequires:  pkgconfig(glib-2.0) >= 2.66
BuildRequires:  pkgconfig(gtk4) >= 4.2
BuildRequires:  pkgconfig(libadwaita-1) >= 1.1
BuildRequires:  libXtst-devel

%description
Software KVM Switch / mouse & keyboard sharing software for Local Area Networks.

%prep
%autosetup -n lan-mouse-%{version} -p1
%cargo_prep_online


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


%install
%cargo_install

# install app icon
install -D -d -m 0755 %{buildroot}%{_datadir}/icons/hicolor/scalable/apps
install -p -m 0644 %{_builddir}/%{name}-%{version}/lan-mouse-gtk/resources/de.feschber.LanMouse.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps

# install desktop entry
install -D -d -m 0755 %{buildroot}%{_datadir}/applications
install -p -m 0644 %{_builddir}/%{name}-%{version}/de.feschber.LanMouse.desktop %{buildroot}%{_datadir}/applications

# when using firewalld: install firewall rule
install -D -d -m 0755 %{buildroot}%{_prefix}/lib/firewalld/services
install -p -m 0644 %{_builddir}/%{name}-%{version}/firewall/lan-mouse.xml %{buildroot}%{_prefix}/lib/firewalld/services

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


%files
%license LICENSE
%license LICENSE.dependencies
%doc DOC.md
%doc README.md
%{_bindir}/%{name}
%{_datadir}/icons/hicolor/scalable/apps/de.feschber.LanMouse.svg
%{_datadir}/applications/de.feschber.LanMouse.desktop
%dir %{_prefix}/lib/firewalld
%dir %{_prefix}/lib/firewalld/services
%{_prefix}/lib/firewalld/services/lan-mouse.xml


%changelog
* Fri Jun 27 2025 ayykamp <kamp@ayyy.dev>
- Initial package
