File linuxptp.spec of Package linuxptp

# spec file for package linuxptp
# Copyright (c) 2018 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

#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
  %define _fillupdir %{_localstatedir}/adm/fillup-templates
Name:           linuxptp
Version:        1.8+git65.g303b08c
Release:        0
Summary:        Precision Time Protocol v2 daemon
License:        GPL-2.0+
Group:          Productivity/Networking/Other
Source0:        %{name}-%{version}.tar.xz
Source1:        ptp4l.service
Source2:        sysconfig.ptp4l
Source3:        linuxptp.firewall
Source4:        linuxptp-howto.txt
Source5:        phc2sys.service
Source6:        sysconfig.phc2sys
BuildRequires:  kernel-devel
BuildRequires:  systemd-rpm-macros
Requires(pre):  %fillup_prereq
Provides:       ptp-timekeeping

This software is an implementation of the Precision Time Protocol (PTP)
according to the IEEE1588 standard for Linux.

%setup -q

export EXTRA_CFLAGS="%{optflags} -Iusr/include"
make %{?_smp_mflags}

cp %{SOURCE4} .

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

install -Dpm 644 %{SOURCE1} %{buildroot}/%{_unitdir}/ptp4l.service
install -Dpm 644 %{SOURCE5} %{buildroot}/%{_unitdir}/phc2sys.service
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcptp4l
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcphc2sys

install -Dpm 644 default.cfg %{buildroot}/%{_sysconfdir}/ptp4l.conf

install -Dpm 644 %{SOURCE2} %{buildroot}%{_fillupdir}/sysconfig.ptp4l
install -Dpm 644 %{SOURCE6} %{buildroot}%{_fillupdir}/sysconfig.phc2sys

install -Dpm 644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/linuxptp

%service_add_pre ptp4l.service phc2sys.service

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

%service_del_preun ptp4l.service phc2sys.service

%service_del_postun ptp4l.service phc2sys.service

%doc COPYING linuxptp-howto.txt
%config %{_sysconfdir}/ptp4l.conf
%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/linuxptp

openSUSE Build Service is sponsored by