File linuxptp.spec of Package linuxptp

#
# spec file for package linuxptp
#
# Copyright (c) 2014 SUSE LINUX Products 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/
#


Name:           linuxptp
Version:        1.4
Release:        0
Summary:        Precision Time Protocol v2 daemon
License:        GPL-2.0+
Group:          Productivity/Networking/Other
Url:            http://linuxptp.sourceforge.net/
Source0:        linuxptp-%{version}.tar.bz2
Source1:        ptp4l.service
Source2:        sysconfig.ptp4l
Source3:        linuxptp.firewall
Source4:        linuxptp-howto.txt
Source5:        phc2sys.service
Source6:        sysconfig.phc2sys
BuildRequires:  kernel-source
BuildRequires:  systemd
PreReq:         %insserv_prereq  %fillup_prereq
Provides:       ptp-timekeeping
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%{?systemd_requires}

%description
This software is an implementation of the Precision Time Protocol (PTP)
according to IEEE standard 1588 for Linux. The dual design goals are to provide
a robust implementation of the standard and to use the most relevant and modern
Application Programming Interfaces (API) offered by the Linux kernel.

%prep
%setup0 -q 

%build
export EXTRA_CFLAGS="$RPM_OPT_FLAGS -Iusr/include"

# take missing header files form kernel sources
make -C /usr/src/linux headers_install O=$PWD

make %{?_smp_mflags}

cp %{SOURCE4} .

%install
make prefix=%{buildroot}/usr mandir=%{buildroot}/%{_mandir} install

%__install -Dm 644 %{SOURCE1} %{buildroot}/%{_unitdir}/ptp4l.service
%__install -Dm 644 %{SOURCE5} %{buildroot}/%{_unitdir}/phc2sys.service
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcptp4l
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcphc2sys

%__install -Dm 644 default.cfg %{buildroot}/%{_sysconfdir}/ptp4l.conf

%__install -Dm 644 %{SOURCE2} %{buildroot}/var/adm/fillup-templates/sysconfig.ptp4l
%__install -Dm 644 %{SOURCE6} %{buildroot}/var/adm/fillup-templates/sysconfig.phc2sys

%__install -Dm 644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/linuxptp

%pre
%service_add_pre ptp4l.service phc2sys.service

%post
%{fillup_only -n ptp4l}
%{fillup_only -n phc2sys}
%service_add_post ptp4l.service phc2sys.service

%preun
%service_del_preun ptp4l.service phc2sys.service

%postun
%service_del_postun ptp4l.service phc2sys.service

%files
%defattr(-,root,root)
%{_unitdir}/ptp4l.service
%{_unitdir}/phc2sys.service
%{_sbindir}/rcptp4l
%{_sbindir}/rcphc2sys
%config %{_sysconfdir}/ptp4l.conf
%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/linuxptp
%{_sbindir}/hwstamp_ctl
%{_sbindir}/phc2sys
%{_sbindir}/pmc
%{_sbindir}/ptp4l
%{_mandir}/man8/hwstamp_ctl.8.gz
%{_mandir}/man8/phc2sys.8.gz
%{_mandir}/man8/pmc.8.gz
%{_mandir}/man8/ptp4l.8.gz
/var/adm/fillup-templates/sysconfig.ptp4l
/var/adm/fillup-templates/sysconfig.phc2sys
%doc README.org COPYING linuxptp-howto.txt

%changelog
openSUSE Build Service is sponsored by