File xboxdrv.spec of Package xboxdrv
#
# spec file for package xboxdrv
#
# 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/
#
Name: xboxdrv
Version: 0.8.14
Release: 1
Summary: Userspace Xbox gamepad driver and input remapper
License: GPL-3.0-or-later
URL: https://github.com/xiota/xboxdrv
Source0: %{name}-%{version}.tar.gz
Source1: %{name}.default
Source2: %{name}.service
Patch0: Fix-controller-declarations-and-operators.patch
BuildRequires: gcc-c++
BuildRequires: fdupes
BuildRequires: meson
BuildRequires: ninja
BuildRequires: pkgconfig
BuildRequires: boost-devel
BuildRequires: libboost_system-devel
BuildRequires: libboost_headers-devel
BuildRequires: libboost_thread-devel
BuildRequires: libboost_locale-devel
BuildRequires: libboost_log-devel
BuildRequires: libboost_program_options-devel
BuildRequires: libdbus-glib-1-2
BuildRequires: libusb-1_0-devel
BuildRequires: pkgconfig(systemd)
BuildRequires: systemd-mini-devel
BuildRequires: pkgconfig(x11)
BuildRequires: python3-uinput
BuildRequires: python311-dbus-python-devel
BuildRequires: python311
Requires: python3-dbus-python
Requires: python3-uinput
Requires(post): /usr/bin/strip
%description
Userspace Xbox gamepad driver and input remapper
%prep
%autosetup -n %{name}-%{version} -p1
sed -i 's/find_program(\x27python\x27)/find_program(\x27python3\x27)/' meson.build
tee custom.py << EOF
CCFLAGS = "%{optflags}"
EOF
%check
%build
%meson
%meson_build
%install
%meson_install
chmod a-x %{buildroot}%{_mandir}/man1/%{name}.1
install -pm 644 %{SOURCE1} %{buildroot}/etc/default/%{name} || true
install -d %{buildroot}%{_unitdir}/
install -pm 0644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service
install -d %{buildroot}%{_docdir}/%{name}/examples/
install -Dpm 644 examples/* %{buildroot}%{_docdir}/%{name}/examples
install -pm 644 README.md NEWS PROTOCOL %{buildroot}%{_docdir}/%{name}/
install -Dpm 644 data/org.seul.Xboxdrv.conf %{buildroot}%{_sysconfdir}/dbus-1/system.d/org.seul.Xboxdrv.conf
%fdupes %{buildroot}/%{_prefix}
sed -i 's|#!/usr/bin/env python3|#!/usr/bin/python3|' %{buildroot}/usr/bin/xboxdrvctl
sed -i '/<policy context="default">/a \ <allow send_destination="org.seul.Xboxdrv"/>' %{buildroot}/etc/dbus-1/system.d/org.seul.Xboxdrv.conf
mkdir -p %{buildroot}%{_sbindir}/
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
%{__strip} %{buildroot}%{_bindir}/xboxdrv
%pre
%service_add_pre %{name}.service
%post
%service_add_post %{name}.service
%preun
%service_del_preun %{name}.service
%postun
%service_del_postun %{name}.service
%files
%defattr(-,root,root,-)
%license COPYING
%doc %{_docdir}/%{name}
%dir %attr(0755, root, root) %{_bindir}/
%dir %attr(0755, root, root) %{_sbindir}/
%attr(0755, root, root) %{_bindir}/%{name}
%attr(0755, root, root) %{_bindir}/xboxdrvctl
%{_sbindir}/rc%{name}
%dir %attr(0755, root, root) %{_mandir}/
%dir %attr(0755, root, root) %{_mandir}/man1/
%{_mandir}/man1/%{name}.1%{?ext_man}
%dir %{_unitdir}
%{_unitdir}/%{name}.service
%config /etc/default/%{name}
%config(noreplace) /etc/dbus-1/system.d/org.seul.Xboxdrv.conf
/usr/lib64/systemd/system/
/usr/share/doc/xboxdrv/
%changelog