%define major_ver 2.32
%define minor_ver 2
%define rel       1

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

## Minimum required versions of GLib, GTK+, libtelepathy, and Mission-Control,
## respectively.
%global	gtk2_min_version	2.22
%global	glib2_min_version	2.26.0
%global	tp_mc_min_version	5.6.0
%global	tp_glib_min_version	0.13.0
%global	tp_logger_min_version	0.1.5
#global	enchant_version		1.4.0
%global	aspell_version		0.50
%global libcanberra_version	0.4
%global gnome_keyring_version	2.32
%global libnotify_version	0.4.4

Summary:	GNOME Instant Messaging Client
Summary(ja):	GNOME インスタントメッセージクラアイント

Name:		empathy
Version:	%{major_ver}.%{minor_ver}
Release:        %{rel}%{?_dist_release}

Group:		Applications/Communications
License:	GPLv2+
URL:		http://live.gnome.org/Empathy

Source0:	http://ftp.gnome.org/pub/GNOME/sources/%{name}/%{majorver}/%{name}-%{version}.tar.bz2
Source1:	%{name}-README.ConnectionManagers

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

#BuildRequires:	enchant-devel >= %{enchant_version}
BuildRequires:	aspell-devel >= %{aspell_version}
BuildRequires:	iso-codes
BuildRequires:	desktop-file-utils
BuildRequires:	evolution-data-server-devel
BuildRequires:	GConf2-devel 
BuildRequires:	gettext
BuildRequires:	glib2-devel >= %{glib2_min_version}
BuildRequires:	gnome-doc-utils >= 0.17.3
BuildRequires:	gnome-panel
BuildRequires:	gtk2-devel >= %{gtk2_min_version}
BuildRequires:	intltool
BuildRequires:	libxml2-devel
BuildRequires:	perl(XML::Parser)
BuildRequires:	pygtk2-devel
BuildRequires:	telepathy-glib-devel >= %{tp_glib_min_version}
BuildRequires:	telepathy-mission-control-devel >= %{tp_mc_min_version}
BuildRequires:  farsight2-devel
BuildRequires:	telepathy-farsight-devel 
BuildRequires:	libcanberra-devel >= %{libcanberra_version}
BuildRequires:	libgnome-keyring-devel >= %{gnome_keyring_version}
BuildRequires:	unique-devel
BuildRequires:	libnotify-devel >= %{libnotify_version}
BuildRequires:	libtelepathy-devel
BuildRequires:	libgnomecanvas-devel
BuildRequires:	libbonoboui-devel
BuildRequires:	folks-devel
BuildRequires:	telepathy-logger-devel >= %{tp_logger_min_version}
BuildRequires:	gnome-keyring-devel >= %{gnome_keyring_version}
BuildRequires:	openssl-devel
BuildRequires:	NetworkManager-glib-devel
BuildRequires:	WebKit-gtk-devel
BuildRequires:	geoclue-devel
BuildRequires:	enchant-devel

Requires:	telepathy-filesystem
## Empathy is useless without a proper Telepathy connection manager installed.
## We hardcode dependencies on Salut and Gabble to support XMPP on a default
## install, in both the link-local and Jabber/GoogleTalk incarnations. 
## (RHBZ: 308871 and 334221)
## TODO: Perhaps we can configure these to be installed "on demand" with
##       PackageKit and friends?
Requires:	telepathy-gabble
Requires:	telepathy-salut
## Also hardcode Haze dependency since Empathy is the default IM client in F10+
## and I'd hate for people to simply disregard it for lack of the "out of the
## box" protocol support that Pidgin has. (RHBZ: 458935)
BuildRequires:	telepathy-haze
# Require this for VOIP support 
Requires:	telepathy-stream-engine
Requires:	telepathy-mission-control >= %{tp_mc_min_version}


Requires(post):	GConf2
Requires(post):	scrollkeeper

Requires(postun):	scrollkeeper

## We're using Empathy's upstreamed profiles for Haze-provided stuff now.
Obsoletes:	telepathy-haze-mission-control < 0.2.0-3
Provides:	telepathy-haze-mission-control = 0.2.0-3
## upstream 2.29.1 removed shared libraries: #599086
Obsoletes: empathy-libs < 2.29.1, empathy-devel < 2.29.1
## upstream 2.29.1 removed python bindings' #599039
Obsoletes: empathy-python < 2.29.1

%description
Empathy provides a powerful multiple protocol instant messaging
client using the Telepathy framework.


%package -n	nautilus-sendto-empathy
License:	GPLv2+
Summary:	Nautilus-sendto plugin for empathy
Summary(ja):	empathy 用 nautilus-sendto プラグイン
Group:		User Interface/Desktop

Requires:	%{name} = %{version}-%{release}
Requires:	nautilus-sendto
BuildRequires:	nautilus-sendto-devel

%description -n	nautilus-sendto-empathy
This package contains nautilus-sendto plugin for the Empathy IM application.


%prep
%setup -q


%build
## GCC complains about some unused functions, so we forcibly show those as
## simple warnings instead of build-halting errors.
%configure \
	--with-compile-warnings=yes \
	--disable-static \
	--enable-nautilus-sendto=yes \
	 --with-ca-file=/usr/share/ssl/certs/ca-bundle.crt
## RPATHs are yucky.
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

##make %{?_smp_mflags}
## don't use _smp_mflags at empathy-2.18.1
make

install -m 0644 %{SOURCE1} ./README.ConnectionManagers


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'

%find_lang %{name}

desktop-file-install --vendor "" --delete-original	\
	--dir %{buildroot}%{_datadir}/applications	\
	%{buildroot}%{_datadir}/applications/%{name}.desktop


%clean
rm -rf %{buildroot}


%post
scrollkeeper-update -q -o %{_datadir}/omf/%{name} ||:
touch --no-create %{_datadir}/icons/hicolor ||:
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor ||:

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

%posttrans 
gtk-update-icon-cache %{_datadir}/icons/hicolor >&/dev/null ||:
glib-compile-schemas %{_datadir}/glib-2.0/schemas ||:


%files -f %{name}.lang
%defattr(-,root,root,-)
%doc AUTHORS COPYING README README.ConnectionManagers NEWS
%{_bindir}/empathy
%{_bindir}/empathy-accounts
%{_bindir}/empathy-debugger
%{_libexecdir}/empathy-auth-client
%{_libexecdir}/empathy-av
%{_datadir}/dbus-1/services/*
%{_datadir}/empathy
%{_datadir}/glib-2.0/schemas/*.xml
%{_datadir}/GConf/gsettings/*
%{_datadir}/applications/*.desktop
%{_datadir}/gnome/help/%{name}/
#{_datadir}/omf/%{name}/
%{_datadir}/icons/hicolor/*/apps/%{name}*
#{_datadir}/mission-control/profiles/*.profile
%{_datadir}/telepathy/clients/*.client
%{_mandir}/man1/empathy*.1*

%files -n nautilus-sendto-empathy
%defattr(-,root,root,-)
%{_libdir}/nautilus-sendto/plugins/libnstempathy.so


%changelog
* Sun Jan 30 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.32.2-1
- new upstream release
- add BuildRequires: openssl-devel, NetworkManager-glib-devel, WebKit-devel
                     geoclue-devel, enchant-devel
- add Requires: telepathy-mission-control
- add configure option: --with-ca-file=/usr/share/ssl/certs/ca-bundle.crt

* Sun Oct 03 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.32.0.1-1
- new upstream release
- add BuildRequires: folks-devel, telepathy-logger-devel, gnome-keyring-devel
- fix %files
- fix %post, %postun
- drop %pre, %preun

* Sat Jun 26 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.30.0.1-3
- rebuild with evolution-data-server-2.30.2
- add nautilus-sendto-empathy package
  - add configure option (--enable-nautilus-sendto=yes)
  - add BuildRequires: nautilus-sendto-devel

* Sat Jun 12 2010 IWAI, Masaharu <iwai@alib.jp> 2.30.0.1-2
- add Obsoletes: empathy-python < 2.29.1

* Tue Apr 13 2010 IWAI, Masaharu <iwai@alib.jp> 2.30.0.1-1
- new upstream release
- add new files: %%{_bindir}/empathy-{accounts,debugger}
- drop -libs, -devel, -python sub packages: upstream removed
  - Obsoletes: empathy-{libs,devel} < 2.29.1
  - drop BuildRequires: python-devel
- drop %%{_bindir}/empathy-logs in %%files: upstream don not install
- drop applet files in %%files: upstream removed the panel applets
  - update %%post, %pre and %%preun
- update BuildRequires version for glib2 and tp_glib
- defined major_ver, minor_ver and rel
- fix BuildRequires for gnome-keyring

* Sat Mar 13 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.28.2-1
- new upstream release
- add BuildRequires: libtelepathy-devel, libgnomecanvas-devel, libbonoboui-devel, python-devel

* Wed Feb 03 2010 Shu KONNO <owa@bg.wakwak.com> 2.28.1-4
- rebuilt with python-2.6.4

* Fri Nov 27 2009 Shu KONNO <owa@bg.wakwak.com> - 2.28.1-3
- unuse %%{?_smp_mflags} option to make

* Wed Nov 11 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 2.28.1-2
- add {gnome-keyring,libcanberra,libnotify,unique}-devel to BuildRequires

* Sat Nov  7 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.28.1-1
- new upstream release

* Wed Oct 29 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.24.1-1
- new upstream release

* Tue Sep 30 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.24.0-1
- initial build for Vine Linux

* Tue Sep  9 2008 Matthias Clasen <mclasen@redhat.com> - 2.23.92-1
- Update to 2.23.92

* Thu Sep  4 2008 Matthias Clasen <mclasen@redhat.com> - 2.23.91-1
- Update to 2.23.91

* Sun Aug 24 2008 Peter Gordon <peter@thecodergeek.com> - 2.23.90-2
- Now that Empathy will be the default IM client in F10+, hardcode a dependency
  on telepathy-haze to keep the same protocol functionality across upgrades,
  for a much improved "out of the box" experience.
- Reference: bug 458935.

* Fri Aug 22 2008 Peter Gordon <peter@thecodergeek.com> - 2.23.90-1
- Update to new upstream release (2.23.90)

* Fri Aug 15 2008 Peter Gordon <peter@thecodergeek.com> - 2.23.6-3
- Apply patch from Colin Walters to automagically update profile namings for
  the switch to using Empathy's provided profiles.
- Drop the upgrade script (no longer needed since it's automatically done).
  - upgrade-haze-profiles.sh

* Wed Aug 13 2008 Peter Gordon <peter@thecodergeek.com> - 2.23.6-2
- Use upstream's AIM, ICQ, MSN-Haze, and Yahoo profiles instead of recommending
  the telepathy-haze-mission-control package. (The Haze-provided ones have grown
  horribly stale...). This makes for better automagic functionality (if Haze is
  installed, Empathy/MC will autodetect it) and tracks upstream more closely.
  + upgrade-haze-profiles.sh

* Mon Aug 04 2008 Peter Gordon <peter@thecodergeek.com> - 2.23.6-1
- Update to new upstream release (2.23.6)
- Use the in-tarball libtool scripts instead of the system copy to workaround
  'make install' errors.

* Wed Jul 16 2008 Brian Pepple <bpepple@fedoraproject.org> - 0.23.4-1
- Update to 0.23.4.
- Update source url.

* Mon Jun  2 2008 Brian Pepple <bpepple@fedoraproject.org> - 0.23.3-1
- Update to 0.23.3.
- Remove reference to stream-engine in connections managers readme.

* Fri May 16 2008 Brian Pepple <bpepple@fedoraproject.org> - 0.23.2-1
- Update to 0.23.2.
- Add man pages.
- Use enchant-devel, instead of aspell-devel.

* Fri May 16 2008 Brian Pepple <bpepple@fedoraproject.org> - 0.23.1-3
- Rebuild for new e-d-s.

* Sun May  4 2008 Brian Pepple <bpepple@fedoraproject.org> - 0.23.1-2
- Drop multiple copies of COPYING file.
- Drop BR on gnome-vfs2-devel.
- Require telepathy-stream-engine for VOIP support.
- Add BR on iso-codes-devel, so spell-checking is enabled.

* Wed Apr 23 2008 Peter Gordon <peter@thecodergeek.com> - 0.23.1-1
- Update to new upstream release (0.23.1)
- Drop libtelepathy dependencies; upstream switched fully to telepathy-glib.

* Fri Apr 11 2008 Peter Gordon <peter@thecodergeek.com> - 0.22.1-1
- Update to new upstream release (0.22.1)

* Mon Mar 10 2008 Peter Gordon <peter@thecodergeek.com> - 0.22.0-1
- Update to new upstream release (0.22.0)

* Sun Mar 09 2008 Peter Gordon <peter@thecodergeek.com> - 0.21.91-1
- Update to new upstream release (0.21.91)

* Fri Feb 22 2008 Peter Gordon <peter@thecodergeek.com> - 0.21.90-1
- Update to new upstream release (0.21.90)

* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 0.21.4-2
- Autorebuild for GCC 4.3

* Mon Dec 17 2007 Peter Gordon <peter@thecodergeek.com> - 0.21.4-1
- Update to new upstream release (0.21.4)

* Tue Nov 13 2007 Peter Gordon <peter@thecodergeek.com> - 0.21.2-1
- Update to new upstream release (0.21.2)
- Drop backported drag-and-drop patch (fixed upstream):
    - svn380-fix-contact-DnD.patch
- Update README.ConnectionManagers: Include Haze package note, remove Galago
  note (a feed-only connection manager isn't useful for instant messaging),
  and fix some wording.

* Fri Oct 19 2007 Peter Gordon <peter@thecodergeek.com> - 0.14-5
- Backport upstream patch to fixes crashes when using drag-and-drop of a
  contact from the buddy list to the current conversation window to initiate a
  conversation:
    + svn380-fix-contact-DnD.patch 
- Resolves: GNOME bug 483168 (crash in Empathy Instant Messenger: I had
  dragged a contact ...) 

* Tue Oct 16 2007 Peter Gordon <peter@thecodergeek.com> - 0.14-4
- Depend on Salut and Gabble to enable XMPP by default. Otherwise, Empathy
  is essentially useless due to the need to install an external connection
  manager. Also, add a README.ConnectionManagers to the installed
  documentation which lists other possibilities.
- Resolves: bug 308871 (Make empathy dependent at least on telepathy-gabble)
  and bug 334221 (Default empathy install is useless).

* Wed Oct 10 2007 Peter Gordon <peter@thecodergeek.com> - 0.14-3
- Enable VoIP support for those brave enough to test/break/debug it (F9+
  only). Though it is functional, it is still deemed rather unstable by
  upstream. Use it at your own risk. :)

* Tue Oct 02 2007 Peter Gordon <peter@thecodergeek.com> - 0.14-2
- Disable VoIP support at this time, since it is deemed unstable by upstream
  for now. (Thanks to Brian Pepple for the notice.)
  
* Tue Oct 02 2007 Peter Gordon <peter@thecodergeek.com> - 0.14-1
- Update to new upstream release (0.14).

* Sun Sep 30 2007 Peter Gordon <peter@thecodergeek.com> - 0.13-1
- Update to new upstream release (0.13), which adds a panel applet (Megaphone)
  and python bindings.
- Split shared libraries into a libs subpackage for easier handling
  in multi-lib environments.

* Fri Aug 31 2007 Peter Gordon <peter@thecodergeek.com> - 0.12-2
- Add ldconfig invocations to %%post and %%postun scriptlets.

* Fri Aug 31 2007 Peter Gordon <peter@thecodergeek.com> - 0.12-1
- Update to new upstream release (0.12).
- Build against new mission-control stack.
- Update License tag (GPLv2+).
- Alphabetize BuildRequires list (aesthetic-only change).

* Wed Aug 29 2007 Fedora Release Engineering <rel-eng at fedoraproject dot org> - 0.8-2
- Rebuild for selinux ppc32 issue.

* Mon Aug 13 2007 Peter Gordon <peter@thecodergeek.com> - 0.11-1
- Update to new upstream release (0.11)

* Fri Jun 22 2007 David Nielsen <david@lovesunix.net> - 0.8-1
- bump to 0.8
- Now with aspell support (deat to teh speeling mistaks)

* Sat Jun  9 2007 David Nielsen <david@lovesunix.net> - 0.7-1
- bump to 0.7

* Mon Jun  4 2007 David Nielsen <david@lovesunix.net> - 0.6-3
- Add telepathy-filesystem to Requires
- Move .desktop from autostart to applications
- Nasty hackery to make empathy launch from the menu

* Mon Jun  4 2007 David Nielsen <david@lovesunix.net> - 0.6-2
- Add gettext to BuildRequires

* Fri Jun  1 2007 David Nielsen <david@lovesunix.net> - 0.6-1
- Bump to 0.6

* Fri Jun  1 2007 David Nielsen <david@lovesunix.net> - 0.5-2
- Let Empathy own the directory and not just the files in it

* Tue May 30 2007 David Nielsen <david@lovesunix.net> - 0.5-1
- Initial package
