Summary: XML-Parser module for perl 
Name: perl-XML-Parser
Version: 2.40
Release: 1%{?_dist_release}
License: distributable
Group: Development/Libraries
Source0:  http://www.cpan.org/authors/id/C/CO/COOPERCL/XML-Parser-%{version}.tar.gz
Url: http://search.cpan.org/search?dist=XML-Parser
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: perl >= 5.8.6, libexpat >= 1.95.0, expat-devel
Requires: perl >= 5.8.6
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))

Vendor: Project Vine
Distribution: Vine Linux

%description
This is a Perl extension interface to James Clark's XML parser, expat.

%prep
%setup -q -n XML-Parser-%{version} 

%build
CFLAGS="$RPM_OPT_FLAGS" perl Makefile.PL INSTALLDIRS=vendor
make
find samples -type f | xargs perl -pi -e "s|^#!(\s)?/usr/local/bin/perl|#!%{__perl}|g"

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT{%{_prefix},%{_mandir}/man3}
make DESTDIR=$RPM_BUILD_ROOT install

find $RPM_BUILD_ROOT -type f -a \( -name perllocal.pod -o -name .packlist \
  -o \( -name '*.bs' -a -empty \) \) -exec rm -f {} ';'

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
install -m 644 blib/man3/* %{buildroot}%{_mandir}/man3

# %check
# make test

%clean 
rm -rf $RPM_BUILD_ROOT

%files -f %{name}.files
%defattr(-,root,root)
%doc README Changes samples
%dir %{perl_vendorarch}/auto/XML
%dir %{perl_vendorarch}/auto/XML/Parser
%dir %{perl_vendorarch}/auto/XML/Parser/Expat
%dir %{perl_vendorarch}/XML
%dir %{perl_vendorarch}/XML/Parser
%dir %{perl_vendorarch}/XML/Parser/Encodings
%dir %{perl_vendorarch}/XML/Parser/Style
%{_mandir}/*/*

%changelog
* Wed Mar 30 2011 IWAI, Masaharu <iwai@alib.jp> 2.40-1
- new upstream release
- add Requires: perl(:MODULE_COMPAT_...)
- fix date for 2.36-2 in changelog
- add directory in files
- add Vendor and Distribution tags

* Sun Mar 27 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.36-2
- rebuild with perl-5.12.3
- drop %%check

* Fri May 16 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.36-1vl5
- new upstream release

* Mon Apr 28 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.34-1vl5
- rebuild with perl-5.10.0
- installed modules into vendor_perl directory

* Thu Feb 21 2008 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 2.34-0vl5
- rebuild with expat-2.0.1

* Fri Aug 18 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 2.34-0vl4
- s/Copyright/License/
- add BuildRequires: expat-devel

* Mon Nov 29 2004 IWAI, Masaharu <iwai@alib.jp> 2.34-0vl3
- build on perl-5.8.6-0vl1

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

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

* Thu Apr 17 2003 IWAI Masaharu <iwai@alib.jp> 2.31-0vl2
- rebuild with perl-5.8.0

* Mon Apr 15 2002 IWAI Masaharu <iwaim@cc.mbn.or.jp> 2.31-0vl1
- first release for Vine Linux