File nfdump.spec of Package nfdump

#
# spec file for package nfdump
#
# Copyright (c) 2024 SUSE LLC
#
# 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 nfcapddatadir	%{_localstatedir}/lib/nfcapd
%define sfcapddatadir	%{_localstatedir}/lib/sfcapd
%define nfhomedir     %{_var}/lib/%{name}

Name:           nfdump
Version:        1.7.7
Release:        0
Summary:        CLI tools collect and process netflow data
License:        BSD-3-Clause
Group:          Productivity/Networking/Diagnostic
URL:            https://github.com/phaag/nfdump
Source:         nfdump-%{version}.tar.gz
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  libtool
BuildRequires:  pkgconfig
BuildRequires:  rrdtool
BuildRequires:  rrdtool-devel
BuildRequires:  pkgconfig(bzip2)
BuildRequires:  pkgconfig(libcurl)
BuildRequires:  pkgconfig(liblz4)
BuildRequires:  pkgconfig(libmaxminddb)
BuildRequires:  pkgconfig(libpcap)
BuildRequires:  pkgconfig(libzstd)
BuildRequires:  pkgconfig(zlib)
Requires:       rrdtool
Requires(pre):  shadow
Provides:       user(%{name})
Provides:       group(%{name})

%description
The nfdump tools collect and process netflow data on the command line.
They are part of the NFSEN project which is explained more detailed at
http://www.terena.nl/tech/task-forces/tf-csirt/meeting12/nfsen-Haag.pdf

%prep
%autosetup -p1
chmod a-x README ChangeLog AUTHORS

%build
export CC=gcc
export CFLAGS="%{optflags} -fno-strict-aliasing -fpic -DPIC"
export LDFLAGS="-Wl,-z,relro,-z,now -pie"
autoreconf -fi
#  --enable-nsel      \
#  --enable-jnat      \
%configure \
  --enable-maxmind   \
  --enable-nfprofile \
  --enable-influxdb  \
  --enable-nftrack   \
  --enable-sflow     \
  --enable-readpcap  \
  --enable-nfpcapd

%make_build

%install
%make_install
install -D -d -m 0750 \
	%{buildroot}%{nfhomedir} \
	%{buildroot}%{nfcapddatadir} \
	%{buildroot}%{sfcapddatadir}
rm \
  %{buildroot}%{_libdir}/libnffile.a \
  %{buildroot}%{_libdir}/libnffile.la \
  %{buildroot}%{_libdir}/libnffile.so \
  %{buildroot}%{_libdir}/libnfdump.a \
  %{buildroot}%{_libdir}/libnfdump.la \
  %{buildroot}%{_libdir}/libnfdump.so

mv -v %{buildroot}%{_sysconfdir}/nfdump.conf{.dist,}
chmod o= %{buildroot}%{_sysconfdir}/nfdump.conf

%pre
%{_sbindir}/groupadd -r %{name} &>/dev/null || :
%{_sbindir}/useradd -g %{name} -s /bin/false -r -c "User for Netflow Dumper" -d %{nfhomedir} %{name} &>/dev/null || :

%ldconfig_scriptlets

%files
%license COPYING
%doc AUTHORS README ChangeLog
%config(noreplace) %attr(-,root,nfdump) %{_sysconfdir}/nfdump.conf
%{_bindir}/nfanon
%{_bindir}/nfcapd
%{_bindir}/nfdump
%{_bindir}/nfexpire
%{_bindir}/nfprofile
%{_bindir}/nfreplay
%{_bindir}/sfcapd
%{_mandir}/man1/nfanon.1%{?ext_man}
%{_mandir}/man1/nfcapd.1%{?ext_man}
%{_mandir}/man1/nfdump.1%{?ext_man}
%{_mandir}/man1/nfexpire.1%{?ext_man}
%{_mandir}/man1/nfprofile.1%{?ext_man}
%{_mandir}/man1/nfreplay.1%{?ext_man}
%{_mandir}/man1/sfcapd.1%{?ext_man}
%{_bindir}/geolookup
%{_bindir}/nfpcapd
%{_bindir}/nftrack
%{_bindir}/updateGeoDB.sh
%{_libdir}/libnffile-%{version}.so
%{_libdir}/libnfdump-%{version}.so
%{_mandir}/man1/geolookup.1%{?ext_man}
%{_mandir}/man1/nfpcapd.1%{?ext_man}

%dir %attr(-,%{name},%{name}) %{nfcapddatadir}
%dir %attr(-,%{name},%{name}) %{sfcapddatadir}
%dir %attr(-,%{name},%{name}) %{nfhomedir}

%changelog
openSUSE Build Service is sponsored by