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

Summary: a set of perl modules related to mail applications
Summary(ja): メールアプリケーション関連の Perl モジュールセット
Name: perl-MailTools
Version: 2.04
Release: 2%{_dist_release}
License: Artistic
Group: Development/Libraries
Source0: http://search.cpan.org/CPAN/authors/id/M/MA/MARKOV/MailTools-%{version}.tar.gz
Url: http://search.cpan.org/author/MARKOV/MailTools/
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: perl >= 5.8.0
BuildRequires: perl-TimeDate
Requires: perl >= 5.8.0
Requires: perl-TimeDate
BuildArch: noarch

%description
This is MailTools, a set of perl modules related to mail applications.

%description -l ja
MailTools は、メールアプリケーション関連の Perl モジュールセットです。

%prep
%setup -q -n MailTools-%{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

%files -f %{name}.files
%defattr(-,root,root)
%doc ChangeLog README README.demos examples
%{_mandir}/man3/*
%dir %{perl_vendorlib}/Mail
%dir %{perl_vendorlib}/Mail/Field
%dir %{perl_vendorlib}/Mail/Mailer

%changelog
* Wed Apr 08 2009 Shu KONNO <owa@bg.wakwak.com> 2.04-2
- spec in utf-8

* Sat Feb 14 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.04-1
- new upstream release.

* Thu May  1 2008 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 2.03-1
- new upstream release.
- built with perl-5.10.0.

* Sat Jul 21 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.77-0vl1
- new upstream release
- changed Group to Development/Libraries

* Thu Sep 15 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.67-0vl1
- new upstream release
- s/Copyright/License/
- use vendor_perl dir

* Sat Dec  4 2004 IWAI, Masaharu <iwai@alib.jp> 1.65-0vl1
- new upstream release
- build on perl-5.8.6-0vl1
- update {Build,}Requires
- add Japanese Summary and description

* Thu Apr 24 2003 IWAI Masaharu <iwai@alib.jp> 1.58-0vl1
- version up to 1.58
- build with perl-5.8.0

* Sun Aug 25 2002 IWAI Masaharu <iwai@alib.jp> 1.48-0vl1
- first build for Vine Linux
