%define perl_vendorlib    %(eval "`perl -V:installvendorlib`"; echo $installvendorlib)
%define perl_vendorarch    %(eval "`perl -V:installvendorarch`"; echo $installvendorarch)

# Provide perl-specific find-{provides,requires}.
%define __find_provides /usr/lib/rpm/find-provides.perl
%define __find_requires /usr/lib/rpm/find-requires.perl

Summary: Text-CSV_XS module for perl
Name: perl-Text-CSV_XS
Version: 0.65
Release: 2%{?_dist_release}
License: Artistic/GPL
Group: Development/Libraries
Source0: http://www.cpan.org/authors/id/JWIED/Text-CSV_XS-%{version}.tgz
URL: http://search.cpan.org/~jwied/Text-CSV_XS/
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: perl >= 5.8.6
Requires: perl >= 5.8.6

%description
Text-CSV_XS module for perl

%prep
%setup -q -n Text-CSV_XS-%{version} 

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

%check
make test

%clean 
rm -rf $RPM_BUILD_ROOT

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

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

# remove unnecessary files.
%{__rm} -rf  ${RPM_BUILD_ROOT}/%{perl_archlib}/perllocal.pod
%{__rm} -rf  ${RPM_BUILD_ROOT}/%{perl_vendorarch}/auto/Text/CSV_XS/.packlist

%files -f %{name}.files
%defattr(-,root,root)
%doc README ChangeLog
%{_mandir}/*/*
%dir %{perl_vendorarch}/auto/Text/CSV_XS


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

* Mon May 25 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.65-1
- new upstream release

* Sat Sep 20 2008 Shu KONNO <owa@bg.wakwak.com> 0.34-1vl5
- applied new versioning policy
- built with perl-5.10.0

* Sat Jan  5 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.34-0vl1
- rebuild for VineSeed.
  * Sat Jan  5 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.34-0vl0
  - new upstream release.

* Sat Jan  5 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.34-0vl0
- new upstream release.

* Sun Sep 10 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.23-0vl3
- changed Group to Development/Libraries

* Thu Sep  8 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.23-0vl2
- rebuild with perl 5.8.6
- use vendor_perl
- updated URL
- s/Copyright/License/

* Sat Apr 13 2002 IWAI Masaharu <iwaim@cc.mbn.or.jp> 0.23-0vl1
- first build for Vine Linux
