File spacenavd.spec of Package spacenavd

Name:           spacenavd
Version:        0.6
Release:        1%{?dist}
Summary:        A free, compatible alternative for 3Dconnexion's input drivers

Group:          User Interface/X Hardware Support
License:        GPLv3+
URL:            http://spacenav.sourceforge.net/
Source0:        http://downloads.sourceforge.net/spacenav/%{name}-%{version}.tar.gz
# systemd unit files, for fedora
Source1:        spacenavd.service
# systemV init script, for el6
Source2:        spacenavd

BuildRequires:  libX11-devel

%if 0%{?fedora} || 0%{?rhel} >= 7
BuildRequires:  systemd

Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%else
Requires(post): /sbin/chkconfig
Requires(post): /sbin/service
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service
%endif


%description
Spacenavd, is a free software replacement user-space driver (daemon), for
3Dconnexion's space-something 6dof input devices. It's compatible with the
original 3dxsrv proprietary daemon provided by 3Dconnexion, and works
perfectly with any program that was written for the 3Dconnexion driver.


%prep
%setup -q


%build
%configure
sed -i "s/CFLAGS =/CFLAGS +=/g" Makefile

make %{?_smp_mflags}


%install
%make_install

%if 0%{?fedora} || 0%{?rhel} >= 7
# Install systemd unit file
mkdir -p %{buildroot}%{_unitdir}
install -p -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}
%else
# Install systemV init script
mkdir -p %{buildroot}%{_initrddir}
install -p -m 0755 %{SOURCE2} %{buildroot}%{_initrddir}
%endif


%post
%if 0%{?fedora} || 0%{?rhel} >= 7
    %systemd_post spacenavd.service
%else
    if [ $1 -eq 1 ] ; then 
        /sbin/chkconfig --add spacenavd &> /dev/null || :
    fi
%endif

%preun
%if 0%{?fedora} || 0%{?rhel} >= 7
    %systemd_preun spacenavd.service
%else
    if [ $1 -eq 0 ] ; then
        /sbin/service spacenavd stop &> /dev/null
        /sbin/chkconfig --del spacenavd &> /dev/null || :
    fi
%endif

%postun
%if 0%{?fedora} || 0%{?rhel} >= 7
    %systemd_postun_with_restart spacenavd.service
%else
    if [ $1 -ge 1 ] ; then
        /bin/service restart spacenavd &> /dev/null || :
    fi
%endif


%files
%doc AUTHORS COPYING doc/* README
%{_bindir}/*
%if 0%{?fedora} || 0%{?rhel} >= 7
%{_unitdir}/%{name}.service
%else
%{_initrddir}/%{name}
%endif


%changelog
* Mon Aug 18 2014 Richard Shaw <hobbes1069@gmail.com> - 0.6-1
- Update to latest upstream release.

* Mon Aug 18 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Fri Feb 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Tue Dec 18 2012 Richard Shaw <hobbes1069@gmail.com> - 0.5-5
- Update package for systemd macros in F18+.

* Tue Oct 16 2012 John Morris <john@zultron.com> - 0.5-4
- Re-add sysv init file for el6

* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Thu Jan 05 2012 Richard Shaw <hobbes1069@gmail.com> - 0.5-3
- Rebuild for GCC 4.7.0.

* Thu Aug 16 2011 Richard Shaw <hobbes1069@gmail.com> - 0.5-2
- Use systemd unit file instead of sysv init file.

* Tue Aug 16 2011 Richard Shaw <hobbes1069@gmail.com> - 0.5-1
- Initial Release.
openSUSE Build Service is sponsored by