%define real_name IP-Country

Summary: Classes for fast lookup of country codes from IP addresses for Perl
Name: perl-IP-Country
Version: 2.28
Release: 1%{_dist_release}
License: distributable
Group: Development/Libraries
URL: http://search.cpan.org/dist/IP-Country/

Source: http://search.cpan.org/CPAN/authors/id/N/NW/NWETTERS/%{real_name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-root

BuildArch: noarch
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: perl(Geography::Countries)
Requires:       perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))

Vendor:         Project Vine
Distribution:   Vine Linux


%description
Finding the home country of a client using only the IP address can be difficult.
Looking up the domain name associated with that address can provide some help,
but many IP address are not reverse mapped to any useful domain, and the
most common domain (.com) offers no help when looking for country.

This module comes bundled with a database of countries where various IP addresses
have been assigned. Although the country of assignment will probably be the
country associated with a large ISP rather than the client herself, this is
probably good enough for most log analysis applications, and under test has proved
to be as accurate as reverse-DNS and WHOIS lookup.

%prep
%setup -n %{real_name}-%{version}

%build
CFLAGS="%{optflags}" %{__perl} Makefile.PL INSTALLDIRS=vendor 
make

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT

find $RPM_BUILD_ROOT \( -name perllocal.pod -o -name .packlist \) -exec rm -v {} \;

find $RPM_BUILD_ROOT%{_prefix} -type f -print | 
	sed "s@^$RPM_BUILD_ROOT@@g" | 
	grep -v ^%{_bindir} | 
	grep -v ^%{_mandir} | 
	grep -v "\.packlist" > %{name}.files
if [ "$(cat %{name}.files)X" = "X" ] ; then
    echo "ERROR: EMPTY FILE LIST"
    exit -1
fi


%check
make test

%clean
rm -rf $RPM_BUILD_ROOT

%files -f %{name}.files
%defattr(-, root, root, 0755)
%doc CHANGES MANIFEST README
%{_bindir}/ip2cc
%{_mandir}/man1/ip2cc.1*
%{_mandir}/man3/*.3*
%dir %{perl_vendorlib}/IP

%changelog
* Wed Dec 24 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> - 2.28-1
- updated to 2.28
- built with perl 5.16.3

* Sat Apr 30 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.26-2
- rebuild with perl-5.12.3

* Mon Jun 29 2009 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> - 2.26-1
- new upstream release
- remove BR: perl(Geography::Countries)

* Mon May 06 2008 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> - 2.24-1
- new upstream release

* Mon May 05 2008 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> - 2.23-1
- rebuild with perl 5.10
- new versioning policy

* Sun Feb 18 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 2.23-0vl1
- new upstream release
- change group to Development/Libraries

* Tue Oct 17 2006 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> - 2.21-1vl3
- change group to Development/Languages

* Mon Oct 16 2006 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> - 2.21-1vl2
- 1st release for VinePlus 4.0
- change install dir (site -> vendor)
- fix change log typo

* Sun Oct 15 2006 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> - 2.21-1vl1
- 1st release for VinePlus 3.2
- change install dir (vendor -> site)
- remove smp flag in make section

* Mon May 29 2006 Dag Wieers <dag@wieers.com> - 2.21-1
- Updated to release 2.21.

* Sat Jun 18 2005 Dries Verachtert <dries@ulyssis.org> - 2.20-1
- Updated to release 2.20.

* Sat Nov 06 2004 Dag Wieers <dag@wieers.com> - 2.18-1
- Updated to release 2.18.

* Fri Jan 02 2004 Dag Wieers <dag@wieers.com> - 2.17-0
- Updated to release 2.17.

* Mon Jul 14 2003 Dag Wieers <dag@wieers.com> - 2.14-0
- Updated to release 2.14.

* Sat Feb 01 2003 Dag Wieers <dag@wieers.com> - 2.08-0
- Initial package. (using DAR)
