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

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

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

Vendor: Project Vine
Distribution: Vine Linux

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

## Mandriva/upstreamable patches

## Ubuntu/upstreamable patches

## Upstream patches

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: automoc4
BuildRequires: cmake
BuildRequires: extra-cmake-modules
BuildRequires: glib2-devel
BuildRequires: gstreamer1-devel
BuildRequires: gstreamer1-plugins-base-devel
BuildRequires: libxml2-devel
BuildRequires: mesa-libGL-devel
BuildRequires: phonon-devel >= %{phonon_version}
BuildRequires: qt4-devel >= 4.6.0
BuildRequires: pkgconfig(phonon4qt5) >= 4.7.80
BuildRequires: pkgconfig(QtOpenGL)
BuildRequires: pkgconfig(Qt5OpenGL)
BuildRequires: pkgconfig(Qt5X11Extras)

# vine patch


Provides: phonon-backend%{?_isa} = %{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: gstreamer1-plugins-good
# not *strictly* required, but strongly recommended by upstream when built
# with USE_INSTALL_PLUGIN
#Requires: PackageKit-gstreamer-plugin
Requires: phonon%{?_isa} >= %{phonon_version}
Requires: qt4 >= %{_qt4_version}

%description
%{summary}.

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


%package -n phonon-qt5-backend-gstreamer
Summary:  Gstreamer phonon-qt5 backend
Provides: phonon-qt5-backend%{?_isa} = %{phonon_version}
%{?_qt5_version:Requires: qt5-qtbase%{?_isa} >= %{_qt5_version}}
Requires: gstreamer1-plugins-good
%description -n phonon-qt5-backend-gstreamer
%{summary}.


%prep
%autosetup -n phonon-gstreamer-%{version} -p1


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

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

mkdir -p %{_target_platform}-Qt5
pushd %{_target_platform}-Qt5
%cmake \
  -DCMAKE_BUILD_TYPE:STRING="Release" \
  -DUSE_INSTALL_PLUGIN:BOOL=ON \
  -DPHONON_BUILD_PHONON4QT5:BOOL=ON \
  ..
popd

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


%install
rm -rf $RPM_BUILD_ROOT

make install/fast DESTDIR=%{buildroot} -C %{_target_platform}-Qt5
make install/fast DESTDIR=%{buildroot} -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,-)
%license COPYING.LIB
%{_libdir}/kde4/plugins/phonon_backend/phonon_gstreamer.so
%{_datadir}/kde4/services/phononbackends/gstreamer.desktop
%{_datadir}/icons/hicolor/*/apps/phonon-gstreamer.*

%files -n phonon-qt5-backend-gstreamer
%license COPYING.LIB
%{_qt5_plugindir}/phonon4qt5_backend/phonon_gstreamer.so


%changelog
* Tue Jul 12 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 4.9.0-1
- new upstream release.

* Thu Jun 30 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 4.8.2-3
- added Patch1000.

* Thu Jun 30 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 4.8.2-2
- rebuilt with new toolchain.

* Sat Jan 24 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 4.8.2-1
- new upstream release

* Fri Nov  7 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 4.8.0-1
- new upstream release

* Sun Jun  5 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.5.1-1
- new upstream release

* 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

