File gpsd.spec of Package gpsd

#
# spec file for package gpsd
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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/
#


%define		libgps libgps22
%define		libQgps libQgpsmm22
%define         _udevdir %(pkg-config --variable udevdir udev)
Name:           gpsd
Version:        3.15
Release:        0
Summary:        Service daemon for mediating access to a GPS
License:        BSD-3-Clause
Group:          Hardware/Other
Url:            http://www.catb.org/gpsd/
Source0:        http://download-mirror.savannah.gnu.org/releases/gpsd/%{name}-%{version}.tar.gz
Source98:       http://download-mirror.savannah.gnu.org/releases/gpsd/%{name}-%{version}.tar.gz.sig
Source1:        rules.gpsd
Source2:        udev.gpsd
Source3:        sysconfig.gpsd
Source4:        gpsd.xpm
Source5:        xgps.desktop
Source6:        xgpsspeed.desktop
Source99:       %{name}.keyring
Patch0:         gpsd-fix-shebang.patch
BuildRequires:  bluez-devel
BuildRequires:  chrpath
BuildRequires:  dbus-1-glib-devel
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  libcap-devel
BuildRequires:  libqt4-devel >= 4.5.3
BuildRequires:  libusb-1_0-devel
BuildRequires:  ncurses-devel
BuildRequires:  pps-tools-devel
BuildRequires:  python-devel
BuildRequires:  scons >= 2.0.1
BuildRequires:  update-desktop-files
BuildRequires:  xmlto
BuildRequires:  pkgconfig(udev)
%if 0%{?suse_version} >= 1210
BuildRequires:  systemd-rpm-macros
%systemd_requires
%endif
Requires:       udev
Requires(pre):  %fillup_prereq
Requires(pre):  coreutils
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
gpsd is a service daemon that mediates access to a GPS sensor connected
to the host computer by serial or USB interface, making its data on the
location/course/velocity of the sensor available to be queried on TCP
port 2947 of the host computer.  With gpsd, multiple GPS client
applications (such as navigational and wardriving software) can share
access to a GPS without contention or loss of data.  Also, gpsd
responds to queries with a format that is substantially easier to parse
than NMEA 0183.  A client library is provided for applications.

After installing this RPM, gpsd will automatically connect to USB GPSes
when they are plugged in and requires no configuration.  For serial
GPSes, you will need to start gpsd by hand.  Once connected, the daemon
automatically discovers the correct baudrate, stop bits, and protocol.
The daemon will be quiescent when there are no clients asking for
location information, and copes gracefully when the GPS is unplugged
and replugged.

%package devel
Summary:        Client libraries in C and Python for talking to a running gpsd or GPS
Group:          Development/Libraries/C and C++
Requires:       %{libQgps}
Requires:       %{libgps}
Requires:       %{name} = %{version}
Requires:       pkgconfig
Requires:       python-curses
Requires:       python-gpsd = %{version}

%description devel
This package provides C header files for the gpsd shared libraries that
manage access to a GPS for applications and debugging tools. You will
need to have gpsd installed for it to work.

%package -n %{libgps}
Summary:        Shared library for GPS applications
Group:          Development/Libraries/Python

%description -n %{libgps}
This package provides the shared library for gpsd and other GPS aware
applications.

%package -n %{libQgps}
Summary:        Shared Qt library for GPS applications
Group:          Development/Libraries/Python

%description -n %{libQgps}
This package provides the shared Qt library for gpsd and other GPS aware
applications.

%package -n python-gpsd
Summary:        Client libraries in C and Python for talking to a running gpsd or GPS
Group:          Development/Libraries/Python
Requires:       %{name} = %{version}
%py_requires

%description -n python-gpsd
This package provides python modules and tools for the gpsd shared libraries.
You will need to have gpsd installed for it to work.

%package clients
Summary:        Clients for gpsd with an X interface
Group:          Hardware/Other
Requires:       python-gpsd
Requires:       python-gtk

%description clients
xgps is a simple test client for gpsd with an X interface. It displays
current GPS position/time/velocity information and (for GPSes that
support the feature) the locations of accessible satellites.

xgpsspeed is a speedometer that uses position information from the GPS.
It accepts an -h option and optional argument as for gps, or a -v
option to dump the package version and exit. Additionally, it accepts
-rv (reverse video) and -nc (needle color) options.

cgps resembles xgps, but without the pictorial satellite display.  It
can run on a serial terminal or terminal emulator.

%prep
%setup -q
%patch0 -p1

# don't set RPATH
sed -i 's|env.Prepend.*RPATH.*|pass #\0|' SConstruct

%build
export CFLAGS="%{optflags} -fvisibility-inlines-hidden"
export CXXFLAGS="%{optflags} -fvisibility-inlines-hidden"
scons prefix=%{_prefix} libdir=%{_libdir} strip=False

%install
export CFLAGS="%{optflags} -fvisibility-inlines-hidden"
export CXXFLAGS="%{optflags} -fvisibility-inlines-hidden"
DESTDIR=%{buildroot} scons prefix=%{_prefix} libdir=%{_libdir} strip=False install
install -d -m 755 %{buildroot}%{_udevdir}
install -d -m 755 %{buildroot}%{_udevdir}/rules.d
install -d -m 755 %{buildroot}%{_localstatedir}/adm/fillup-templates
install -d -m 755 %{buildroot}%{_datadir}/{applications,pixmaps}
install -m 644 %{SOURCE1} %{buildroot}%{_udevdir}/rules.d/51-gpsd.rules
install -m 755 %{SOURCE2} %{buildroot}%{_udevdir}/gpsd.sh
install -m 644 %{SOURCE3} %{buildroot}%{_localstatedir}/adm/fillup-templates
if [ -f %{buildroot}%{python_sitearch}/*.egg-info ] ; then
  rm -f %{buildroot}%{python_sitearch}/*.egg-info
fi
chmod 755 %{buildroot}%{python_sitearch}/gps/gps.py
# install desktop entries
install -m 644 %{SOURCE4} %{buildroot}%{_datadir}/pixmaps/%{name}.xpm
install -m 644 %{SOURCE5} %{buildroot}%{_datadir}/applications/
install -m 644 %{SOURCE6} %{buildroot}%{_datadir}/applications/
%if 0%{?suse_version} >= 1210
install -D -m 644 systemd/gpsd.service %{buildroot}/%{_unitdir}/gpsd.service
install -D -m 644 systemd/gpsd.socket %{buildroot}/%{_unitdir}/gpsd.socket
install -D -m 644 systemd/gpsdctl@.service %{buildroot}/%{_unitdir}/gpsdctl@.service
ln -s  	%{_sbindir}/service %{buildroot}%{_sbindir}/rcgpsd
%endif

%suse_update_desktop_file xgpsspeed
%suse_update_desktop_file xgps
# save some space, create symlinks
%fdupes -s %{buildroot}

%pre
%if 0%{?suse_version} >= 1210
%service_add_pre gpsd.service gpsdctl@.service
%endif

%post
/sbin/ldconfig
%fillup_only -n gpsd
%if 0%{?suse_version} >= 1210
%service_add_post gpsd.service gpsdctl@.service
%udev_rules_update
%endif

%preun
%if 0%{?suse_version} >= 1210
%service_del_preun gpsd.service gpsdctl@.service
%endif

%postun
/sbin/ldconfig
%if 0%{?suse_version} >= 1210
%service_del_postun gpsd.service gpsdctl@.service
%endif

%post -n %{libgps} -p /sbin/ldconfig

%postun -n %{libgps} -p /sbin/ldconfig

%post -n %{libQgps} -p /sbin/ldconfig

%postun -n %{libQgps} -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc README COPYING gpsd.php
%{_mandir}/man?/gpsd.*
%{_mandir}/man?/gpsdctl.*
%{_mandir}/man?/gpsctl.*
%{_mandir}/man?/gpsinit.*
%{_udevdir}/gpsd.sh
%{_udevdir}/rules.d/*
%if 0%{?suse_version} >= 1210
%{_unitdir}/gpsd.service
%{_unitdir}/gpsd.socket
%{_unitdir}/gpsdctl@.service
%{_sbindir}/rcgpsd
%endif
%{_sbindir}/gpsd
%{_sbindir}/gpsdctl
%{_bindir}/gpsctl
%{_localstatedir}/adm/fillup-templates/sysconfig.gpsd

%files -n %{libgps}
%defattr(-,root,root)
%{_libdir}/libgps.so.*

%files -n %{libQgps}
%defattr(-,root,root)
%{_libdir}/libQgpsmm.so.*

%files devel
%defattr(-,root,root)
%doc README COPYING TODO
%{_mandir}/man?/gpsfake.*
%{_mandir}/man?/gpscat.*
%{_mandir}/man?/libQgps*.*
%{_mandir}/man?/libgps*.*
%{_mandir}/man?/srec.*
%{_mandir}/man?/gpsdecode.*
%{_mandir}/man?/gpsd_json.*
%{_mandir}/man?/gpsprof.*
%{_bindir}/gpsfake
%{_bindir}/gpscat
%{_bindir}/gpsdecode
%{_bindir}/gpsprof
%{_includedir}/gps.h
%{_includedir}/libgpsmm.h
%{_libdir}/libgps.so
%{_libdir}/libQgpsmm.so
%{_libdir}/libQgpsmm.prl
%{_libdir}/pkgconfig/libgps*.pc
%{_libdir}/pkgconfig/Qgpsmm.pc

%files -n python-gpsd
%defattr(-,root,root)
%{python_sitearch}/gps/

%files clients
%defattr(-,root,root)
%{_mandir}/man?/gps.*
%{_mandir}/man?/gegps.*
%{_mandir}/man?/cgps.*
%{_mandir}/man?/lcdgps.1.gz
%{_mandir}/man?/xgps.*
%{_mandir}/man?/xgpsspeed.*
%{_mandir}/man?/gpspipe.*
%{_mandir}/man?/gpsmon.*
%{_mandir}/man?/gps2udp.*
%{_mandir}/man?/ntpshmmon.*
%{_bindir}/gegps
%{_bindir}/xgps
%{_bindir}/xgpsspeed
%{_bindir}/cgps
%{_bindir}/lcdgps
%{_bindir}/gpsmon
%{_bindir}/gpspipe
%{_bindir}/gps2udp
%{_bindir}/gpxlogger
%{_bindir}/ntpshmmon
%{_datadir}/applications/*.desktop
%{_datadir}/pixmaps/*.xpm

%changelog
openSUSE Build Service is sponsored by