%define version 1.632
%define release 1

Summary: A database access API for perl
Summary(ja): perl 用データベース接続 API
Name: perl-DBI
Version: %{version}
Release: %{release}%{?_dist_release}
License: GPL or Artistic
Group: Development/Libraries
URL:            http://dbi.perl.org/
Source0:        http://www.cpan.org/authors/id/T/TI/TIMB/DBI-%{version}.tar.gz

BuildRoot:      %{_tmppath}/%{name}-%{version}-root
BuildRequires:  perl(ExtUtils::MakeMaker)
# Run-time
BuildRequires:  perl(base)
BuildRequires:  perl(constant)
BuildRequires:  perl(Carp)
# Clone is optional
BuildRequires:  perl(Clone)
BuildRequires:  perl(Coro)
BuildRequires:  perl(Coro::Handle)
BuildRequires:  perl(Coro::Select)
BuildRequires:  perl(Cwd)
BuildRequires:  perl(Data::Dumper)
# DB_File is optional
BuildRequires:  perl(DB_File)
BuildRequires:  perl(DynaLoader)
BuildRequires:  perl(Errno)
BuildRequires:  perl(Exporter)
BuildRequires:  perl(Fcntl)
BuildRequires:  perl(File::Basename)
BuildRequires:  perl(File::Spec)
BuildRequires:  perl(Getopt::Long)
BuildRequires:  perl(IO::File)
BuildRequires:  perl(IO::Select)
BuildRequires:  perl(IPC::Open3)
BuildRequires:  perl(Math::BigInt)
# MLDBM is optional
##BuildRequires:  perl(MLDBM)
# RPC::PlClient is optional
##BuildRequires:  perl(RPC::PlClient) >= 0.2000
# RPC::PlServer is optional
##BuildRequires:  perl(RPC::PlServer)
BuildRequires:  perl(Scalar::Util)
# SQL::Statement is optional
BuildRequires:  perl(SQL::Statement) > 1.33
BuildRequires:  perl(Storable)
BuildRequires:  perl(Symbol)
BuildRequires:  perl(threads)
BuildRequires:  perl(Tie::Hash)
BuildRequires:  perl(UNIVERSAL)
# Tests
BuildRequires:  perl(Encode)
BuildRequires:  perl(File::Path)
BuildRequires:  perl(lib)
BuildRequires:  perl(Net::Daemon::Test)
BuildRequires:  perl(Test::More)
BuildRequires:  perl(Test::Simple) >= 0.90
# Optional tests
BuildRequires:  perl(Test::Pod) >= 1.00
BuildRequires:  perl(Test::Pod::Coverage) >= 1.04
Requires:       perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Requires:       perl(Math::BigInt)


%description 
DBI is a database access Application Programming Interface (API) for
the Perl Language. The DBI API Specification defines a set of
functions, variables and conventions that provide a consistent
database interface independent of the actual database being used.

%description -l ja
DBI は Perl でデータベースにアクセスするための API です．
DBI API では，実際に使われるデータベースに依存しない様に，
関数，変数などの取り決めが定義されています．


%prep
%setup -q -n DBI-%{version} 
iconv -f iso8859-1 -t utf-8 lib/DBD/Gofer.pm >lib/DBD/Gofer.pm.new &&
  mv lib/DBD/Gofer.pm{.new,}
chmod 644 ex/*
chmod 744 dbixs_rev.pl
sed -i 's?#!perl?#!%{__perl}?' ex/corogofer.pl


%build
perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}"
make %{?_smp_mflags}

%install
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
make pure_install PERL_INSTALL_ROOT=%{buildroot}
find %{buildroot} -type f -name .packlist -exec rm -f {} ';'
find %{buildroot} -type f -name '*.bs' -empty -exec rm -f {} ';'
find %{buildroot} -type d -depth -exec rmdir {} 2>/dev/null ';'
chmod -R u+w %{buildroot}/*
# Remove Win32 specific files and man pages to avoid unwanted dependencies
rm -rf %{buildroot}%{perl_vendorarch}/{Win32,DBI/W32ODBC.pm} \
    %{buildroot}%{_mandir}/man3/{DBI::W32,Win32::DBI}ODBC.3pm
perl -pi -e 's"#!perl -w"#!/usr/bin/perl -w"' \
    %{buildroot}%{perl_vendorarch}/{goferperf,dbixs_rev}.pl

%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

%check
make test

%files 
%defattr(-,root,root)
%doc Changes README.md  ex/
%{perl_vendorarch}/*.p*
%{perl_vendorarch}/Bundle/
%{perl_vendorarch}/DBD/
%{perl_vendorarch}/DBI/
%{perl_vendorarch}/auto/DBI/
%{_bindir}/*
%{_mandir}/*/*

%changelog
* Fri Dec  5 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 1.632-1
- updated to 1.632

* Fri Jun 27 2014 IWAI, Masaharu <iwaim.sub@gmail.com> 1.618-2
- build with Perl 5.16

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

* Sat Mar 26 2011 IWAI, Masaharu <iwai@alib.jp> 1.604-4vl6
- rebuild with perl 5.12.3
- using __perl_requires macro for VineSeed (vl6)

* Wed Apr 08 2009 Shu KONNO <owa@bg.wakwak.com> 1.604-3
- spec in utf-8

* Thu May  1 2008 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 1.604-2
- rebuilt with perl-5.10.0.

* Wed Apr 23 2008 IWAI, Masaharu <iwaim@cc.mbn.or.jp> 1.604-1
- new upstream release

* Mon Aug 20 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.58-0vl1
- new upstream release

* Sun Jan 28 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.53-0vl1
- new upstream release

* Sun Sep 10 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.51-0vl1
- new upstream release
- changed Group to Development/Libraries
- installed module files to vendor_perl

* Sat Jul 22 2006 NAKAMURA Kenta <kenta@vinelinux.org> 1.46-0vl2
- use filter-requires-dbi.sh instead of find-requires.perl

* Sat Dec 04 2004 IWAI, Masaharu <iwai@alib.jp> 1.46-0vl1
- new upstream version
- build on perl-5.8.6-0vl1

* Sat May 22 2004 Satoshi MACHINO <machino@vinelinux.org> 1.40-0vl1
- new upstream version

* Sat May 24 2003 IWAI Masaharu <iwai@alib.jp> 1.37-0vl1
- update 1.37
- build with perl-5.8.0
- add make test	

* Sat Feb 23 2002 Satoshi MACHINO <machino@vinelinux.org> 1.21-0vl1
- updated 1.21

* Wed Dec 05 2001 Satoshi MACHINO <machino@vinelinux.org> 1.20-0vl1
- updated 1.20

* Sat Sep 15 2001 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.19-0vl2
- the spec was in Shift-JIS. Fixed.

* Fri Aug 03 2001 Satoshi MACHINO <machino@vinelinux.org> 1.19-0vl1
- updated 1.19

* Sat Jun 15 2001 Satoshi MACHINO <machino@vinelinux.org> 1.15-1vl2
- rebuild on perl-5.6.0
- changed mandir to /usr/share/man
- removed version in Requires perl

* Sun May 27 2001 Satoshi MACHINO <machino@vinelinux.org> 1.15-1vl1
- updated perl-DBL-1.15

* Tue May 08 2001 Satoshi MACHINO <machino@vinelinux.org> 1.14-10vl1
- fixed Vine Linux

* Tue Feb 27 2001 Trond Eivind Glomsr <teg@redhat.com>
- Cleanups

* Thu Nov 30 2000 Trond Eivind Glomsr <teg@redhat.com>
- build for main distribution
- use %%{_tmppath}
- change name of specfile
- don't use a find script to generate file lists
- general cleanup
- add descriptive summary and description


* Mon Aug 14 2000 Tim Powers <timp@redhat.com>
- Spec file was autogenerated. 
