%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: DBD-CSV module for perl
Name: perl-DBD-CSV
Version: 0.46
Release: 1%{?_dist_release}
License: GPL or Artistic
Group: Development/Libraries
URL: http://search.cpan.org/~jzucker/DBD-CSV/
Source0: http://www.cpan.org/authors/id/J/JZ/JZUCKER/DBD-CSV-%{version}.tgz

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildArch: noarch
#BuildRequires:  perl(DBD::File) >= 0.40
BuildRequires:  perl(DBI) >= 1.628
BuildRequires:  perl(ExtUtils::MakeMaker)
BuildRequires:  perl(SQL::Statement) >= 1.33
BuildRequires:  perl(Text::CSV_XS) >= 1.01
BuildRequires:  perl(Test::Harness)
# BuildRequires >= 0.90, but 0.98 is recommended
BuildRequires:  perl(Test::More) >= 0.98
Requires:       perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Requires:       perl(DBD::File) >= 0.40
Requires:       perl(DBI) >= 1.628
Requires:       perl(SQL::Statement) >= 1.31
# Requires >= 0.71, but 0.83 is recommended
Requires:       perl(Text::CSV_XS) >= 0.71


%description
DBD-CSV module for perl

%prep
%setup -q -n DBD-CSV-%{version} 
chmod -c a-x ChangeLog README lib/DBD/*.pm lib/Bundle/DBD/*.pm

%build
%{__perl} Makefile.PL INSTALLDIRS=vendor <<EOF
y
EOF

make %{?_smp_mflags}

%check
make test

%clean
rm -rf %{buildroot}

%install
rm -rf %{buildroot}
make pure_install DESTDIR=%{buildroot}
find %{buildroot} -type f -name .packlist -exec rm -f {} ';'
find %{buildroot} -type d -depth -exec rmdir {} 2>/dev/null ';'
chmod -R u+w %{buildroot}/*

%files
%defattr(-,root,root)
%doc README ChangeLog
%dir %{perl_vendorlib}/Bundle/DBD
%dir %{perl_vendorlib}/DBD
%dir %{perl_vendorlib}/DBD/CSV
%exclude %dir %{perl_vendorlib}/DBI/Test/Case/DBD/CSV
%exclude %dir %{perl_vendorlib}/DBI/Test/DBD/CSV
%{perl_vendorlib}/Bundle/DBD/*.pm
%{perl_vendorlib}/DBD/*.pm
%{perl_vendorlib}/DBD/CSV/*.pm
%exclude %{perl_vendorlib}/DBI/Test/Case/DBD/CSV/*.pm
%exclude %{perl_vendorlib}/DBI/Test/DBD/CSV/*.pm
%{_mandir}/*/*

%changelog
* Fri Dec  5 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> - 0.46-1
- updated to 0.46
- built with perl 5.16.3

* Fri Mar 02 2012 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 0.33-1
- updated to 0.33; spec revamped

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

* Mon May 25 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.22-1
- applied new versioning policy

* Sun Sep 10 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.22-0vl2
- changed Group to Development/Libraries
- s/Copyright/License/

* Thu Sep  8 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.22-0vl1
- updated to 0.22
- added BuildRequires: perl-DBI
- rebuild with perl 5.8.6
- use vendor_perl dir

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