# -*- coding: utf-8-unix -*-
%define desktop_file_utils_version 0.9

%define enable_DLNA_UPnP 0

Summary: Music Management Application 
Summary(ja): 音楽管理アプリケーション
Name: rhythmbox
Version: 0.12.8
Release: 1%{?_dist_release}
License: GPL2+ with exceptions and GFDL
Group: Applications/Multimedia
URL: http://projects.gnome.org/rhythmbox/
Source: http://download.gnome.org/sources/rhythmbox/0.12/%{name}-%{version}.tar.bz2

# https://bugzilla.gnome.org/show_bug.cgi?id=596615
Patch0: rb-no-HEAD-for-podcasts.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=540672
# https://bugzilla.gnome.org/show_bug.cgi?id=602140
Patch1: rb-webkit-crasher.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=546188
Patch2: 0001-Fix-crasher-when-MusicBrainz-can-t-read-a-disc.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=601524
# https://bugzilla.gnome.org/show_bug.cgi?id=602957
Patch3: rb-playbin2-track-changes.patch

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: libgpod-devel 
BuildRequires: libgnomeui-devel >= 2.18.0
BuildRequires: brasero-devel
BuildRequires: gstreamer-plugins-base-devel >= 0.10
BuildRequires: gettext, rarian-compat
BuildRequires: totem-pl-parser-devel
BuildRequires: sqlite3-devel
BuildRequires: libffi-devel
BuildRequires: gnome-vfs2-devel >= 2.18.0
BuildRequires: avahi-glib-devel >= 0.6
BuildRequires: libmusicbrainz-devel >= 2.1.0
BuildRequires: libnotify-devel
BuildRequires: libsexy-devel
BuildRequires: libgudev1-devel
BuildRequires: libsoup-devel
BuildRequires: dbus-devel >= 1.0
BuildRequires: dbus-glib-devel
BuildRequires: gnome-doc-utils >= 0.3.2
BuildRequires: python-devel, pygtk2-devel
BuildRequires: check >= 0.8.2
BuildRequires: intltool >= 0.35.0
BuildRequires: gstreamer-python
BuildRequires: popt-devel
BuildRequires: lirc
BuildRequires: libmtp-devel
BuildRequires: libgnome-keyring-devel >= 2.30.0
BuildRequires: gnome-media
BuildRequires: libSM-devel
Requires: libgpod
Requires: libnotify
Requires: libsexy
Requires: lirc
Requires: libmtp
Requires: libgnomeui
Requires: brasero
Requires: gnome-python gnome-vfs2
Requires: gnome-themes
Requires: libgnome-keyring
Requires: gstreamer-python
%if %{enable_DLNA_UPnP}
Requires: python-Coherence
%endif
Requires: desktop-file-utils >= %{desktop_file_utils_version}
Requires: scrollkeeper GConf2

# # gstreamer-plugins-ffmpeg and gstreamer-plugins-ugly package provided by 
# # self-build-gstreamer-plugins-ffmpeg and self-build-gstreamer-plugins-ugly, 
# # respectively. 
# Requires: self-build-gstreamer-plugins-ffmpeg
# Requires: self-build-gstreamer-plugins-ugly


%description
Rhythmbox is an integrated music management application based on the powerful
GStreamer media framework. It has a number of features, including an easy to
use music browser, searching and sorting, comprehensive audio format support
through GStreamer, Internet Radio support, playlists and more.

Rhythmbox is extensible through a plugin system.

%description -l ja
Rhythmbox は、強力な GStreamer メディアフレームワークに基づいている
統合音楽管理アプリケーションです。
見やすいユーザインターフェースを備え、検索や整列ができ、
GStreamer により数多くの音声フォーマットをサポート、
インターネットラジオをサポート、プレイリスト管理などの
数多くの特徴を持ちます。

%prep
%setup -q
%patch0 -p1 -b .http-head
## %patch1 -p1 -b .webkit
## %patch2 -p1 -b .mb-crasher
## %patch3 -p1 -b .track-change-hang
# autoreconf -i

# Use the installed louie, not the one in Coherence
find plugins/coherence/upnp_coherence/ -type f \
    -exec %__sed -i 's/coherence.extern.louie as louie/louie/' '{}' ';'

%build
# work around a gstreamer bug
/usr/bin/gst-inspect-0.10 --print-all >& /dev/null || :

%configure --with-ipod \
    --with-mtp \
    --with-dbus \
    --with-mdns=avahi \
    --with-libnautilus-burn \
    --with-cd-burning \
    --with-metadata-helper \
    --enable-lirc \
    --enable-python \
    --disable-vala \
    --disable-browser-plugin \
    --disable-static \
    --disable-scrollkeeper \
    --disable-schemas-install \
    --without-hal
%__make %{?_smp_mflags}

%install
%__rm -rf $RPM_BUILD_ROOT
export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1
%__make install DESTDIR=$RPM_BUILD_ROOT 
unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL

%__rm -f $RPM_BUILD_ROOT%{_libdir}/bonobo/*.{a,la}
%__rm -f $RPM_BUILD_ROOT%{_libdir}/bonobo/librb-nautilus-context-menu.so
%__rm -f $RPM_BUILD_ROOT%{_libdir}/lib*.{a,la}
%__rm -f $RPM_BUILD_ROOT%{_libdir}/rhythmbox/plugins/*.{a,la}
%__rm -f $RPM_BUILD_ROOT%{_libdir}/rhythmbox/plugins/*/*.{a,la}
%__rm -f $RPM_BUILD_ROOT%{_libdir}/librhythmbox-core.{a,la}
%__rm -f $RPM_BUILD_ROOT%{_libdir}/mozilla/plugins/*.{a,la}

## Don't package DLNA/UPnP plugin
%if !%{enable_DLNA_UPnP}
%__rm -rf $RPM_BUILD_ROOT%{_libdir}/rhythmbox/plugins/upnp_coherence
%endif

%find_lang %{name}


# Don't package api docs
%__rm -rf $RPM_BUILD_ROOT%{_datadir}/gtk-doc/

# Don't package scrollkeeper catalogs
%__rm -rf $RPM_BUILD_ROOT%{_localstatedir}

# And don't package vala
%__rm -f %{buildroot}%{_libdir}/rhythmbox/plugins/libsample-vala.so \
	%{buildroot}%{_libdir}/rhythmbox/plugins/sample-vala.rb-plugin

# save space by linking identical images in translated docs
helpdir=$RPM_BUILD_ROOT%{_datadir}/gnome/help/%{name}
for f in $helpdir/C/figures/*.png; do
  b="$(basename $f)"
  for d in $helpdir/*; do
    if [ -d "$d" -a "$d" != "$helpdir/C" ]; then
      g="$d/figures/$b"
      if [ -f "$g" ]; then
        if cmp -s $f $g; then
          %__rm "$g"; ln -s "../../C/figures/$b" "$g"
        fi
      fi
    fi
  done
done


%clean
%__rm -rf $RPM_BUILD_ROOT

%post 
/sbin/ldconfig
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-install-rule %{_sysconfdir}/gconf/schemas/rhythmbox.schemas >/dev/null
update-desktop-database -q
scrollkeeper-update -q
touch --no-create %{_datadir}/icons/hicolor
if [ -x /usr/bin/gtk-update-icon-cache ]; then
  gtk-update-icon-cache -q %{_datadir}/icons/hicolor
fi

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

%postun
/sbin/ldconfig
update-desktop-database -q
scrollkeeper-update -q
touch --no-create %{_datadir}/icons/hicolor
if [ -x /usr/bin/gtk-update-icon-cache ]; then
  gtk-update-icon-cache -q %{_datadir}/icons/hicolor
fi


%files -f %{name}.lang
%defattr(-, root, root)
%doc AUTHORS COPYING ChangeLog README NEWS
%{_sysconfdir}/gconf/schemas/rhythmbox.schemas
%{_bindir}/*
%{_libdir}/lib*.so*
%{_libdir}/rhythmbox/plugins
%{_datadir}/applications/rhythmbox.desktop
%{_datadir}/dbus-1/services/org.gnome.Rhythmbox.service
%{_datadir}/gnome/help/rhythmbox
%{_datadir}/icons/*
%{_datadir}/omf/rhythmbox
%{_datadir}/rhythmbox
%{_mandir}/man1/*
%{_libexecdir}/rhythmbox-metadata


%changelog
* Sun Mar 14 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.12.7-1
- new upstream release
- drop Patch1, Patch2, Patch3
- change BuildRequires: nautilus-cd-burner -> brasero-devel
- change Requires: nautilus-cd-burner -> brasero
- change BuildRequires: hal-devel -> libgudev1-devel
- change BuildRequires: gnome-keyring-devel -> libgnome-keyring-devel
- change Requires: gnome-keyring -> libgnome-keyring
- add configure option (--without-hal)

* Mon Feb 15 2010 Shu KONNO <owa@bg.wakwak.com> 0.12.6-2
- rebuilt with new environment

* Thu Jan 14 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.12.6-1
- new upstream release
  - dropped upstreamed/obsolete patches
  - added patches applied Fedora development

* Sun Oct 04 2009 Munehiro Yamamoto <munepi@vinelinux.org> 0.12.5-1
- new upstream release
- added configure options: 
  --disable-vala
  --disable-browser-plugin

* Thu Jul 30 2009 Munehiro Yamamoto <munepi@vinelinux.org> 0.12.2-2
- added Japanese description

* Thu Jul 02 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.12.2-1
- new upstream release
  - dropped rb-disable-power-plugin-by-default.patch
- added BuildRequires: 
  - libSM-devel
  - gnome-media

* Wed Jun 10 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 0.12.1-2
- rebuild with libgpod-0.7.2

* Sun May 03 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.12.1-1
- new upstream release
- corrected License tag
- dropped rhythmbox-0.11.6-libmtp.patch
- added BuildRequires: 
  - sqlite3-devel
  - libffi-devel

* Sat Jan 10 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.11.6-2
- defined enable_DLNA_UPnP = 0: unpacked DLNA/UPnP plugin
- applied rhythmbox-0.11.6-libmtp.patch
- added Requires: 
  - libgpod
  - libnotify
  - libsexy
  - lirc
  - libmtp
  - libgnomeui
  - nautilus-cd-burner
  - gstreamer-python
  - gnome-vfs2
  - gnome-themes
  - gnome-keyring
  - python-Coherence, if enable_DLNA_UPnP = 1
- added BuildRequires: 
  - libnotify-devel
  - libsexy-devel
  - lirc
  - libmtp-devel
  - gnome-vfs2-devel, instead of gnome-vfs2
  - gnome-keyring-devel
- dropped --with-internal-libsexy in configure options
- added in configure options: 
  --with-mtp --with-libnautilus-burn --enable-lirc --disable-static
- added %%preun to remove the schema

* Sun Jan 04 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.11.6-1
- new upstream release
- changed to --with-metadata-helper in configure options
- added BuildRequires: 
  - gstreamer-python
  - intltool >= 0.35.0
  - popt-devel

* Sat Aug 09 2008 Shu KONNO <owa@bg.wakwak.com> 0.11.2-1vl5
- added BuildRequires: totem-pl-parser-devel, instead of totem-devel
- rebuilt with python-2.5.2
- applied new versioning policy
- spec in utf-8

* Sun Jan 06 2008 Shu KONNO <owa@bg.wakwak.com> 0.11.2-0vl2
- rebuilt with libgpod-0.6.0

* Sun Aug 26 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.11.2-0vl1
- new upstream release

* Wed Jun 27 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.11.1-0vl1
- new upstream release

* Tue May 29 2007 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 0.10.0-0vl2
- rebuilt with new toolchain and libgpod-0.4.2
- add BuildRequires: dbus-glib-devel

* Sat Apr 28 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 0.10.0-0vl1
- new upstream release

* Wed Mar 21 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.9.8-0vl2
- rebuilt for VineSeed

* Wed Mar 21 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.9.8-0vl1
- new upstream release
- added --enable-python option to %%configure
- added Requires: gnome-python

* Sun Jan 21 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.9.7-0vl1
- new upstream release
- built with libsoup 2.2.99

* Thu Nov 23 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.9.6-0vl4
- added --with-cd-burner to configure
- added BuildRequires: libsexy-devel hal-devel libsoup-devel

* Wed Oct 25 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 0.9.6-0vl3
- add BuildRequires:
  - gnome-doc-utils >= 0.3.2
  - python-devel
  - pygtk2-devel
  - check >= 0.8.2

* Tue Oct 24 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 0.9.6-0vl2
- rebuild with gnutls-1.4.1

* Sun Oct  1 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.9.6-0vl1
- new upstream release

* Mon Jun 19 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.9.5-0vl1
- new upstream release
- run scrollkeeper-update at %post and %postun
- added BuildRequires: libnotify-devel

* Sun May 14 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.9.4.1-0vl1
- new upstream release (dropped patch0)
- added --without-metadata-helper at configure

* Mon Mar 13 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 0.9.3.1-0vl1
- Initial build for Vine Linux based on FC pacakge

* Fri Mar 03 2006 Ray Strode <rstrode@redhat.com> - 0.9.3.1-2
- add patch from James "Doc" Livingston to stop a hang
  for new users (bug 183883)

* Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 0.9.3.1-1.2
- bump again for double-long bug on ppc(64)

* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 0.9.3.1-1.1
- rebuilt for new gcc4.1 snapshot and glibc changes

* Sat Feb  4 2006 Christopher Aillon <caillon@redhat.com> 0.9.3.1-1
- Update to 0.9.3.1
- Use gstreamer (0.10)

* Wed Feb  1 2006 Christopher Aillon <caillon@redhat.com> 0.9.3-2
- Remove hack for 173869, as its no longer needed.

* Wed Feb  1 2006 Christopher Aillon <caillon@redhat.com> 0.9.3-1
- 0.9.3

* Wed Feb  1 2006 Christopher Aillon <caillon@redhat.com> 0.9.2.cvs20060201-1
- Newer CVS snapshot

* Sun Jan 22 2006 Christopher Aillon <caillon@redhat.com> 0.9.2.cvs20060123-1
- Update to latest CVS
- Add hack to workaround bug #173869

* Thu Jan 19 2006 Christopher Aillon <caillon@redhat.com> 0.9.2-8
- Rebuild, now that gstreamer08-plugins has been fixed

* Thu Jan 19 2006 Ray Strode <rstrode@redhat.com> 0.9.2-7
- bonobo multilib issue (bug 156982)

* Wed Jan 04 2006 John (J5) Palmieri <johnp@redhat.com> 0.9.2-5
- rebuild with ipod support

* Tue Jan 03 2006 Jesse Keating <jkeating@redhat.com> 0.9.2-4
- rebuilt again

* Fri Dec 09 2005 Jesse Keating <jkeating@redhat.com>
- rebuilt

* Mon Dec  5 2005 Matthias Clasen <mclasen@redhat.com>
- rebuild

* Thu Dec 01 2005 John (J5) Palmieri <johnp@redhat.com>
- rebuild for new dbus

* Wed Nov 30 2005 Matthias Clasen <mclasen@redhat.com>
- Update to 0.9.2

* Tue Oct 25 2005 Matthias Clasen <mclasen@redhat.com>
- Update to 0.9.1

* Fri Sep 02 2005 Colin Walters <walters@redhat.com> 
- Add configure flags --with-bonobo --with-dbus
- BR nautilus-cd-burner-devel
- New upstream CVS snapshot for testing
- Drop IDL file and ui .xml
- Add dbus service file
- Drop upstreamed rhythmbox-bluecurve.tar.gz
- Drop upstreamed rhythmbox-0.8.8-cell-renderer.patch

* Fri Jun 13 2005 Colin Walters <walters@redhat.com> - 0.8.8-3
- Add Bluecurve-ized icons from Jeff Schroeder (157716)
- Add rhythmbox-0.8.8-cell-renderer.patch to remove use of custom
  cell renderer for playback icon (no longer necessary) and
  changes the rating renderer to work with non-b&w icons

* Mon Mar 14 2005 Colin Walters <walters@redhat.com> - 0.8.8-2
- Rebuild for GCC4

* Tue Oct 05 2004 Colin Walters <walters@redhat.com> - 0.8.8-1
- New upstream version
- Remove librb-nautilus-context-menu.so, killed upstream

* Thu Sep 30 2004 Christopher Aillon <caillon@redhat.com> 0.8.7-2
- PreReq desktop-file-utils >= 0.9

* Sat Sep 29 2004 Colin Walters <walters@redhat.com> - 0.8.7-1
- New upstream version

* Sat Sep 18 2004 Colin Walters <walters@redhat.com> - 0.8.6-2
- Fix postun to use correct syntax, thanks Nils Philippsen

* Sat Sep 18 2004 Colin Walters <walters@redhat.com> - 0.8.6-1
- New upstream version
- Call update-desktop-database in post and postun

* Thu Jun 24 2004 Colin Walters <walters@redhat.com> - 0.8.5-1
- New upstream version

* Tue Jun 15 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt

* Tue May 18 2004 Colin Walters <walters@redhat.com> - 0.8.4-1
- New upstream version
- Remove backported patches
- Gratuitiously bump various BuildRequires versions

* Mon May 10 2004 Colin Walters <walters@redhat.com> - 0.8.3-4
- Remove code to unregister GConf schema for now (Closes: #122532)

* Thu May 07 2004 Colin Walters <walters@redhat.com> - 0.8.3-3
- Apply tiny patch from 0.8 arch to fix GConf key used
  for initial sorting

* Thu May 07 2004 Colin Walters <walters@redhat.com> - 0.8.3-2
- Apply patch from 0.8 arch tree to fix a number of memleaks

* Thu May 02 2004 Colin Walters <walters@redhat.com> - 0.8.3-1
- Update to 0.8.3: fixes showstopper bug with internet radio

* Thu Apr 30 2004 Colin Walters <walters@redhat.com> - 0.8.2-1
- Update to 0.8.2
- Fix Source url
- Add smp_mflags
- Bump BuildRequires on gstreamer to 0.8.1

* Tue Apr 23 2004 Colin Walters <walters@redhat.com> - 0.8.1-2
- Uninstall GConf schemas on removal

* Tue Apr 20 2004 Colin Walters <walters@redhat.com> - 0.8.1-1
- Update to 0.8.1

* Fri Apr 16 2004 Colin Walters <walters@redhat.com> - 0.8.0-1
- Update to 0.8.0

* Fri Apr 02 2004 Colin Walters <walters@redhat.com> - 0.7.2-1
- Update to 0.7.2

* Mon Mar 29 2004 Colin Walters <walters@redhat.com> - 0.7.1-2
- Remove BuildRequires on autoconf and libvorbis-devel

* Mon Mar 29 2004 Colin Walters <walters@redhat.com> - 0.7.1-1
- New major version - I know we are past major version slush, but
  this should have been done two weeks ago along with the GNOME 2.6
  upload.  As upstream author as well, I believe this version is
  good enough for FC2.
- Remove --disable-mp3
- Remove id3, flac variables
- Remove GStreamer major version patch
- Fix typo in description

* Tue Mar 16 2004 Jeremy Katz <katzj@redhat.com> - 0.6.8-2
- rebuild for new gstreamer

* Thu Mar 11 2004 Alex Larsson <alexl@redhat.com> 0.6.8-1
- update to 0.6.8

* Tue Mar 02 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt

* Mon Mar  1 2004 Alexander Larsson <alexl@redhat.com> 0.6.7-1
- update to 0.6.7

* Fri Feb 13 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt

* Mon Jan 12 2004 Colin Walters <walters@verbum.org> 0.6.4-1
- New upstream version
- Don't re-run the autotools; upstream incorporates newer versions.
* Tue Oct 28 2003 Jonathan Blandford <jrb@redhat.com> 0.5.4-1
- new version
- remove smp_flags

* Fri Oct 24 2003 Jonathan Blandford <jrb@redhat.com> 0.5.3-5
- remove the initial iradio channels as they all are mp3 based.

* Wed Oct  8 2003 Matthias Saou <matthias@rpmforge.net> 0.5.3-3
- Fix category from Development/Libraries to Applications/Multimedia.
- Use bz2 instead of gz as ftp.gnome.org has both, 300k saved in the src.rpm.
- Fix SCHEMES vs. SCHEMAS in the post scriplet.
- Added gstreamer-plugins-devel, libvorbis-devel, scrollkeeper and gettext deps.
- Removed unnecessary date expansion define.
- Updated description, including mp3 reference removal.
- Added libid3tag and flac optional support for convenient rebuild.
- Removed obsolete omf.make and xmldocs.make (included ones are the same now).

* Mon Sep 22 2003 Jonathan Blandford <jrb@redhat.com> 0.5.3-1
- new version
- use %{_sysconfdir} instead of /etc

* Wed Jan 22 2003 Tim Powers <timp@redhat.com>
- rebuilt

* Wed Dec 18 2002 Jonathan Blandford <jrb@redhat.com>
- gave up on other archs for the Beta
- new version
- remove werror and add missing files

* Thu Nov  7 2002 Jeremy Katz <katzj@redhat.com>
- update to newer cvs snap

* Mon Sep 23 2002 Jeremy Katz <katzj@redhat.com>
- update to cvs snap

* Sun Sep 22 2002 Jeremy Katz <katzj@redhat.com>
- use %%(lang)

* Sun Aug 11 2002 Jeremy Katz <katzj@redhat.com>
- fix post to actually install the schema

* Sat Jun 22 2002 Christian F.K. Schaller <Uraeus@linuxrising.org>
- Added gconf file
- Added i18n directory

* Sat Jun 15 2002 Christian F.K. Schaller <Uraeus@linuxrising.org>
- Updated for new rewrite of rhythmbox, thanks to Jeroen

* Mon Mar 18 2002 Jorn Baayen <jorn@nl.linux.org>
- removed bonobo dependency
* Sat Mar 02 2002 Christian Schaller <Uraeus@linuxrising.org>
- created new spec file