File spacenavd.spec of Package spacenavd

#
# spec file for package spacenavd
#
# Copyright (c) 2009,2011,2013 Herbert Graeber
#
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#

Name:          spacenavd
Version:       0.6
Release:       0
Summary:       Daemon for 3Dconnexion devices
Group:         Hardware/Other
License:       GPL-3.0+
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: xorg-x11
BuildRequires: xorg-x11-devel
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