%define perl_vendorarch    %(eval "`perl -V:installvendorarch`"; echo $installvendorarch)

Summary: A perl5 interface to Thomas Boutell's gd library
Summary(ja): GD ライブラリの Perl 用インターフェイス
Name: perl-GD
Version: 2.35
Release: 2%{?_dist_release}
License: distributable
Group: Development/Libraries
Source0: http://search.cpan.org/CPAN/authors/id/L/LD/LDS/GD-%{version}.tar.gz
Url: http://search.cpan.org/dist/GD/
BuildRoot: %{_tmppath}/perl-GD-buildroot/
BuildRequires: perl >= 5.6.0, gd-devel >= 2.0.20, libjpeg-devel
BuildRequires: freetype2-devel, libpng-devel, zlib-devel
BuildRequires: libX11-devel
BuildRequires: libXpm-devel
Requires: perl >= 5.6.0, gd >= 2.0.12, libjpeg, freetype2
Requires: libpng, zlib

%description
This is a autoloadable interface module for libgd, a popular library
for creating and manipulating PNG files.  With this library you can
create PNG images on the fly or modify existing files.  Features
include:

a.  lines, polygons, rectangles and arcs, both filled and unfilled
b.  flood fills
c.  the use of arbitrary images as brushes and as tiled fill patterns
d.  line styling (dashed lines and the like)
e.  horizontal and vertical text rendering
f.  support for transparency and interlacing

For full information on usage, see the accompanying man and html
documentation.

# Provide perl-specific find-{provides,requires}.
%define __find_provides /usr/lib/rpm/find-provides.perl
%define __find_requires /usr/lib/rpm/find-requires.perl

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

%build
CFLAGS="$RPM_OPT_FLAGS" \
perl Makefile.PL --lib_gd_path=%{_libdir} INSTALLDIRS="vendor" << _OPT_
y
_OPT_
make
make test

%clean 
rm -rf %{buildroot}

%install
rm -rf %{buildroot}
make DESTDIR=%{buildroot} install

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

find %{buildroot}%{_prefix} -type f -print | 
	sed "s@^%{buildroot}@@g" | 
	grep -v perllocal.pod | 
	grep -v "\.packlist" > %{name}-filelist
if [ "$(cat %{name}-filelist)X" = "X" ] ; then
    echo "ERROR: EMPTY FILE LIST"
    exit -1
fi

find demos -type f | xargs perl -pi -e "s|^#!(\s)?/usr/local/bin/perl|#!/usr/bin/perl|g"
find bdf_scripts -type f | xargs perl -pi -e "s|^#!(\s)?/usr/local/bin/perl|#!/usr/bin/perl|g"

%files -f %{name}-filelist
%defattr(-,root,root)
%doc ChangeLog README* demos bdf_scripts
%dir %{perl_vendorarch}/GD
%dir %{perl_vendorarch}/auto/GD

%changelog
* Sat Apr 30 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.35-2
- rebuild with perl-5.12.3
- add BuildRequires: libX11-devel, libXpm-devel

* Sat Sep 20 2008 Shu KONNO <owa@bg.wakwak.com> 2.35-1vl5
- applied new versioning policy, spec in utf-8
- built with perl-5.10.0

* Sun Sep  3 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.35-0vl1
- new upstream release
- changed Group to Development/Libraries

* Sat Sep 17 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.28-0vl1
- new upstream release
- added Japanese summary

* Sun Jan  2 2005 IWAI, Masaharu <iwai@alib.jp> 2.19-0vl1
- new upstream release
- update {Build,}Requires

* Tue Nov 11 2003 IWAI, Masaharu <iwai@alib.jp> 2.11-0vl1
- initial build
