%define real_name IPTables-libiptc

Summary:        Perl extension for iptables libiptc
Name:           perl-IPTables-libiptc
Version:        0.52
Release:        1%{?_dist_release}
License:        GPLv2+
Group:          Development/Libraries
URL:            http://search.cpan.org/dist/IPTables-libiptc/

Source0:         http://search.cpan.org/CPAN/authors/id/H/HA/HAWK/%{real_name}-%{version}.tar.gz
# RT#70639
Patch0:         %{name}-0.51-Support-iptables-1.4.12.patch
# RT#70639
Patch1:         IPTables-libiptc-0.52-Support-for-1.4.16.2.patch
# RT#70639, bug #992659
Patch2:         IPTables-libiptc-0.52-Support-for-1.4.18.patch
# croak() expects formatting string, bug #1106081
Patch3:         IPTables-libiptc-0.52-Fix-GCC-format-security-warning.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires:  iptables-devel >= 1.4
BuildRequires:  perl
BuildRequires:  perl(AutoLoader)
BuildRequires:  perl(Carp)
BuildRequires:  perl(ExtUtils::MakeMaker)
BuildRequires:  perl(Test::More)
BuildRequires:  perl(File::Basename)

Requires:       perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
Requires:       perl(AutoLoader)
Requires:       perl(Carp)
Requires:       perl(File::Basename)

Vendor:         Project Vine
Distribution:   Vine Linux

%{?perl_default_filter}

%description
This package provides a perl interface to the netfilter/iptables
C-code and library C<libiptc>.

%prep
%setup -q -n %{real_name}-%{version}
%patch0 -p1 -b .1412
%patch1 -p1 -b .1416
%patch2 -p1 -b .1418
%patch3 -p1

%build
perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" PREFIX=%{_prefix}
make %{?_smp_mflags}

%install
rm -rf %{buildroot}
make pure_install DESTDIR=%{buildroot}
find %{buildroot} -type f -name .packlist -exec rm -f {} ';'
find %{buildroot} -depth -type d -exec rmdir {} ';' 2>/dev/null
%{_fixperms} %{buildroot}

%check
make test

%clean
rm -rf %{buildroot}

%files
%defattr(-, root, root, -)
%doc Changes META.yml README
%{perl_vendorarch}/*
%{_mandir}/man?/*

%changelog
* Wed Dec 24 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> - 0.52-1
- updated to 0.52
- added Patch0, 1, 2 and 3 from Fedora
- built with perl 5.16.3

* Sun Mar 11 2012 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 0.51-1
- initial build for Vine Linux
