%define perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib)

%define fontdir %{_datadir}/fonts/perl

Name:           perl-GDTextUtil
Version:        0.86
Release:        7%{?_dist_release}

Summary:        Text utilities for use with GD

Group:          Development/Libraries
License:        GPL or Artistic
URL:            http://search.cpan.org/dist/GDTextUtil/
Source0:        http://www.cpan.org/authors/id/M/MV/MVERB/GDTextUtil-%{version}.tar.gz

BuildRoot:      %{_tmppath}/%{name}-%{version}-root
BuildArch:      noarch
BuildRequires:  perl >= 5.6.1, perl-GD
Requires:       perl >= 5.6.1, perl-GD
Requires(post): fontconfig

%description
This package provides three modules that make it possible to work with
internal GD fonts as well as TrueType fonts, without having to worry
about different interface functions to call. Apart from an abstract
interface to all font types and strings for GD, this library also
provides some utility in aligning and wrapping your string.

%prep
%setup -q -n GDTextUtil-%{version}

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

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

# Install the TrueType font
install -d $RPM_BUILD_ROOT%{fontdir}
install -p -m 644 Dustismo_Sans.ttf $RPM_BUILD_ROOT%{fontdir}/
touch $RPM_BUILD_ROOT%{fontdir}/fonts.cache-1

%check || :
make test

%clean
rm -rf $RPM_BUILD_ROOT

%post
fc-cache -f %{fontdir} || :


%files
%defattr(-,root,root,-)
%doc Changes README Dustismo.LICENSE demo/
%{perl_vendorlib}/GD/*
%{_mandir}/man3/*.3*
%dir %{fontdir}
%{fontdir}/*.ttf
%ghost %{fontdir}/fonts.cache-1

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

* Wed Jun 24 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.86-6
- applied new versioning policy
- rebuilt with perl-5.10.0

* Sun Sep  3 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.86-5vl2
- changed Group to Development/Libraries

* Sat Sep 17 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.86-5vl1
- rebuild for Vine

* Fri Apr  7 2005 Michael Schwendt <mschwendt[AT]users.sf.net>
- rebuilt

* Sun Jul 11 2004 Jose Pedro Oliveira <jpo@di.uminho.pt> - 0:0.86-0.fdr.4
- Unowned directory: %%{perl_vendorlib}/GD (see bug 1800 comment #1).

* Tue Jul  6 2004 Jose Pedro Oliveira <jpo at di.uminho.pt> - 0:0.86-0.fdr.3
- Install the Dustismo_Sans TrueType font (bug 1757).

* Wed Jun 16 2004 Jose Pedro Oliveira <jpo at di.uminho.pt> - 0:0.86-0.fdr.2
- Bring up to date with current fedora.us perl spec template.

* Sun Oct 12 2003 Ville Skyttä <ville.skytta at iki.fi> - 0:0.86-0.fdr.1
- First build.
