File lldpad.spec of Package lldpad

#
# spec file for package lldpad
#
# Copyright (c) 2013 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/
#


%define _name   open-lldp
%define libname liblldp_clif1
Name:           lldpad
Summary:        Link Layer Discovery Protocol (LLDP) Agent
License:        GPL-2.0
Group:          System/Daemons
Version:        0.9.46
Release:        0
BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  libconfig-devel
BuildRequires:  libnl-1_1-devel
BuildRequires:  libtool
BuildRequires:  pkgconfig
BuildRequires:  readline-devel
Url:            http://open-lldp.org/
Source:         http://ftp-osl.osuosl.org/pub/%{_name}/%{_name}-%{version}.tar.gz
Source20:       mkinitrd-boot.sh
Source21:       mkinitrd-stop.sh
Source22:       mkinitrd-setup.sh
Patch1:         %{name}-makefile-fixup
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Provides:       dcbd = %{version}
Obsoletes:      dcbd < %{version}
Requires(post): mkinitrd
Requires(postun): mkinitrd
BuildRequires:  systemd
%systemd_requires

%description
This package contains the Link Layer Discovery Protocol (LLDP) Agent
with Data Center Bridging (DCB) for Intel(R) Network Connections
'lldpad' plus the configuration tools 'dcbtool' and 'lldptool'.

Authors:
--------
    e1000-eedc Mailing List <e1000-eedc@lists.sourceforge.net>
    Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497

%package -n %{libname}
Summary:        Link Layer Discovery Protocol (LLDP) libraries
Group:          System/Libraries

%description -n %{libname}
This package contains the Link Layer Discovery Protocol (LLDP) libraries


%package devel
Summary:        Link Layer Discovery Protocol (LLDP) Agent
Group:          Development/Libraries/C and C++
Requires:       %{libname} = %{version}
Requires:       %{name} = %{version}

%description devel
This package contains the Link Layer Discovery Protocol (LLDP) Agent
with Data Center Bridging (DCB) for Intel(R) Network Connections
'lldpad' plus the configuration tools 'dcbtool' and 'lldptool'.



Authors:
--------
    e1000-eedc Mailing List <e1000-eedc@lists.sourceforge.net>
    Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497

%prep
%setup -q -n %{_name}-%{version}
%patch1 -p1

%build
autoreconf -vi
%configure \
	--disable-static
make %{?_smp_mflags}

%check
make check %{?_smp_mflags}

%install
mkdir -p %{buildroot}/var/lib/lldpad
%makeinstall
install -d %{buildroot}/lib/mkinitrd/scripts/
install -m 755 %{S:20} %{buildroot}/lib/mkinitrd/scripts/boot-lldpad.sh
install -m 755 %{S:21} %{buildroot}/lib/mkinitrd/scripts/boot-killlldpad.sh
install -m 755 %{S:22} %{buildroot}/lib/mkinitrd/scripts/setup-lldpad.sh
# remove la archives
rm -rf %{buildroot}/%{_libdir}/*.la
# systemd file install
mkdir -p %{buildroot}%{_unitdir}
install -m644 %{name}.service %{buildroot}%{_unitdir}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rclldpad
rm -rf %{buildroot}%{_sysconfdir}/init.d

%post
[ -x /sbin/mkinitrd_setup ] && mkinitrd_setup
%{fillup_and_insserv -n -i lldpad}
%service_add_post lldpad.service

%preun
%service_del_preun lldpad.service

%postun
[ -x /sbin/mkinitrd_setup ] && mkinitrd_setup
%{insserv_cleanup lldpad}

%post -n %libname -p /sbin/ldconfig

%postun -n %libname -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc COPYING README ChangeLog
%dir /var/lib/lldpad
%{_unitdir}/%{name}.service
%{_sbindir}/*
%{_mandir}/man8/*
/lib/mkinitrd

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

%files devel
%defattr(-,root,root,-)
%{_includedir}/*
%{_libdir}/pkgconfig/*.pc
%{_libdir}/*.so

%changelog
openSUSE Build Service is sponsored by