File perl-Net-Pcap.spec of Package perl-Net-Pcap

# spec file for package perl-Net-Pcap
# 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

Name:           perl-Net-Pcap
Version:        0.18
Release:        0
Summary:        Interface to pcap LBL packet capture library
License:        Artistic-1.0 OR GPL-1.0-or-later
Group:          Development/Libraries/Perl
Patch1:         perl-Net-Pcap-avoid-pcap_rmtauth-redefinition.patch
BuildRequires:  gcc
BuildRequires:  make
BuildRequires:  perl-macros
BuildRequires:  perl(Carp)
BuildRequires:  perl(ExtUtils::MakeMaker)
BuildRequires:  perl(Socket)
BuildRequires:  perl(Sys::Hostname)
BuildRequires:  perl(Test::More) >= 0.45
BuildRequires:  perl(XSLoader)
Requires:       perl(Carp)
Requires:       perl(Socket)
Requires:       perl(Sys::Hostname)
Requires:       perl(Test::More) >= 0.45
Requires:       perl(XSLoader)
%if 0%{?suse_version} == 0 || 0%{?suse_version} >= 1030
BuildRequires:  libpcap-devel
BuildRequires:  libpcap

Net::Pcap is a Perl binding to the LBL pcap(3) library. The README for libpcap
describes itself as: "a system-independent interface for user-level packet
capture.  libpcap provides a portable framework for low-level network
monitoring.  Applications include network statistics collection, security
monitoring, network debugging, etc."

%package -n pcapdump
Summary:        Dump packets from the network
Group:          Productivity/Networking/Diagnostic
Requires:       %{name} = %{version}

%description -n pcapdump
Command line tool to dump packets from the network.

pcapdump mimics the very basic features of tcpdump(1) and provides a good
example of how to use Net::Pcap.

%package -n pcapinfo
Summary:        Prints detailed information about the network devices
Group:          Productivity/Networking/Diagnostic
Requires:       %{name} = %{version}

%description -n pcapinfo
pcapinfo prints detailed information about the network devices and Pcap library
available on the current host.

%setup -q -n "Net-Pcap-%{version}"

if pkg-config --atleast-version=1.9.0 libpcap; then
%patch1 -p1

sed -i '/^auto_install/d' Makefile.PL

perl Makefile.PL PREFIX="%{_prefix}"
make %{?_smp_mflags} \
    CCFLAGS="-Wall -Wextra -I/usr/include/pcap" \

install -D -m0755 eg/pcapdump "%{buildroot}%{_bindir}/pcapdump"

# make test is just borked when not running as root

%doc Changes README
%dir %{perl_vendorarch}/Net
%dir %{perl_vendorarch}/auto/Net
%doc %{perl_man3dir}/Net::Pcap.%{perl_man3ext}%{ext_man}

%files -n pcapdump

%files -n pcapinfo

openSUSE Build Service is sponsored by