%define       _noVersionedDependencies  1

Summary:      Perl extention for Gtk+/Gnome
Summary(ja):  Perl から Gtk+ や Gnome を使うためのモジュール集
Name:         Gtk-Perl
Version:      0.7008
Release:      32%{?_dist_release}
License:      GPL
Group:        Development/Libraries
Source:       ftp://ftp.cpan.org/pub/perl/CPAN/modules/by-module/Gtk/Gtk-Perl-%{version}.tar.gz 
Source10: filter-depends.sh

# Patches from Mandrake 27mdk
Patch0: Gtk-Perl-add-ensure_focus.patch.bz2
Patch1: Gtk-Perl-0.7003-workaround-gdk_event_copy-withnowindow.patch.bz2
Patch2: Gtk-Perl-0.7005-add-XSetInputFocus.patch.bz2
# fix compilation with gtkhtml >= 1.1.0
Patch3: Gtk-Perl-0.7008-gtkhtml11.patch.bz2
Patch4: Gtk-Perl-0.7008-fix-mozilla.patch.bz2
Patch7: Gtk-Perl-0.7008-force-GtkHTML-and-no-GtkXmHTML.patch.bz2
Patch8: Gtk-Perl-0.7008-fix-memory-leak-with-Gdk::Pixmap-created-from-a-Gdk::Pixbuf.patch.bz2
# (fc) 0.7008-25mdk fix compilation with gnome-print >= 0.30 and gdkpixbuf >= 0.20
Patch9: Gtk-Perl-0.7008-gnomeprint.patch.bz2

#Patch10:       Gtk-Perl-%{version}-pixbuf.patch
URL:          http://projects.prosa.it/gtkperl/
BuildRoot:    %{_tmppath}/%{name}-%{version}-root

## Build Requires for all modules (except experimental bonobo and mozilla)
BuildPreReq:  perl >= 1:5.6.0
BuildPreReq:  gtk+-devel, libglade-devel, imlib-devel
BuildPreReq:  gdk-pixbuf-devel, gnome-libs-devel
#BuildPreReq:  gtkhtml-devel, gnome-print-devel

## Requires for basic modules
Requires:     perl >= 1:5.6.0
Provides:     gtk+perl = %{version}
Obsoletes:    gtk+perl

# internal perl provides
#Provides: perl(Gnome::Applet::Types)
#Provides: perl(Gtk::GLArea::Types)
Provides: perl(Gtk::Gdk::Pixbuf::Types)
Provides: perl(Gtk::GladeXML::Types)
Provides: perl(Gtk::XmHTML::Types)

Vendor:       Project Vine
Distribution: Vine Linux

%define __find_requires %{SOURCE10}

%description
Gtk-Perl is a set of modules that let you exploit Gtk+ and Gnome
libraries from Perl.

This package contains basic Gtk modules, as well as Imlib, GdkPixbuf,
Gnome, XmHtml and Glade support.


%description -l ja
Gtk-Perl モジュールを使うと,Perl から Gtk+ や Gnome のライブラリを
利用することができます.

このパッケージには基本となる Gtk モジュールの他,Imlib, GdkPixbuf,
Gnome, XmHtml, Glade のサポートが含まれています.


#%package extras
#Summary:     Perl extension for Gtk+/Gnome - additional modules
#Summary(ja): Perl から Gtk+ や Gnome を使う為の追加モジュール集
#Group:        Development/Languages
#
### Requires for additional modules
#Requires:    %{name} = %{version}-%{release}
#Requires:    gtkhtml, gnome-print
#
#
#%description extras
#Gtk-Perl is a set of modules that let you exploit Gtk+ and Gnome
#libraries from Perl.
#
#This extra package currently contains GtkHTML and GnomePrint support.
#
#%description extras -l ja
#Gtk-Perl モジュールを使うと,Perl から Gtk+ や Gnome のライブラリを
#利用することができます.
#
#この追加パッケージには現在 GtkHTML と GnomePrint のサポートが含まれています.


%prep
[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}

%setup -q -n Gtk-Perl-%{version}

%patch0 -p1
%patch1 -p1
%patch2 -p1
#%patch3 -p1 -b .gtkhtml11
%patch4 -p1
#%patch7 -p1
%patch8 -p1
%patch9 -p1 -b .gnomeprint

#%patch10 -p1 -b .pixbuf

# fix for new MakeMaker (ie new perl 5.8.0)
perl -pi -e '/CCCMD/ && s|/m;|/mg;|' */Makefile.PL

# temporal removal of Applet module
rm -rf Applet

%build
#perl Makefile.PL --with-gdkimlib --with-gdkpixbuf --with-gtkxmhtml \
#	 --with-gnome --with-applets --with-glade \
#	 --without-gtkglarea \
#	 --without-gtkhtml --without-gnomeprint
#	 # --with-gtkhtml --with-gnomeprint
#	 # --without-bonobo --without-mozilla
#
#make

CFLAGS="$RPM_OPT_FLAGS" perl Makefile.PL INSTALLDIRS=vendor
make

for i in GdkImlib GdkPixbuf Glade Gnome Gtk GtkXmHTML ; do
    pushd $i
        CFLAGS="$RPM_OPT_FLAGS" perl Makefile.PL INSTALLDIRS=vendor
        make
    popd
done


%install
rm -rf ${RPM_BUILD_ROOT}

#make PREFIX=${RPM_BUILD_ROOT}/usr/ install

# prepare sample scripts
mkdir samples
cp -a test.pl samples/.
for X in GdkImlib GdkPixbuf Glade Gnome Gtk GtkXmHTML; do
(cd $X;
mkdir ../samples/$X;
cp -a samples ../samples/$X/samples);
done

#mkdir samples-extras
#cp -a test.pl samples-extras/.
#for X in GnomePrint GtkHTML; do
#(cd $X;
#mkdir ../samples-extras/$X; \
#cp -a samples ../samples-extras/$X/samples);
#done
make DESTDIR=$RPM_BUILD_ROOT install  

for i in GdkImlib GdkPixbuf Glade Gnome Gtk GtkXmHTML ; do
    pushd $i
        make DESTDIR=$RPM_BUILD_ROOT install
    popd
done


pushd $RPM_BUILD_ROOT
rm -f `find -type f -name "*.bs"`
rm -f `find -type f -name .packlist`
rm -f `find -type f -name .packlist`
rm -f `find -type f -name "*::reference*"`
popd

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

find $RPM_BUILD_ROOT/usr -type f -print | sed "s@^$RPM_BUILD_ROOT@@g" | grep -v perllocal.pod > gtk-perl-files 



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


%files
%defattr(-,root,root)
%doc ChangeLog INSTALL MANIFEST NOTES README VERSIONS WARNING
%doc tools samples

# Gdk/Gtk modules
%{_libdir}/perl5/vendor_perl/*/*/Gtk
%{_libdir}/perl5/vendor_perl/*/*/auto/Gtk
%{_libdir}/perl5/vendor_perl/*/*/auto/Gnome
%{_libdir}/perl5/vendor_perl/*/*/Gtk.pm
%{_libdir}/perl5/vendor_perl/*/*/Gnome.pm
%{_libdir}/perl5/vendor_perl/*/*/Gnome
%{_mandir}/*/*


%changelog
* Sun May  3 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.7008-32
- applied new versioning policy, spec in UTF-8
- rebuilt with gnome-libs-1.4.2-2vl5 (linking with db-4.6.21)

* Sun Aug  5 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.7008-31vl5
- rebuilt with new toolchain

* Sun Sep  3 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.7008-31vl4
- s/Copyright/License/
- installed files to vendor_perl

* Sat Nov  6 2004 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 0.7008-31vl3
- rebuilt with db4-4.2.52
- remove Applet module

* Fri May 02 2003 KOBAYASHI R. Taizo <tkoba@vinelinux.org>
- rebuild with gdk-pixbuf-devel-0.21.0-0vl3

* Thu May 01 2003 KOBAYASHI R. Taizo <tkoba@vinelinux.org>
- syncd with rawhide 31 and Mandrake 27mdk

* Mon Apr 14 2003 KOBAYASHI R. Taizo <tkoba@vinelinux.org>
- rebuild
- Patch1: for gdk-pixbuf-0.21

* Mon Jul 02 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@vinelinux.org>
- 0.7008-0vl1
- updated to 0.7008 release
- disabled Gtk-Perl-extras subpackage at the moment

* Sat Jun 16 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@vinelinux.org>
- 0.7007-0vl1
- updated to 0.7007 release
- split Gtk-Perl-extras subpackage

* Fri Jun 15 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@vinelinux.org>
- 0.7004-0vl2
- rebuilt with perl-5.6
- package renamed to Gtk-Perl
- add GdkPixbuf modules

* Sun Jan 21 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 0.7004-0vl1
- upgraded for 0.7004 release
- use %%{_tmppath}

* Fri Apr 28 2000 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 0.7000-0vl1
- first package for Vine/ppc