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

Summary: a Perl module to use HTML Templates
Name: perl-HTML-Template
Version: 2.9
Release: %{rel}%{?_dist_release}
License: GPL/Artistic
Group: Development/Libraries
Source0: http://www.cpan.org/authors/id/S/SA/SAMTREGAR/HTML-Template-%{version}.tar.gz
Url: http://search.cpan.org/search?dist=HTML-Template
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: perl >= 5.004
Requires: perl >= 5.004
BuildArch: noarch
AutoReq: false

%description
This module attempts make using HTML templates simple and natural.
It extends standard HTML with a few new HTML-esque tags - <TMPL_VAR>,
<TMPL_LOOP>, <TMPL_INCLUDE>, <TMPL_IF> and <TMPL_ELSE>.  The file
written with HTML and these new tags is called a template.  It is
usually saved separate from your script - possibly even created by
someone else!  Using this module you fill in the values for the
variables, loops and branches declared in the template.  This allows
you to seperate design - the HTML - from the data, which you generate
in the Perl script.

%description -l ja
このモジュールは HTML テンプレートを使うことを簡単に、自然にしようとし
ます。これは標準の HTML をいくつかの新しいHTML風のタグ - <TMPL_VAR>, 
<TMPL_LOOP>, <TMPL_INCLUDE>, <TMPL_IF>, <TMPL_ELSE>, <TMPL_UNLESS> で拡
張します。 HTML とこれらの新しいタグで書かれたファイルはテンプレートと
呼ばれます。これは通常スクリプトとは別に保存されます - もしかしたら他の
誰かによって作成されることさえあるかもしれません! このモジュールを使っ
て、変数のための値を埋めたり、テンプレートで宣言されたループや分岐をお
こないます。これにより Perl スクリプトで作成されるデータからデザイン 
- HTML - を分けることが出来ます。

%prep
%setup -q -n HTML-Template-%{version} 

%build
CFLAGS="$RPM_OPT_FLAGS" perl Makefile.PL INSTALLDIRS=vendor
#PREFIX=%{buildroot}%{_prefix}
make

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

[ -x /usr/lib/rpm/brp-compress ] && /usr/lib/rpm/brp-compress

find $RPM_BUILD_ROOT \( -name perllocal.pod -o -name .packlist \) -exec rm -v {} \;

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

%check
make test

%clean 
rm -rf $RPM_BUILD_ROOT


%files -f %{name}.files
%defattr(-,root,root)
%doc ANNOUNCE Changes FAQ README scripts templates
%{_mandir}/*/*
%dir %{perl_vendorlib}/HTML

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

* Mon Apr 28 2008 IWAI, Masaharu <iwaim@cc.mbn.or.jp> 4.06-1
- rebuild with perl-5.10.0-1

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

* Sun Jul 16 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.7-0vl2
- added Japanese description from VinePlus/3.2 package
- added Autoreq: false
- installed perl modules to vendor_perl

* Mon Jan 10 2005 Satoshi MACHINO <machino@vinelinux.org> 2.7-0vl1
- new upstream release
- built with perl-5.8.6

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

* Mon Apr 29 2002 IWAI Masaharu <iwaim@cc.mbn.or.jp> 2.5-0vl1
- first build for Vine Linux