%define perlver		%(rpm -q --queryformat %%{version} perl)

Summary: URI module for perl
Name: perl-URI
Version: 1.58
Release: 1%{?_dist_release}
License: distributable
Group: Development/Libraries
Source0: http://www.cpan.org/authors/id/GAAS/URI-%{version}.tar.gz
Source1: filter-requires-perl-URI.sh
Url: http://search.cpan.org/search?dist=URI
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildArch: noarch
BuildRequires: perl >= %{perlver}
Requires: perl >= %{perlver}

#BuildRequires:  perl(Business::ISBN)
%if %{?_dist_release} == "vl5" || %{?_dist_release} == "vl4"
%define __find_requires %{SOURCE1}
%else
%define __perl_requires %{SOURCE1}
%endif


%description
URI module for perl

%prep
%setup -q -n URI-%{version} 

%build
CFLAGS="$RPM_OPT_FLAGS" perl Makefile.PL INSTALLDIRS=vendor
make

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_prefix}
make DESTDIR=$RPM_BUILD_ROOT install

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 ^%{_mandir} | 
	grep -v perllocal.pod | 
	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)
%doc README Changes
%dir %{perl_vendorlib}/URI
%dir %{perl_vendorlib}/URI/file
%dir %{perl_vendorlib}/URI/urn
%{_mandir}/man3/*

%changelog
* Sat Mar 26 2011 IWAI, Masaharu <iwai@alib.jp> 1.58-1
- new upstream release
- using __perl_requires macro for VineSeed (vl6)
- drop rfc2396.txt in %%files: upstream deleted

* Thu Nov 05 2009 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 1.40-1
- new upstream release

* Mon Apr 28 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.35-1vl5
- rebuilt with perl-5.10.0
- applied new versioning policy

* Sat Feb 17 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.35-0vl2
- s/Copyright/License/
- changed Group to Development/Libraries
- added Source1 for removing dependancy perl(Business::ISBN)

* Sat Dec  4 2004 IWAI, Masaharu <iwai@alib.jp> 1.35-0vl1
- new upstream release
- build on perl-5.8.6-0vl1
- define perlver macro
- run 'make test'

* Sat Dec 13 2003 Satoshi MACHINO <machino@vinelinux.org> 1.27-0vl2
- built on perl-5.8.2

* Thu Nov 06 2003 Satoshi MACHINO <machino@vinelinux.org> 1.27-0vl1
- new upstream version
- built on perl-5.8.1

* Thu Apr 24 2003 IWAI Masaharu <iwai@alib.jp> 1.23-0vl3
- add %%{perl_sitelib}/URI/urn directory

* Sun Apr 20 2003 Satoshi MACHINO <machino@vinelinux.org> 1.23-0vl2
- build on perl-5.8.0

* Sat Feb 15 2003 IWAI Masaharu <iwai@alib.jp> 1.23-0vl1
- update to 1.23

* Sun Apr 14 2002 IWAI Masaharu <iwaim@cc.mbn.or.jp> 1.18-0vl1
- first build for Vine Linux

