# Qt4 version auto-detection -- inagaki
%define qtver %(pkg-config --modversion --silence-errors Qt 2>/dev/null || echo 4.6.1)

%if "%{?_dist_release}" >= "vl7"
%define qt4qmake %{_bindir}/qmake
%else
%define qt4qmake %{_libdir}/qt-%{qtver}/bin/qmake
%endif

# Move original binary to libexec dir and replace it by wrapper script
%define MINITUBE_BIN %{_libexecdir}/%{name}

Summary:	Native YouTube Client
Summary(ja): 	YouTube 専用クライアント
Name:		minitube
Version:	1.7
Release: 	1%{?_dist_release}
Source0:	http://flavio.tordini.org/files/minitube/minitube.tar.gz
Source10:	minitube.sh
Source20:	minitube-ja.desktop
License:	GPLv3+
Group:		Applications/Multimedia
URL:		http://flavio.tordini.org/minitube

Requires:	phonon-backend-gstreamer
Requires(post):	desktop-file-utils
Requires(postun):desktop-file-utils
BuildRequires:	qt4-devel > 4.5
BuildRequires:	qt4-designer
BuildRequires:	phonon-devel
BuildRequires:	python-devel
BuildRoot:	%{_tmppath}/%{name}-%{version}-root

Vendor:		Project Vine
Distribution:	Vine Linux

%description
Minitube is a native YouTube client. With it you can watch
YouTube videos in a new way: you type a keyword, Minitube 
gives you an endless video stream. Minitube does not require
the Flash Player.

Minitube is not about cloning the original YouTube web interface,
it aims to create a new TV-like experience.

You should install following packages to play videos.
 - self-build-gstreamer-plugins-bad
 - self-build-gstreamer-plugins-ffmpeg

%description -l ja
Minitube は YouTube の新しい視聴方法を提案する、専用のクライ
アントソフトウェアです。キーワードを入力すると、Minitube は
関連する動画をエンドレスで再生します。
また Minitube を使うと Flash Player 無しでビデオが再生できます。

Minitube は YouTube のウェブインターフェースのクローンでは無
く、新たなテレビ風の視聴スタイルを目指しています。

ビデオの再生には以下のパッケージが必要となります。併せてイン
ストールしてください。
 - self-build-gstreamer-plugins-bad
 - self-build-gstreamer-plugins-ffmpeg


%prep
%setup -q -n %{name}


%build
%{qt4qmake} prefix=%{_prefix}
%{__make} %{?_smp_mflags}


%install
%{__rm} -rf $RPM_BUILD_ROOT
%{__make} install INSTALL_ROOT=$RPM_BUILD_ROOT

## wrapper
%{__mkdir_p} $RPM_BUILD_ROOT%{_libexecdir}
%{__mv} $RPM_BUILD_ROOT%{_bindir}/%{name} $RPM_BUILD_ROOT%{MINITUBE_BIN}
%{__install} -m 755 %{SOURCE10}  $RPM_BUILD_ROOT%{_bindir}/%{name}

# desktop file with japanese messages
%{__install} -m 644 %{SOURCE20}  $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop

%clean
%{__rm} -rf $RPM_BUILD_ROOT


%post
update-desktop-database %{_datadir}/applications>& /dev/null ||:
touch --no-create %{_datadir}/icons/hicolor
if [ -x /usr/bin/gtk-update-icon-cache ]; then
  /usr/bin/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor ||:
fi


%postun
update-desktop-database %{_datadir}/applications>& /dev/null ||:
touch --no-create %{_datadir}/icons/hicolor
if [ -x /usr/bin/gtk-update-icon-cache ]; then
  /usr/bin/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor ||:
fi


%files
%defattr(-,root,root)
%doc AUTHORS COPYING CHANGES INSTALL TODO
%{MINITUBE_BIN}
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor
%{_datadir}/%{name}/locale


%changelog
* Fri Jan 20 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.7-1
- new upstream release

* Thu Nov 03 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.6-1
- new upstream release

* Fri Aug 12 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.5-1
- new upstream release

* Wed May 18 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.4.3-1
- new upstream release

* Mon Dec 13 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.3-1
- new upstream release

* Fri Jul 30 2010 Kazutaka HARADA <kazutaka@vinelinux.org> 1.1-1
- new upstream release

* Sat May 29 2010 Kazutaka HARADA <kazutaka@vinelinux.org> 1.0-1
- initial build for Vine Linux
- add minitube.desktop with japanese translation
- add wrapper script to check necessary packages at runtime
