%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}

%define glib_version 2.20.0
%define gtk_version 2.16.0
%define gnome_panel_version 2.26.0
%define gnome_python_version 2.26.0
%define gtkhtml2_version 2.3.1
%define gecko_version 1.9.1
%define gtkspell_version 2.0.7
%define libgda_version 4.0
%define libgdl_version 0.7.1

%define build_gdl 0

### Abstract ###

Name: gnome-python-extras
Version: 2.25.3
Release: 4%{?_dist_release}
License: GPL/LGPL
Group: Development/Languages
Summary: The sources for additional. PyGNOME Python extension modules.
URL: http://www.pygtk.org/

Source: gnome-python-extras-%{version}.tar.bz2
Patch1: gnome-python-extras-2.10.0-gtkspell-static.patch
Patch4: gnome-python-extras-2.19.1-buildfix.patch


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

### Dependencies ###

Requires: gnome-python >= %{gnome_python_version}

### Build Dependencies ###

BuildRequires: gecko-devel >= %{gecko_version}
BuildRequires: glib2 >= %{glib_version}
BuildRequires: gnome-panel >= %{gnome_panel_version}
BuildRequires: gnome-python-devel >= %{gnome_python_version}
BuildRequires: gtk2 >= %{gtk_version}
BuildRequires: gtkhtml2-devel >= %{gtkhtml2_version}
BuildRequires: gtkspell-devel >= %{gtkspell_version}
BuildRequires: libbonoboui-devel
BuildRequires: libgda-devel >= %{libgda_version}
BuildRequires: libgksu-devel
BuildRequires: pygtk2-devel
BuildRequires: python-devel

%if %{build_gdl}
BuildRequires: libgdl-devel >= %{libgdl_version}
%endif

%description
The gnome-python-extra package contains the source packages for additional 
Python bindings for GNOME. It should be used together with gnome-python.

%if %{build_gdl}
%package -n gnome-python-gdl
Summary: Python bindings for the GNOME Development Library
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Requires: libgdl >= %{libgdl_version}

%description -n gnome-python-gdl
This module contains a wrapper that allows the use of the GNOME Development
Library (gdl) via Python.
%endif

%package -n gnome-python-gtkhtml2
Summary: Python bindings for interacting with gtkhtml2
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Requires: gtkhtml2 >= %{gtkhtml2_version}
Obsoletes: pygnome-gtkhtml

%description -n gnome-python-gtkhtml2
This module contains a wrapper that allows the use of gtkhtml2 via Python.

%package -n gnome-python-gtkmozembed
Summary: Python bindings for interacting with gtkmozembed
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Requires: gecko-libs >= %{gecko_version}

%description -n gnome-python-gtkmozembed
This module contains a wrapper that allows the use of gtkmozembed via Python.

%package -n gnome-python-gtkspell
Summary: Python bindings for interacting with gtkspell
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Requires: gtkspell >= %{gtkspell_version}

%description -n gnome-python-gtkspell
This module contains a wrapper that allows the use of gtkspell via Python.

%package -n gnome-python-libegg
Summary: Python bindings for recent files and tray icons
Group: Development/Languages
Requires: %{name} = %{version}-%{release}

%description -n gnome-python-libegg
This module contains a wrapper that allows the use of recent files and tray
icons via Python.

%package -n gnome-python-libgksu
Summary: Python bindings for interacting with libgksu
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Requires: libgksu

%description -n gnome-python-libgksu
This module contains a wrapper that allows the use of libgksu via Python.

%package -n gnome-python-gda
Summary: Python bindings for interacting with libgda
Group: Development/Languages
Requires: %{name} = %{version}-%{release}
Requires: libgda >= %{libgda_version}

%description -n gnome-python-gda
This module contains a wrapper that allows the use of libgda via Python.

%package -n gnome-python-gda-devel
Summary: Headers for developing programs that will use gnome-python-gda
Group: Development/Libraries
Requires: gnome-python-gda = %{version}-%{release}
Requires: pkgconfig
Requires: pygobject-devel
Requires: libgda-devel >= %{libgda_version}

%description -n gnome-python-gda-devel
This module contains files needed for developing applications using
gnome-python-gda.

%prep
%setup -q -n gnome-python-extras-%{version}
%patch1 -p1 -b .gtkspell-static
%patch4 -p1 -b .buildfix

%build
%if %{build_gdl}
%configure --with-gtkmozembed=mozilla
%else
%configure --with-gtkmozembed=mozilla --disable-gdl
%endif
make

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT

find $RPM_BUILD_ROOT -name '*.la' -exec rm {} \;

rm -rf $RPM_BUILD_ROOT/%{python_sitearch}/gtk-2.0/gksu

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog NEWS
%{_libdir}/pkgconfig/gnome-python-extras-2.0.pc
%{_datadir}/pygtk

%if %{build_gdl}
%files -n gnome-python-gdl
%defattr(-,root,root,-)
%{python_sitearch}/gtk-2.0/gdl.so
%endif

%files -n gnome-python-gtkhtml2
%defattr(-,root,root,-)
%{python_sitearch}/gtk-2.0/gtkhtml*
%defattr(644,root,root,755)
%doc examples/gtkhtml2/*

%files -n gnome-python-gtkmozembed
%defattr(-,root,root,-)
%{python_sitearch}/gtk-2.0/gtkmozembed.so

%files -n gnome-python-gtkspell
%defattr(-,root,root,-)
%{python_sitearch}/gtk-2.0/gtkspell.so

%files -n gnome-python-libegg
%defattr(-,root,root,-)
%{python_sitearch}/gtk-2.0/egg
%defattr(644,root,root,755)
%doc examples/egg/*

%files -n gnome-python-libgksu
%defattr(-,root,root,-)
%{python_sitearch}/gtk-2.0/gksu2

%files -n gnome-python-gda
%defattr(-,root,root,-)
%{python_sitearch}/gtk-2.0/gda.so

%files -n gnome-python-gda-devel
%defattr(-,root,root,-)
%{_includedir}/pygda-?.?/
%{_libdir}/pkgconfig/pygda-?.?.pc

%changelog
* Wed Feb 15 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.25.3-4
- rebuild with python-2.7.2

* Sat Sep 25 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.25.3-3
- rebuild with rpm-4.8.1 for pkg-config file

* Fri Apr 09 2010 Shu KONNO <owa@bg.wakwak.com> 2.25.3-2
- rebuilt with python-2.6
- added --disable-gdl option to configure

* Sun Jul 12 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 2.25.3-1
- new upstream release

* Fri Aug 15 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.19.1-1
- new upstream release
- split to subpackages
- build with xulrunner

* Sat Aug  5 2006 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 2.12.0-0vl3
- added missing BuildRequires for gtkspell

* Thu Jul 27 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.12.0-0vl2
- rebuilt

* Thu Oct 13 2005 Shu KONNO <owa@bg.wakwak.com> 2.12.0-0vl1
- Initial build.