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

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

Name:           perl-Net-Pcap
Version:        0.17
Release:        0
Summary:        Interface to pcap LBL packet capture library
License:        Artistic-1.0 or GPL-1.0+
Group:          Development/Libraries/Perl
# pbleser: fix libpcap detection on >= 12.1 (i586) as for some reason, using -Wwrite-strings causes
#          it to fail -- bnc#711611
Patch1:         perl-Net-Pcap-fix_libpcap_detection.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
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)
%if 0%{?suse_version} == 0 || 0%{?suse_version} >= 1030
BuildRequires:  libpcap-devel
BuildRequires:  libpcap
Requires:       perl(Carp)
Requires:       perl(Socket)
Requires:       perl(Sys::Hostname)
Requires:       perl(XSLoader)

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}"
%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

%{?buildroot:%__rm -rf "%{buildroot}"}

%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
%doc %{_mandir}/man1/pcapinfo.1%{ext_man}