File shanwan-gamepad.spec of Package shanwan-gamepad
#
# spec file for package ShanWanTwin_2-4Ghz_Linux
#
# Copyright (c) 2022 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 pkgname shanwan-gamepad
%define _pkgname ShanWanTwin_2-4Ghz_Linux
%define pkgver 1.0
%define pkgrel 1
%define pkgdesc "Splits the incoming data so that Linux can see both joysticks of the ShanWanTwin 2.4Ghz USB gamepad (2563:0555)"
%define url https://github.com/Jonatas-Goncalves/ShanWanTwin_2-4Ghz_Linux
%define license MIT
%define depends python311 python311-uinput
%define makedepends git
Name: %{pkgname}
Version: %{pkgver}
Release: %{pkgrel}
Summary: Splits the incoming data so that Linux can see both joysticks
License: %{license}
URL: %{url}
Source0: ShanWanTwin_2-4Ghz_Linux-master.tar.gz
BuildArch: noarch
BuildRequires: %{makedepends}
Requires: %{depends}
Requires: xboxdrv
%description
Splits the incoming data so that Linux can see both joysticks of the ShanWanTwin 2.4Ghz USB gamepad (2563:0555).
%prep
%autosetup -n %{_pkgname}-master
%check
%build
%install
mkdir -p %{buildroot}/usr/share/%{pkgname}
mkdir -p %{buildroot}/usr/bin
mkdir -p %{buildroot}/usr/lib/systemd/system
mkdir -p %{buildroot}/usr/lib/udev/rules.d
mkdir -p %{buildroot}/usr/share/licenses/%{pkgname}
mkdir -p %{buildroot}/usr/lib/mame/ctrlr
install -m 755 shanwan-joystick.py %{buildroot}/usr/share/%{pkgname}/shanwan-joystick.py
install -m 755 map_gamepad.sh %{buildroot}/usr/share/%{pkgname}/map_gamepad.sh
install -m 755 shanwan-start.sh %{buildroot}/usr/bin/shanwan-start.sh
install -m 644 shanwan.service %{buildroot}/usr/lib/systemd/system/shanwan.service
install -m 644 93-shanwan.rules %{buildroot}/usr/lib/udev/rules.d/93-shanwan.rules
install -m 644 LICENSE %{buildroot}/usr/share/licenses/%{pkgname}/LICENSE
install -m 644 shanwan-twin.cfg %{buildroot}/usr/lib/mame/ctrlr/shanwan-twin.cfg
%pre
%service_add_pre shanwan.service
%post
%service_add_post shanwan.service
if [ -x /bin/systemctl ]; then
/bin/systemctl enable --now shanwan.service || true
fi
%preun
%systemd_preun shanwan.service
%postun
%systemd_postun_with_restart shanwan.service
if [ -x /bin/systemctl ]; then
/bin/systemctl daemon-reload || true
fi
%files
%defattr(-,root,root)
%dir %attr(0755, root, root) "/usr/bin"
%dir %attr(0755, root, root) "/usr/lib"
%dir %attr(0755, root, root) "/usr/share"
%dir %attr(0755, root, root) "/usr/lib/mame"
%dir %attr(0755, root, root) "/usr/share/licenses"
%dir %attr(0755, root, root) "/usr/share/licenses/shanwan-gamepad"
%dir %attr(0755, root, root) "/usr/share/shanwan-gamepad"
/usr/bin/shanwan-start.sh
/usr/lib/systemd/system/shanwan.service
/usr/lib/udev/rules.d/93-shanwan.rules
/usr/share/licenses/shanwan-gamepad/LICENSE
/usr/share/shanwan-gamepad/map_gamepad.sh
/usr/share/shanwan-gamepad/shanwan-joystick.py
/usr/lib/mame/ctrlr/
%changelog