%define _prefix /opt/freeware
%define _defaultdocdir %{_prefix}/doc
%define glib2_version 2.12.4
%define atk_version 1.12.3
%define pango_version 1.14.5
%define cairo_version 1.8.6
%define pixman_version 0.12.0
%define xcursor_version 1.0.2

# bin_version corresponds to GTK_BINARY_VERSION in configure.in
%define bin_version 2.*

Summary: 	The GIMP ToolKit (GTK+), a library for creating GUIs for X.
Name:  		gtk2
Version: 	2.10.6
Release: 	1
License: 	LGPL
Group: 		System Environment/Libraries
Source: 	gtk+-%{version}.tar.bz2

Patch0:		gtk+-2.10.6-aix.patch
Patch1:		gtk+-2.10.6-autotools.patch


Prereq: libpng
Prereq: libtiff
Prereq: libjpeg

BuildPrereq: atk-devel >= %{atk_version}
BuildPrereq: pango-devel >= %{pango_version}
BuildPrereq: glib2-devel >= %{glib2_version}
BuildPrereq: libtiff-devel
BuildPrereq: libjpeg-devel
BuildPrereq: libpng-devel
#BuildPrereq: /usr/bin/automake-1.4

BuildRoot: %{_tmppath}/gtk2-%{version}-root

URL: http://www.gtk.org

# We need to prereq these so we can run gtk-query-immodules-2.0
Prereq: glib2 >= %{glib2_version}
Prereq: atk >= %{atk_version}
Prereq: pango >= %{pango_version}
Prereq: xcursor >= %{xcursor_version}
Prereq: cairo >= %{cairo_version}
Prereq: pixman  >= %{pixman_version}


%description
GTK+ is a multi-platform toolkit for creating graphical user
interfaces. Offering a complete set of widgets, GTK+ is suitable for
projects ranging from small one-off tools to complete application
suites.

%package devel
Summary: Development tools for GTK+ applications.
Group: Development/Libraries
Requires: gtk2 = %{version}
Requires: pango-devel >= %{pango_version}
Requires: atk-devel >= %{atk_version}
Requires: glib2-devel >= %{glib2_version}

%description devel
The gtk+-devel package contains the header files and developer
docs for the GTK+ widget toolkit.  

%prep
%setup -q -n gtk+-%{version}

if test x$PATCH = x ; then
  PATCH=patch ;
fi
$PATCH -p2 -s < %{_sourcedir}/gtk+-2.10.6-aix.patch
$PATCH -p2 -s < %{_sourcedir}/gtk+-2.10.6-autotools.patch


%build
LDFLAGS="-L%{_libdir}" CPPFLAGS="-I%{_includedir}" PATH=%{_bindir}:$PATH \
./configure --prefix=%{_prefix} --disable-gtk-doc
PATH=%{_bindir}:$PATH make

%install
if test "%{buildroot}" != "/"; then
	rm -rf %{buildroot}
fi
mkdir -p %{buildroot}
# Remove the binaries so that the relink can take place
rm -f modules/input/.libs/*.so.0

make DESTDIR=%{buildroot} install-strip

# make links
cd %{buildroot}
for dir in bin lib include share
do
        mkdir -p usr/$dir
        cd usr/$dir
        ln -sf ../..%{_prefix}/$dir/* .
        cd -
done


# Create the directory (empty)
mkdir -p %{buildroot}/%{_sysconfdir}/gtk-2.0/

%post
if test -e %{_sysconfdir}/gtk-2.0/gtk.immodules; then
	rm %{_sysconfdir}/gtk-2.0/gtk.immodules
fi
%{_bindir}/gtk-query-immodules-2.0 > %{_sysconfdir}/gtk-2.0/gtk.immodules
%{_bindir}/gdk-pixbuf-query-loaders > %{_sysconfdir}/gtk-2.0/gdk-pixbuf.loaders

%files
%defattr(-, root, system)

%doc AUTHORS COPYING ChangeLog NEWS README
#%{_bindir}/testtext
#%{_bindir}/testgtk
%{_bindir}/gtk-demo
/usr/bin/gtk-demo
%{_bindir}/gtk-query-immodules-2.0
/usr/bin/gtk-query-immodules-2.0
%{_bindir}/gtk-update-icon-cache
/usr/bin/gtk-update-icon-cache
%{_bindir}/gdk-pixbuf-query-loaders
/usr/bin/gdk-pixbuf-query-loaders
%{_libdir}/libgtk-x11-2.0.a
%{_libdir}/libgdk-x11-2.0.a
%{_libdir}/libgdk_pixbuf-2.0.a
%{_libdir}/libgdk_pixbuf_xlib-2.0.a
#%{_prefix}/64/lib/lib*.a
%dir %{_libdir}/gtk-2.0
%{_libdir}/gtk-2.0/%{bin_version}
%{_datadir}/gtk-2.0
%{_datadir}/themes/Default
%{_datadir}/themes/Emacs
# The theme 'Raleigh' is not installed on AIX
#%{_datadir}/themes/Raleigh
%dir %{_sysconfdir}/gtk-2.0/
%{_datadir}/locale/*/LC_MESSAGES/gtk20.mo
%{_datadir}/locale/*/LC_MESSAGES/gtk20-properties.mo

/usr/lib/lib*.a
/usr/share/*

%files devel
%defattr(-, root, system)

%dir %{_libdir}/gtk-2.0
%{_libdir}/gtk-2.0/include
%{_libdir}/*.la
%{_datadir}/gtk-doc/
%{_mandir}/man1/*
%{_includedir}/*
/usr/include/*
%{_datadir}/aclocal/*
%{_bindir}/gdk-pixbuf-csource
/usr/bin/gdk-pixbuf-csource
%{_libdir}/pkgconfig/*
%doc docs/tutorial
%doc examples
/usr/share/*
%changelog
*  Fri Nov 17 2006  BULL
 - Release  1
 - New version  version: 2.10.6
 - gnome 2.16.1

*  Fri Sep 15 2006  BULL
 - Release  10
 - Added PreReq xcursor

*  Thu Sep 14 2006  BULL
 - Release  9

*  Tue Aug 29 2006  BULL
 - Release  8
 - added : gtk.immodules

*  Thu Jul 20 2006  BULL
 - Release  7
 - built with ORBit 2.14

*  Fri Feb 10 2006  BULL
 - Release  6
*  Tue Jan 17 2006  BULL
 - Release  5
 - Correct unresolve XRender symbols in libgdk-x11-2.0.a

*  Fri Dec 23 2005  BULL
 - Release 4 
 - Prototype gtk 64 bit
*  Thu Dec 01 2005  BULL
 - Release  3
 - Security update: Fix integer overflow in xpm loader

*  Wed Nov 30 2005  BULL
 - Release  2
 - Correct input method problem that for example prevent to connect from gdm.

*  Tue Nov 15 2005  BULL
 - Release  1
 - New version  version: 2.8.3

*  Wed Aug 10 2005  BULL
 - Release  5
 - Create symlinks between /usr/share/ and /opt/freeware/share

*  Tue Aug 02 2005  BULL
 - Release  4
 - enables wnn8 IM in japanese

*  Thu Jun 23 2005  BULL
 - Release  3
 -  Workaround to use Wnn7 im with Japanese Environment

*  Wed May 25 2005  BULL
 - Release  1
 - New version  version: 2.6.4

*  Fri Dec 03 2004  BULL
 - Release  2
 - Corrects problems with input methods using auxiliary windows such as the zh_CN input method

*  Tue Nov 23 2004  BULL
 - Release  1
 - New version  version: 2.4.13
 - Use the XIM input method by default for languages 'fr', 'ca' and 'pt'

*  Mon Sep 20 2004  BULL
 - Release  3
 - Fix bugzilla bug number 150601:
 - Fix bugzilla bug number 144808:

*  Wed Jul 28 2004  BULL
 - Release  2
 - bugfix causing core file

