File hsflowd.spec of Package hsflowd

#
# spec file for package hsflowd
#
# Copyright (c) 2019 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 https://bugs.opensuse.org/
#


%define realver 2.0.24-1
Name:           hsflowd
Version:        2.0.24.1
Release:        0
Summary:        Host sFlow daemon
# License: https://inmon.com/technology/sflowlicense.txt
License:        SUSE-Freeware
Group:          System/Monitoring
URL:            https://sflow.net/
Source0:        https://github.com/sflow/host-sflow/archive/v%{realver}.tar.gz
Source99:       hsflowd-rpmlintrc
Patch0:         hsflowd-fix-setgroups.diff
Patch1:         hsflowd-obey-cflags.diff
BuildRequires:  libopenssl-devel
BuildRequires:  libpcap-devel
BuildRequires:  pkgconfig
BuildRequires:  xen-devel
BuildRequires:  pkgconfig(dbus-1)
BuildRequires:  pkgconfig(libvirt)
BuildRequires:  pkgconfig(libxml-2.0)
BuildRequires:  pkgconfig(systemd)
%{?systemd_requires}

%description
This program implements the host sFlow(R) standard - sending
key performance metrics to an sFlow collector to enable
highly-scalable monitoring of all critical resources in
the network. If Open VSwitch is present, will also control
the Open VSwitch sFlow configuration.

%package mod_dbus
Summary:        DBUS support for the Host sFlow daemon
Requires:       %{name} = %{version}

%description mod_dbus
This packages provides dbus support for hsflowd

%package mod_dnssd
Summary:        DNS-SD support for the Host sFlow daemon
Requires:       %{name} = %{version}

%description mod_dnssd
This packages provides dnssd support for hsflowd

%package mod_docker
Summary:        Docker support for the Host sFlow daemon
Requires:       %{name} = %{version}
Requires:       docker
Requires:       iproute2

%description mod_docker
This packages provides docker support for hsflowd

%package mod_eapi
Summary:        Eapi support for the Host sFlow daemon
Requires:       %{name} = %{version}

%description mod_eapi
This packages provides eapi support for hsflowd

%package mod_json
Summary:        JSON support for the Host sFlow daemon
Requires:       %{name} = %{version}

%description mod_json
This packages provides json support for hsflowd

%package mod_kvm
Summary:        KVM support for the Host sFlow daemon
Requires:       %{name} = %{version}

%description mod_kvm
This packages provides kvm support for hsflowd

%package mod_ovs
Summary:        OpenvSwitch support for the Host sFlow daemon
Requires:       %{name} = %{version}
Provides:       openvswitch

%description mod_ovs
This packages provides openvswitch support for hsflowd

%package mod_pcap
Summary:        PCAP support for the Host sFlow daemon
Requires:       %{name} = %{version}

%description mod_pcap
This packages provides pcap support for hsflowd

%package mod_systemd
Summary:        Systemd support for the Host sFlow daemon
Requires:       %{name} = %{version}

%description mod_systemd
This packages provides systemd support for hsflowd

%package mod_tcp
Summary:        TCP support for the Host sFlow daemon
Requires:       %{name} = %{version}

%description mod_tcp
This packages provides tcp support for hsflowd

%package mod_xen
Summary:        XEN support for the Host sFlow daemon
Requires:       %{name} = %{version}

%description mod_xen
This packages provides xen support for hsflowd

%prep
%setup -q -n host-sflow-%{realver}
%patch0 -p1
%patch1 -p1

%build
make MODDIR=%{_libdir}/%{name} EXTRA_FLAGS="%{optflags}" FEATURES="HOST PCAP TCP DOCKER KVM XEN OVS DBUS SYSTEMD EAPI" %{?_smp_mflags}

%install
make INSTROOT=%{buildroot} BINDIR=%{_sbindir} INITDIR=%{_initddir} CONFDIR=%{_sysconfdir} MODDIR=%{_libdir}/%{name} SYSTEMDDIR=%{_unitdir} DBUSDIR=%{_sysconfdir}/dbus-1/system.d install

# remove old init script as we now ship systemd service file
rm %{buildroot}%{_initddir}/hsflowd
mkdir -p %{buildroot}%{_sbindir}/
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rchsflowd

%pre
%service_add_pre hsflowd.service

%post
%service_add_post hsflowd.service

%preun
%service_del_preun hsflowd.service

%postun
%service_del_postun hsflowd.service

%files
%doc README INSTALL.Linux
%license LICENSE
%{_sbindir}/hsflowd
%config %{_sysconfdir}/hsflowd.conf
%config %{_sysconfdir}/dbus-1/system.d/net.sflow.hsflowd.conf
%{_unitdir}/hsflowd.service
%{_sbindir}/rchsflowd
%dir %{_libdir}/%{name}

%files mod_xen
%{_libdir}/%{name}/mod_xen.so

%files mod_dbus
%{_libdir}/%{name}/mod_dbus.so

%files mod_dnssd
%{_libdir}/%{name}/mod_dnssd.so

%files mod_docker
%{_libdir}/%{name}/mod_docker.so

%files mod_eapi
%{_libdir}/%{name}/mod_eapi.so

%files mod_json
%{_libdir}/%{name}/mod_json.so

%files mod_kvm
%{_libdir}/%{name}/mod_kvm.so

%files mod_ovs
%{_libdir}/%{name}/mod_ovs.so

%files mod_pcap
%{_libdir}/%{name}/mod_pcap.so

%files mod_systemd
%{_libdir}/%{name}/mod_systemd.so

%files mod_tcp
%{_libdir}/%{name}/mod_tcp.so

%changelog
openSUSE Build Service is sponsored by