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 http://bugs.opensuse.org/
#


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
Source:         http://search.cpan.org/CPAN/authors/id/S/SA/SAPER/Net-Pcap-%{version}.tar.gz
# 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
Url:            http://search.cpan.org/dist/Net-Pcap
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%{perl_requires}
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
%else
BuildRequires:  libpcap
%endif
Requires:       perl(Carp)
Requires:       perl(Socket)
Requires:       perl(Sys::Hostname)
Requires:       perl(XSLoader)

%description
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.

%prep
%setup -q -n "Net-Pcap-%{version}"
%patch1 -p1

%__sed -i '/^auto_install/d' Makefile.PL

%build
%__perl Makefile.PL PREFIX="%{_prefix}"
%__make %{?_smp_mflags} \
    CCFLAGS="-Wall -Wextra -I/usr/include/pcap" \
    CC="%__cc"

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

# make test is just borked when not running as root

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

%files
%defattr(-,root,root)
%doc Changes README
%dir %{perl_vendorarch}/Net
%{perl_vendorarch}/Net/Pcap.pm
%dir %{perl_vendorarch}/auto/Net
%{perl_vendorarch}/auto/Net/Pcap
%doc %{perl_man3dir}/Net::Pcap.%{perl_man3ext}%{ext_man}

%files -n pcapdump
%defattr(-,root,root)
%{_bindir}/pcapdump

%files -n pcapinfo
%defattr(-,root,root)
%{_bindir}/pcapinfo
%doc %{_mandir}/man1/pcapinfo.1%{ext_man}

%changelog