%define dbus_version    	1.2
%define dbus_glib_version	0.80
%define gtk2_version            2.16
%define gnome_vfs2_version      2.24
%define libsexy_version         0.1.11
%define gnome_doc_utils_version 0.3.2
%define polkit_version          0.9
%define intltool_version        0.35

Summary: PolicyKit integration for the GNOME desktop
Name: PolicyKit-gnome
Version: 0.9.2
Release: 1%{?_dist_release}
License: GPLv2+
Group: System Environment/Libraries
URL: http://gitweb.freedesktop.org/?p=users/david/PolicyKit-gnome.git;a=summary
Source0: http://hal.freedesktop.org/releases/%{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: dbus-devel  >= %{dbus_version}
BuildRequires: dbus-glib-devel >= %{dbus_glib_version}
BuildRequires: dbus-glib >= %{dbus_glib_version}
BuildRequires: gtk2-devel >= %{gtk2_version}
BuildRequires: gnome-vfs2-devel >= %{gnome_vfs2_version}
BuildRequires: libsexy-devel >= %{libsexy_version}
BuildRequires: PolicyKit-devel >= %{polkit_version}
BuildRequires: gnome-doc-utils >= %{gnome_doc_utils_version}
BuildRequires: intltool >= %{intltool_version}
BuildRequires: gettext
BuildRequires: desktop-file-utils
Requires: dbus >= %{dbus_version}
Requires: dbus-glib >= %{dbus_glib_version}
Requires: gtk2 >= %{gtk2_version}
Requires: gnome-vfs2 >= %{gnome_vfs2_version}
Requires: PolicyKit >= %{polkit_version}
Requires: libsexy >= %{libsexy_version}

Patch0: PolicyKit-gnome-0.9.2-dont-spawn-when-running-under-gdm.patch
Patch1: PolicyKit-gnome-0.9.2-fix-clickable-buttons.patch

%description 
PolicyKit-gnome provides a GNOME integration library and tools for
PolicyKit including an Authentication Agent that matches the look and
feel of the GNOME desktop.

%package demo
License: GPLv2+
Summary: Demo application for PolicyKit-gnome
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description demo 
Policy-gnome-demo provides a sample application that demonstrates the
features of both PolicyKit and PolicyKit-gnome. You normally don't
want to have this package installed.

%package libs
License: LGPLv2+
Summary: PolicyKit-gnome libraries
Group: Development/Libraries
Requires: gtk2 >= %{gtk2_version}
Requires: PolicyKit >= %{polkit_version}

%description libs
Libraries provided by PolicyKit-gnome

%package devel
License: LGPLv2+
Summary: Headers, libraries and API docs for PolicyKit-gnome
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: pkgconfig
Requires: PolicyKit-devel >= %{polkit_version}
Requires: PolicyKit-docs >= %{polkit_version}

%description devel 
This package provides headers, libraries and API docs for
PolicyKit-gnome.

%prep
%setup -q
%patch0 -p0 -b .no-spawning-under-gdm
%patch1 -p0 -b .fix-clickable-buttons


%build
%configure
make

%install
rm -rf $RPM_BUILD_ROOT

make install DESTDIR=$RPM_BUILD_ROOT

desktop-file-install --delete-original  \
  --dir $RPM_BUILD_ROOT%{_datadir}/applications \
  --remove-only-show-in=GNOME \
  $RPM_BUILD_ROOT%{_datadir}/applications/polkit-gnome-authorization.desktop

rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/*.a

%find_lang %{name}

%clean
rm -rf $RPM_BUILD_ROOT


%post
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-install-rule %{_sysconfdir}/gconf/schemas/polkit-gnome.schemas >& /dev/null || :

%pre
if [ "$1" -gt 1 ]; then
  export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
  gconftool-2 --makefile-uninstall-rule %{_sysconfdir}/gconf/schemas/polkit-gnome.schemas >& /dev/null || :
fi

%preun
if [ "$1" -eq 0 ]; then
  export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
  gconftool-2 --makefile-uninstall-rule %{_sysconfdir}/gconf/schemas/polkit-gnome.schemas >& /dev/null || :
fi


%files -f %{name}.lang
%defattr(-,root,root,-)

%doc README AUTHORS NEWS COPYING HACKING TODO

%{_libexecdir}/polkit-gnome-manager
%{_datadir}/dbus-1/services/org.gnome.PolicyKit.service
%{_datadir}/dbus-1/services/org.gnome.PolicyKit.AuthorizationManager.service
%{_datadir}/dbus-1/services/gnome-org.freedesktop.PolicyKit.AuthenticationAgent.service

%{_bindir}/polkit-gnome-authorization
%{_datadir}/applications/polkit-gnome-authorization.desktop
%{_sysconfdir}/gconf/schemas/polkit-gnome.schemas

%files libs

%{_libdir}/lib*.so.*

%files devel

%{_libdir}/lib*.so
%{_libdir}/pkgconfig/*
%{_includedir}/*

%dir %{_datadir}/gtk-doc/html/polkit-gnome
%{_datadir}/gtk-doc/html/polkit-gnome/*

%files demo
%defattr(-,root,root,-)
%{_bindir}/polkit-gnome-example
%{_datadir}/PolicyKit/policy/*.policy

%changelog
* Fri Mar 27 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 0.9.2-1
- new upstream release

* Mon Aug 04 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 0.9-1
- new upstream release

* Wed Jun 25 2008 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 0.8-6
- initial build for Vine Linux

* Thu May  1 2008 David Zeuthen <davidz@redhat.com> - 0.8-5%{?dist}
- Rebuild

* Thu May  1 2008 David Zeuthen <davidz@redhat.com> - 0.8-4%{?dist}
- Don't spawn stuff under gdm

* Thu Apr 17 2008 David Zeuthen <davidz@redhat.com> - 0.8-3%{?dist}
- Fix i18n (#442938)

* Thu Apr 17 2008 Matthias Clasen <mclasen@redhat.com> - 0.8-2%{?dist}
- Show the menu item in other desktops too (#442814)

* Wed Apr 16 2008 David Zeuthen <davidz@redhat.com> - 0.8-1%{?dist}
- Upstream release 0.8

* Mon Feb 18 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 0.7-3
- Autorebuild for GCC 4.3

* Tue Dec 18 2007 David Zeuthen <davidz@redhat.com> - 0.7-2%{?dist}
- Avoid crashing when an authorization is blocked for a user without ~/.face

* Thu Dec  6 2007 David Zeuthen <davidz@redhat.com> - 0.7-1%{?dist}
- Update to latest upstream release

* Mon Oct 22 2007 Matthias Clasen <mclasen@redhat.com> - 0.6-2
- Rebuild against new dbus-glib

* Thu Oct 11 2007 David Zeuthen <davidz@redhat.com> - 0.6-1%{?dist}
- Update to latest upstream release

* Tue Sep 25 2007 David Zeuthen <davidz@redhat.com> - 0.6-0.git20070925%{?dist}
- Update to git snapshot

* Mon Sep  3 2007 Matthias Clasen <mclasen@redhat.com> - 0.5-4
- Add gettext BR

* Fri Aug 31 2007 David Zeuthen <davidz@redhat.com> - 0.5-3%{?dist}
- Rebuild

* Fri Aug 31 2007 David Zeuthen <davidz@redhat.com> - 0.5-2%{?dist}
- Require newer PolicyKit release

* Fri Aug 31 2007 David Zeuthen <davidz@redhat.com> - 0.5-1%{?dist}
- Upstream release 0.5

* Tue Jul 31 2007 David Zeuthen <davidz@redhat.com> - 0.5-0.git20070731.4%{?dist}
- Add BR for intltool

* Tue Jul 31 2007 David Zeuthen <davidz@redhat.com> - 0.5-0.git20070731.3%{?dist}
- Add BR for gnome-doc-utils

* Tue Jul 31 2007 David Zeuthen <davidz@redhat.com> - 0.5-0.git20070731.2%{?dist}
- Rebuild

* Tue Jul 31 2007 David Zeuthen <davidz@redhat.com> - 0.5-0.git20070731.1%{?dist}
- Rebuild and require PolicyKit >= 0.5

* Tue Jul 31 2007 David Zeuthen <davidz@redhat.com> - 0.5-0.git20070731%{?dist}
- Update to git snapshot

* Wed Jul 25 2007 David Zeuthen <davidz@redhat.com> - 0.4-1%{?dist}
- Update to 0.4

* Tue Jun 19 2007 David Zeuthen <davidz@redhat.com> - 0.3-1%{?dist}
- Initial build.

