File libdaq.spec of Package libdaq

#
# spec file for package libdaq
#
# Copyright (c) 2015 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 http://bugs.opensuse.org/
#


%define soname 1
Name:           libdaq
Version:        2.0.6
Release:        0
Summary:        Data Acquisition library, for packet I/O
License:        GPL-2.0
Group:          Productivity/Networking/System
Url:            https://www.snort.org/
Source:         https://snort.org/downloads/snort/daq-%{version}.tar.gz
BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  libdnet-devel
BuildRequires:  libpcap-devel >= 1.0.0
BuildRequires:  pkg-config
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1120
BuildRequires:  libnetfilter_queue-devel
%if 0%{?suse_version} > 1210
BuildRequires:  libipq-devel
%else
BuildRequires:  iptables-devel
%endif
%endif

%description
Data Acquisition library, for packet I/O.  The
DAQ replaces direct calls to PCAP functions with an abstraction layer that
facilitates operation on a variety of hardware and software interfaces without
requiring changes to Snort.  It is possible to select the DAQ type and mode
when invoking Snort to perform PCAP readback or inline operation, etc.  The
DAQ library may be useful for other packet processing applications and the
modular nature allows you to build new modules for other platforms.

%package -n %{name}%{soname}
Summary:        Data Acquisition library, for packet I/O
Group:          System/Libraries

%description -n %{name}%{soname}
Data Acquisition library, for packet I/O.  The
DAQ replaces direct calls to PCAP functions with an abstraction layer that
facilitates operation on a variety of hardware and software interfaces without
requiring changes to Snort.  It is possible to select the DAQ type and mode
when invoking Snort to perform PCAP readback or inline operation, etc.  The
DAQ library may be useful for other packet processing applications and the
modular nature allows you to build new modules for other platforms.

%package devel
Summary:        Data Acquisition library, for packet I/O
Group:          Development/Libraries/C and C++
Requires:       %{name}%{soname} = %{version}
Requires:       daq-modules = %{version}
%if 0%{?suse_version} > 1120
%if 0%{?suse_version} > 1210
Requires:       libipq-devel
%else
Requires:       iptables-devel
%endif
Requires:       libnetfilter_queue-devel
%endif

%description devel
Data Acquisition library, for packet I/O.  The
DAQ replaces direct calls to PCAP functions with an abstraction layer that
facilitates operation on a variety of hardware and software interfaces without
requiring changes to Snort.  It is possible to select the DAQ type and mode
when invoking Snort to perform PCAP readback or inline operation, etc.  The
DAQ library may be useful for other packet processing applications and the
modular nature allows you to build new modules for other platforms.

%package -n daq-modules
Summary:        Bundled DAQ modules
Group:          System/Libraries

%description -n daq-modules
Contains the DAQ modules that come bundled with the base LibDAQ distribution.

%prep
%setup -q -n daq-%{version}

%build
export CPPFLAGS="$CPPFLAGS $(pkg-config --libs --cflags libipq) $(pkg-config --libs --cflags libnetfilter_queue)"
%configure --disable-static
# parallel build is broken:
# https://lists.macosforge.org/pipermail/macports-tickets/2015-May/186801.html
make #%{?_smp_mflags}

%install
make DESTDIR=%{buildroot} install #%{?_smp_mflags}
find %{buildroot} -type f -name "*.la" -delete -print

%post -n %{name}%{soname} -p /sbin/ldconfig

%postun -n %{name}%{soname} -p /sbin/ldconfig

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

%files devel
%defattr(-,root,root)
%{_bindir}/daq-modules-config
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/*.a

%files -n daq-modules
%defattr(-,root,root)
%{_libdir}/daq

%changelog