%define rel 1

Summary: A Perl interface to the World-Wide Web
Name: perl-libwww-perl
Version: 5.833
Release: %{rel}%{?_dist_release}
License: GPL or Artistic
Group: Development/Libraries
Source0: ftp://ftp.cpan.org/pub/CPAN/modules/by-module/LWP/libwww-perl-%{version}.tar.gz
Source10: filter-depends.sh
URL: http://search.cpan.org/dist/libwww-perl/
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildArch: noarch
BuildRequires: perl >= 5.8.0, perl-URI, perl-HTML-Parser perl-Compress-Zlib
Requires: perl >= 5.8.0, perl-URI, perl-HTML-Parser perl-Compress-Zlib

%define __find_requires %{SOURCE10}
#define __perl_requires %{SOURCE10}

%description
The libwww-perl collection is a set of Perl modules which provides a
simple and consistent application programming interface to the
World-Wide Web.  The main focus of the library is to provide classes
and functions that allow you to write WWW clients. The library also
contain modules that are of more general use and even classes that
help you implement simple HTTP servers.

%prep
%setup -q -n libwww-perl-%{version}

%build
CFLAGS="$RPM_OPT_FLAGS" perl Makefile.PL INSTALLDIRS=vendor << EOO
y
y
y
y
y
n
n
n
EOO
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

%clean 
rm -rf $RPM_BUILD_ROOT

%check 
make test

%files -f %{name}.files
%defattr(-,root,root)
%doc README Changes
%dir %{perl_vendorlib}/Bundle
%dir %{perl_vendorlib}/File
%dir %{perl_vendorlib}/HTML
%dir %{perl_vendorlib}/HTTP
%dir %{perl_vendorlib}/HTTP/Cookies
%dir %{perl_vendorlib}/HTTP/Headers
%dir %{perl_vendorlib}/HTTP/Request
%dir %{perl_vendorlib}/LWP
%dir %{perl_vendorlib}/LWP/Authen
%dir %{perl_vendorlib}/LWP/Protocol
%dir %{perl_vendorlib}/Net
%dir %{perl_vendorlib}/Net/HTTP
%dir %{perl_vendorlib}/WWW
%dir %{perl_vendorlib}/WWW/RobotRules
%{_mandir}/man?/*

%changelog
* Thu Nov 05 2009 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 5.833-1
- new upstream release
- delete perllocal.pod and .packlist at %%install section

* Fri Apr 25 2008 IWAI, Masaharu <iwaim@cc.mbn.or.jp> 5.812-2
- new upstream release

* Sun Jul 22 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 5.806-0vl1
- new upstream release
- s/Copyright/License/
- changed Group to Development/Libraries
- installed modules to vendor_perl directory
- added SOURCE10 (removed dependancy for Win32)

* Sat Dec  4 2004 IWAI, Masaharu <iwai@alib.jp> 5.802-0vl1
- new upstream release
- add perl-Compress-Zlib in {Build,}Requires

* Thu Apr 24 2003 IWAI Masaharu <iwai@alib.jp> 5.69-0vl2
- add many direcotries in %%files

* Wed Apr 16 2003 Satoshi MACHINO <machino@vinelinux.org> 5.69-0vl1
- New upstream version
	-- libwww-perl-5.69
- build on perl-5.8.0
- removed perl-MIME-Base64 and perl-libnet from BuildRequires and Requires
	-- perl-5.8.0 included them

* Sun Mar 02 2003 Satoshi MACHINO <machino@vinelinux.org> 5.65-0vl1
- New upstream version

* Sat Feb  9 2002 IWAI Masaharu <iwaim@cc.mbn.or.jp> 5.63-0vl1
- first build for Vine Linux