%global phonon_version %(pkg-config --modversion phonon 2>/dev/null || echo 4.4.4)
%global _qt4_version %(pkg-config --modversion --silence-errors Qt 2>/dev/null || echo 4.7.1)

Name:    phonon-backend-gstreamer
Summary: Gstreamer phonon backend 
Summary(ja): Phonon の gstreamer バックエンド
Version: 4.4.4
Release: 2%{?_dist_release}

Group:   System Environment/Libraries
License: LGPLv2+
URL:     http://phonon.kde.org/

Source0: ftp://ftp.kde.org/pub/kde/stable/phonon/phonon-backend-gstreamer/%{version}/src/phonon-backend-gstreamer-%{version}.tar.bz2

## Mandriva/upstreamable patches
Patch52: phonon-4.3.50-gstreamer-fix-seekable-query-failed.patch

## Ubuntu/upstreamable patches
Patch60: phonon-4.4.3-flac_mimetype.patch

## Upstream patches

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

BuildRequires: automoc4
BuildRequires: cmake
BuildRequires: gstreamer-devel
BuildRequires: gstreamer-plugins-base-devel
BuildRequires: phonon-devel >= 4.4.4

Provides: phonon-backend = %{phonon_version}

Obsoletes: phonon-backend-gst < 4.2.0-4
Provides:  phonon-backend-gst = %{version}-%{release}

Obsoletes: phonon-gstreamer < 4.4.4-0.2
Provides:  phonon-gstreamer = %{version}-%{release}

Requires: gstreamer-plugins-good
# not *strictly* required, but strongly recommended by upstream when built
# with USE_INSTALL_PLUGIN
#Requires: PackageKit-gstreamer-plugin
Requires: phonon => %{phonon_version}
Requires: qt4 >= %{_qt4_version}

%description
%{summary}.

%description -l ja
Phonon の gstreamer バックエンドです.

%prep
%setup -q -n phonon-backend-gstreamer-%{version}

%patch52 -p1 -b .gstreamer-fix-seekable-query-failed
%patch60 -p1 -b .flac_mimetype


%build
mkdir -p %{_target_platform}
pushd %{_target_platform}
%{cmake} \
  -DUSE_INSTALL_PLUGIN:BOOL=ON \
  ..
popd

make %{?_smp_mflags} -C %{_target_platform}


%install
rm -rf $RPM_BUILD_ROOT

make install/fast DESTDIR=$RPM_BUILD_ROOT -C %{_target_platform}


%clean
rm -rf $RPM_BUILD_ROOT


%post
touch --no-create %{_datadir}/icons/hicolor &> /dev/null ||:

%postun
if [ $1 -eq 0 ] ; then
    touch --no-create %{_datadir}/icons/hicolor &> /dev/null ||:
    gtk-update-icon-cache %{_datadir}/icons/hicolor &> /dev/null ||:
fi

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


%files
%defattr(-,root,root,-)
%doc COPYING.LIB
%{_libdir}/kde4/plugins/phonon_backend/phonon_gstreamer.so
%{_datadir}/kde4/services/phononbackends/gstreamer.desktop
%{_datadir}/icons/hicolor/*/apps/phonon-gstreamer.*


%changelog
* Sun Jan 30 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.4.4-2
- Initial build for VineSeed 

* Fri Jan 21 2011 Rex Dieter <rdieter@fedoraproject.org> 4.4.4-1
- phonon-backend-gstreamer-4.4.4

* Fri Jan 07 2011 Rex Dieter <rdieter@fedoraproject.org> - 2:4.4.4-0.4.20110104
- Requires: PackageKit-gstreamer-plugin , avoids potential crashers elsewhere 
  when built with USE_INSTALL_PLUGIN (kde#262308)

* Wed Jan 05 2011 Rex Dieter <rdieter@fedoraproject.org> - 2:4.4.4-0.3.20110104
- %%doc COPYING.LIB
- add comment on pnonon-gstreamer_snapshot.sh usage

* Wed Jan 05 2011 Rex Dieter <rdieter@fedoraproject.org> - 2:4.4.4-0.2.20110104
- phonon-backend-gstreamer

* Tue Jan 04 2011 Rex Dieter <rdieter@fedoraproject.org> - 4.4.4-0.1.20110104
- phonon-gstreamer-4.4.4-20110104 snapshot

