%define pkgname mplayer
%define name	self-build-%{pkgname}
%define version 1.0
%define extver	rc2
#% define release	4%{?extver:.%{extver}}%{?_dist_release}
%define svndate  20100401
%define release	33.%{svndate}%{?_dist_release}


Summary:	Package to automatically build %{pkgname} rpm package
Summary(ja): 	%{pkgname} の rpm パッケージを自動作成するパッケージ
Name:		%{name}
Version:	%{version}
Release: 	%{release}
Source0:	%{pkgname}-vl.spec
Source1:	%{pkgname}-snapshot.sh

Source11:	%{pkgname}-export-%{svndate}.tar.bz2
Source12:	Blue-1.7.tar.bz2

Source102:        %{pkgname}-config.patch
Source108:        %{pkgname}-manlinks.patch
Source110:        %{pkgname}-qcelp.patch
Source114:        %{pkgname}-nodvdcss.patch

License:	GPLv2+
Group:		Restricted Software

Requires(post):		self-build-setup >= 0.9.9
#Requires(post):		subversion

# (build)requies of target package.
Requires(post):		gtk2-devel
Requires(post):		freetype2-devel
Requires(post):		SDL-devel
Requires(post):		alsa-lib-devel
Requires(post):		esound-devel
Requires(post):		cdparanoia-devel
Requires(post):		libvorbis-devel
Requires(post):		libjpeg-devel
Requires(post):		libpng-devel
Requires(post):		giflib-devel
Requires(post):		zlib-devel
Requires(post):		libdvdread
Requires(post):		libmpcdec-devel
Requires(post):		twolame-devel
Requires(post):		yasm
Requires(post):		libvdpau-devel
Requires(post):		libXScrnSaver-devel
Requires(post):		self-build-mplayer-codecs
Requires(post):		self-build-libdvdcss
Requires(post):		self-build-libdvdnav
Requires(post):		self-build-faac
Requires(post):		self-build-faad2 >= 2.6
Requires(post):		self-build-lame
Requires(post):		self-build-libdca
Requires(post):		self-build-libmad
Requires(post):		self-build-x264 >= 0.0.0-9.20090522
Requires(post):		self-build-xvidcore >= 0.9.2
Requires:	TrueType-vlgothic
%if %{?_dist_release} == "vl5" || %{?_dist_release} == "vl6"
Requires:	mesa-libGL
Requires(post):		xorg-x11-devel 
Requires(post):		mesa-libGL-devel
%endif
%if %{?_dist_release} == "vl4"
Requires:	XOrg-gl
Requires(post):		XOrg-devel 
Requires(post):		XOrg-gl-devel
%endif

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

Packager:	munepi

%description
MPlayer is the movie player.

If you install this package, it automaticaly downloads source
code ,compile it, and create rpm packages of %{pkgname}-%{version}%{extver}.
And the created rpm packages are automatically installed
if installation is executed by apt-get command or synaptic
package manager.

Additional function is automatically included if following 
packages are installed in advance.

#lirc: remote control support
#lame-devel: mp3 encoding
samba-libsmbclient-devel: SMB file system support

#xorg-x11-drv-nvidia: VDPAU support

[Note]
This package requires many other packages to compile
targetsoftware. So it consume more disk space than usual.
Also installation takes logner time because of compilation.
(This will take a few minutes to quarter or half of an hour,
depends on building environment)

[About self-build package]
For some kind of software, distributing of binary package
may viorate the patent or law. Therefore we chose self-build
packge, create binary package on your machine, for such kind
of softwares instead of distributing binary package.

Please obey the national law when you use the created binary
packages. And if you want to use the softwares using patented 
thechnology, it may be required to get a permission, make an 
agreement or purchas a license. Please consider it with your
purpose or way of use and take appropriate action.

%description -l ja
MPlayer は動画プレイヤーです。

このパッケージをインストールすると、自動的にソースコードを
ダウンロードしてコンパイルし、%{pkgname}-%{version}%{extver}
の rpm パッケージを作成します。
また apt-get コマンドや synaptic パッケージマネージャから実行
した場合は、作成された rpm パッケージのインストールも自動的に
行います。

このパッケージより前に以下の関連パッケージをインストールして
おくと、%{pkgname} が対応できる機能が自動的に追加されます。

#lirc: リモコンのサポート
#lame-devel: mp3 へのエンコード
samba-libsmbclient-devel: SMB ファイルシステムのサポート
xorg-x11-drv-nvidia: VDPAU support

[注意]
コンパイルに必要な多くの関連パッケージを要求するので通常より
ディスクの領域を多く消費します。
またインストール時にコンパイルを行うため、通常より時間がかか
る場合があります。(環境にもよりますが数分から数十分程度)

[self-build パッケージについて]
ソフトウェアによってはバイナリパッケージの配布が特許や法律に
違反する可能性があるものがあります。その為、このような問題が
懸念されるソフトウェアについてはバイナリパッケージを直接配布
せずに、ユーザの環境でバイナリを作成する self-build パッケー
ジという方法を採っています。

作成されたバイナリパッケージの利用にあたっては、各ソフトウェ
アのライセンス、および利用する国の各種法令に従ってください。
また特許に関連するソフトウェアの場合、利用許諾や契約、ライ
センスの購入などが必要となる場合がありますので、利用する目的
や形態に応じて各自で判断し適切な対応を取ってください。


%prep
[ "%{version}-%{release}" != $(rpm -q --queryformat "%%{version}-%%{release}\n" --specfile %{SOURCE0} | tail -1) ] && exit 1

%install
%{__rm} -rf ${RPM_BUILD_ROOT}
%{__install} -d ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
%{__install} -m 644 %{SOURCE0} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
%{__install} -m 644 %{SOURCE11} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
%{__install} -m 644 %{SOURCE12} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
%{__install} -m 644 %{SOURCE102} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
%{__install} -m 644 %{SOURCE108} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
%{__install} -m 644 %{SOURCE110} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
%{__install} -m 644 %{SOURCE114} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}


%clean
%{__rm} -rf ${RPM_BUILD_ROOT}

%posttrans
/usr/lib/rpm/self-build-rpm.sh %{name} %{pkgname}-vl.spec 1525000


%files
%defattr(-,root,root)
%{_datadir}/%{name}

%changelog
* Fri Apr 02 2010 Munehiro Yamamoto <munepi@vinelinux.org> 1.0-33.20100401
- updated source snapshot 20100401

* Thu Mar 18 2010 Munehiro Yamamoto <munepi@vinelinux.org> 1.0-31.20100317
- updated source snapshot 20100317
- renamed %%{Source0} to mplayer-vl.spec

* Wed Feb 17 2010 Munehiro Yamamoto <munepi@vinelinux.org> 1.0-30.20100216
- updated source snapshot 20100216
- dropped obsolete patches
- added Requires(post): libvdpau-devel libXScrnSaver-devel

* Sat Dec 26 2009 Munehiro Yamamoto <munepi@vinelinux.org> 1.0-28.20091031
- update mplayer-config-20091215-vine.patch
- update mplayer-20091215-x86_32-compile.patch

* Sun Nov 01 2009 Munehiro Yamamoto <munepi@vinelinux.org> 1.0-27.20091031
- source snapshot 20091031
  - updated mplayer-20091031-x86_32-compile.patch

* Sun Oct 04 2009 Munehiro Yamamoto <munepi@vinelinux.org> 1.0-26.20091003
- source snapshot 20091003

* Sun Sep 13 2009 Munehiro Yamamoto <munepi@vinelinux.org> 1.0-25.20090905
- added some if conditions for "vl6"

* Sun Sep 06 2009 Munehiro Yamamoto <munepi@vinelinux.org> 1.0-24.20090905
- source snapshot 20090905
- added settings for vl6

* Thu Aug 22 2009 Munehiro Yamamoto <munepi@vinelinux.org> 1.0-23.20090821
- source snapshot 20090821
- replaced BR: libungif-devel with BR: giflib-devel
- mentioned VDPAU support in %%description

* Thu Jul 23 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.0-22.20090722
- source snapshot 20090722

* Fri Jul 03 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.0-21.20090702
- source snapshot 20090702
- check version between original spec and self-build spec in %%prep

* Fri Jun 12 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.0-20.20090611
- source snapshot 20090611

* Sun Jun 07 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.0-19.20090522
- added Requires: TrueType-vlgothic

* Sat May 23 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.0-18.20090522
- source snapshot 20090522
  - build with x264 >= 0.0.0-9.20090522
  - updated mplayer-20090502-nodvdcss.patch
- avoided to execute self-build-rpm.sh on RPM transaction
  - moved %%post actions to %%posttrans

* Thu May 07 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.0-17.20090502
- added PreReq: self-build-mplayer-codecs

* Tue May 05 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.0-16.20090502
- added BuildArch: noarch
- source snapshot 20090502
- updated mplayer-20090503-x86_32-compile.patch
- updated mplayer-20090502-nodvdcss.patch

* Thu Apr 09 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.0-15.20090327
- included source archives: 
  - mplayer-export-20090327.tar.bz2
  - Blue-1.7.tar.bz2
- applied mplayer-config-vine.patch

* Sat Mar 28 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.0-14.20090327
- source snapshot 20090327
- updated mplayer-20090327-x86_32-compile.patch
- updated mplayer-20090325-nodvdcss.patch
- dropped gmplayer-about-vine.patch

* Sun Feb 08 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.0-10.20090206
- source snapshot 20090206
- dropped mplayer-man-zh_CN.patch
- updated mplayer-20090206-nodvdcss.patch
- changed to PreReq:  self-build-faad2 from faad2-devel
- added PreReq:  self-build-libmad

* Sun Feb 01 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.0-9.20090131
- source snapshot 20090131
- fixed %%files section

* Thu Jan 29 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.0-8.20090122
- fixed %%post: added rm -f "$pwd"/%{pkgname}-export-%{svndate}.tar.bz2

* Sun Jan 25 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.0-7.20090122
- source snapshot
- update mplayer-nodvdcss.patch: mplayer-20090122-nodvdcss.patch
- added PreReq:	
  - faad2-devel
  - libmpcdec-devel
  - twolame-devel
  - yasm
  - self-build-libdvdcss
  - self-build-libdvdnav
  - self-build-faac
  - self-build-lame
  - self-build-libdca
  - self-build-x264 >= 0.0.0-4.20090110
  - self-build-xvidcore >= 0.9.2
- move %%define source0Exists() from %%post section to header
- fixed %%post section: clean up source archive

* Sat Jan 10 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.0-6.20090109
- source snapshot
- added --disable-faac-lavc --disable-mp3lame-lavc --disable-x264-lavc 
  --disable-faad-internal in configure options
- dropped gmplayer-add-flv-extension.patch

* Sun Dec 14 2008 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.0-5.20081001
- source snapshot
- fixed License
- added some patches from RPM Fusion
- updated gmplayer-about-vine.patch for 20081001 snapshot
- added BuildRequires:	libdvdread
- added BuildRequires:	self-build-libdvdcss self-build-libdvdnav
- added --disable-dvdread-internal --enable-dvdread --enable-dvdnav
  in configure options
#- applied mplayer-avoid-Warning_MVs_not_available.patch for VineSeed
- added PreReq: subversion

* Mon Nov 17 2008 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.0-4.rc2
- fixed License
- added some devel packages to support OpenGL

* Sun Nov 02 2008 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.0-3.rc2
- spec in utf8
- fix sybolic link of subfont for vl5

* Wed May 07 2008 Atsushi SHICHI <ats777@gmail.com> 1.0-2.rc2vl4
- add "Source105: CVE-2008-1558.patch".

* Fri May 02 2008 Atsushi SHICHI <ats777@gmail.com> 1.0-1.rc2vl4
- build with new versioning policy.
- add "Source200: gmplayer-about-vine.patch".
- add "Source201: gmplayer-add-flv-extension.patch".
- fix <BTS:VineLinux:603>.
  - add ">= 0.7-1vl4" to "PreReq: self-build-setup".
  - add mirror URLs to self-build-rpm.sh.

* Sun Feb 17 2008 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.0-0vl0.3rc2
- add four official security patches (CVE-2008-0485, CVE-2008-0486, 
  CVE-2008-0629, CVE-2008-0630)
- add mplayer-1.0rc2-20080211-stream_cddb.patch

* Tue Feb 12 2008 Kazutaka HARADA <Kazutaka HARADA> 1.0-0vl0.2rc2
- change source download URL. <BTS:VineLinux:603>

* Sun Jan 27 2008 Kazutaka HARADA <Kazutaka HARADA> 1.0-0vl0.1rc2
- fix CONFDIR for make install in mplayer.spec. <BTS:wishes:33>

* Fri Jan 18 2008 Kazutaka HARADA <Kazutaka HARADA> 1.0-0vl0.0rc2
- initial build for Vine Linux.
