File spacenavd.spec of Package spacenavd

#
# spec file for package spacenavd
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2009,2011,2013 Herbert Graeber
#
# 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 http://bugs.opensuse.org/
#


Name:           spacenavd
Version:        0.6
Release:        0
Summary:        Daemon for 3Dconnexion devices
License:        GPL-3.0+
Group:          Hardware/Other
Url:            http://spacenav.sourceforge.net
Source:         http://downloads.sf.net/spacenav/%{name}-%{version}.tar.gz
Source1:        spacenavd.8.gz
Source2:        spnavrc
Source3:        xinitrc-%{name}
Source4:        %{name}.service
# PATCH-FIX-UPSTREAM bmwiedemann https://sourceforge.net/p/spacenav/patches/6/
Patch0:         reproducible.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  pkgconfig(x11)
Requires:       xdpyinfo
%if 0%{?suse_version} > 1140
BuildRequires:  systemd-rpm-macros
%{?systemd_requires}
%define has_systemd 1
%endif

%description
Spacenavd is a free software replacement user-space driver (daemon)
for 3Dconnexion's 6-degree-of-freedoms input devices. It is
compatible with the original 3dxsrv daemon, and works perfectly with
any program that was written for the 3Dconnexion driver.
 
%prep  
%setup -q
%patch0 -p1

%build
%configure
make opt="%optflags"

%install
install -D -m 755 %{name} %{buildroot}%{_sbindir}/%{name}
install -D -m 755 spnavd_ctl %{buildroot}%{_bindir}/spnavd_ctl
install -D -m 644 %{SOURCE1} %{buildroot}%{_mandir}/man8/spacenavd.8.gz
ln -sf spacenavd.8.gz $RPM_BUILD_ROOT%{_mandir}/man8/spnavd_ctl.8.gz
install -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/spnavrc
install -D -m 755 %{SOURCE3} %{buildroot}%{_sysconfdir}/X11/xinit/xinitrc.d/%{name}
ln -sf service $RPM_BUILD_ROOT%{_sbindir}/rc%{name}
%if 0%{?has_systemd}
install -D -m 644 %{SOURCE4} %{buildroot}%{_unitdir}/%{name}.service
%endif

%post
%fillup_only -n %{name}
%if 0%{?has_systemd}
%service_add_post %{name}.service
%endif

%postun
%if 0%{?has_systemd}
%service_del_postun %{name}.service
%else
%restart_on_update %{name}
%insserv_cleanup
%endif

%pre
%if 0%{?has_systemd}
%service_add_pre %{name}.service
%endif

%preun
%if 0%{?has_systemd}
%service_del_preun %{name}.service
%else
%stop_on_removal %{name}
%endif

%files
%defattr(-,root,root)
%doc COPYING README
%{_sbindir}/%{name}
%{_sbindir}/rc%{name}
%{_bindir}/spnavd_ctl
%config(noreplace) %{_sysconfdir}/spnavrc
%if 0%{?has_systemd}
%{_unitdir}/%{name}.service
%endif
%{_mandir}/man8/spacenavd.8.gz
%{_mandir}/man8/spnavd_ctl.8.gz
%{_sysconfdir}/X11/xinit/

%changelog
openSUSE Build Service is sponsored by