%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%define commit 5e2dc9
%define without_qt 1

Name:           fusion-icon
Version:        0.1.0
Release:        3%{?_dist_release}
Summary:        Compiz Fusion panel applet
Summary(ja):    Compiz Fusion パネルアプレット
Group:          User Interface/Desktops
License:        GPLv2+

# The source for this package was pulled from upstream's vcs.  Use the
# following commands to generate the tarball:
# git clone git://anongit.opencompositing.org/users/crdlb/fusion-icon fusion-icon-5e2dc9
# cd fusion-icon-5e2dc9
# git checkout 5e2dc9
# rm -rf .git ; cd ../
# tar -czvf fusion-icon-5e2dc9.tar.gz fusion-icon-5e2dc9

URL:            http://www.opencompositing.org
Source0:        %{name}-%{commit}.tar.gz
Patch0:         %{name}-runpatch.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires:  python-devel
BuildRequires:  desktop-file-utils
Requires:       ccsm %{name}-ui=%{version}-%{release}
BuildArch:      noarch
ExcludeArch:    ppc64

%description
The Compiz Fusion Icon is a simple panel applet for starting and controlling
Compiz Fusion. Upon launch, it will attempt to start Compiz Fusion
automatically. You may need to select a window decorator, if one does not
appear.

%package gtk
Requires:  pygtk2
Requires:  %{name} = %{version}-%{release}
Group:     User Interface/Desktops
Summary:   GTK UI for fusion-icon
Summary(ja):   GTK UI for fusion-icon
Provides:  %{name}-ui=%{version}-%{release}

%description gtk
This package provides the gtk UI for fusion-icon

%package qt
Requires:  PyQt4
Requires:  %{name} = %{version}-%{release}
Group:     User Interface/Desktops
Summary:   QT UI for fusion-icon
Summary(ja):   QT UI for fusion-icon
Provides:  %{name}-ui=%{version}-%{release}

%description qt
This package provides the qt UI for fusion-icon

%prep
%setup -q -n %{name}-%{commit}
%patch0

%build

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
desktop-file-install --vendor=""             \
  --dir=$RPM_BUILD_ROOT%{_datadir}/applications/   \
  --delete-original                                \
        $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop

%post
touch --no-create %{_datadir}/icons/hicolor
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
  %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi


%postun
touch --no-create %{_datadir}/icons/hicolor
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
  %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%{_bindir}/fusion-icon
%{_datadir}/applications/%{name}.desktop
%dir %{python_sitelib}/FusionIcon/
%{python_sitelib}/FusionIcon/*py*
%{_datadir}/icons/hicolor/*/apps/fusion-icon.png
%{_datadir}/icons/hicolor/scalable/apps/fusion-icon.svg
%if "%{fedora}" > "8"
%{python_sitelib}/fusion_icon-%{version}-py2.5.egg-info
%endif
%doc COPYING

%files gtk
%defattr(-,root,root,-)
%{python_sitelib}/FusionIcon/interface_gtk/

%if ! %{without_qt}
%files qt
%defattr(-,root,root,-)
%{python_sitelib}/FusionIcon/interface_qt4/
%endif

%changelog
* Wed Jul 23 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 0.1.0-3
- remove vendor prefix from desktop file

* Mon Jul 21 2008 Shu KONNO <owa@bg.wakwak.com> 0.1.0-2
- rebuilt with python-2.5.2

* Sun May 18 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 0.1.0-1
- initial build for Vine Linux

* Mon Mar 17 2008 Karol Trzcionka <karlikt at gmail.com> - 0.1.0-0.2.5e2dc9git
- Fix typo in %%files 
* Mon Mar 17 2008 Karol Trzcionka <karlikt at gmail.com> - 0.1.0-0.1.5e2dc9git
- Update tarball
- Change method of releasing
* Wed Feb 13 2008 Karol Trzcionka <karlikt at gmail.com> - 0-0.5.20080213git
- Update tarball
* Tue Jan 22 2008 Karol Trzcionka <karlikt at gmail.com> - 0-0.4.20071206git.1
- Fix name of egg-info
* Tue Jan 22 2008 Karol Trzcionka <karlikt at gmail.com> - 0-0.4.20071206git
- Add egg-info in files section
* Fri Dec 21 2007 Karol Trzcionka <karlikt at gmail.com> - 0-0.3.20071206git
- Fix qt interface
- Add Provides/Requires fusion-icon-ui
* Thu Dec 06 2007 Karol Trzcionka <karlikt at gmail.com> - 0-0.2.20071206git
- Set excludearch: ppc64
- Delete .git directory from tarball
* Mon Nov 26 2007 Karol Trzcionka <karlikt at gmail.com> - 0-0.1.20071126git
- Initial release

