%define pkgname avidemux
%define name    self-build-%{pkgname}
%define version 2.5.2
%define release 2%{?_dist_release}

%define source0path	%{pkgname}/%{pkgname}_%{version}.tar.gz

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

Obsoletes:      %{pkgname}-qt < 2.5.0

Source0:	%{pkgname}-vl.spec
Source1:        %{pkgname}-gtk.desktop
Source2:        %{pkgname}-qt.desktop

Source100:         2.5.0-coreImage-parallel-build.patch
Source101:         avidemux-2.5-pulseaudio-default.patch
Source102:         avidemux-2.4-qt4.patch
Source103:         avidemux-2.5-i18n.patch
Source104:         avidemux-2.5-libmpeg2enc-altivec.patch
Source105:         avidemux-2.5-checkfunction-includes.patch
Source106:         avidemux-2.5.1-tmplinktarget.patch

Source110:         avidemux-2.4.3-alsa-device-default.patch
Source111:         avidemux-2.5.2-no-qt4-ui.patch

License:	GPLv2+
Group:		Restricted Software

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

Requires(post):	cmake
Requires(post):  gettext
Requires(post):  nasm >= 0.98.38
Requires(post):  libxml2-devel >= 2.6.8
Requires(post):  fontconfig-devel
Requires(post):  freetype2-devel
Requires(post):  js-devel
Requires(post):  libXv-devel
Requires(post):  libXmu-devel
Requires(post):	libsamplerate-devel
Requires(post):	jack-audio-connection-kit-devel
Requires(post):  alsa-lib-devel >= 1.0.3
Requires(post):  esound-devel >= 0.2.0
Requires(post):  SDL-devel >= 1.2.7
Requires(post):  libogg-devel >= 1.1
Requires(post):  libvorbis-devel >= 1.0.1
Requires(post):  self-build-faad2 >= 2.0
Requires(post):  self-build-libmad >= 0.15.1
Requires(post):  self-build-a52dec >= 0.7.4
Requires(post):  self-build-faac >= 1.24
Requires(post):  self-build-lame >= 3.96.1
Requires(post):  self-build-libdca
Requires(post):  self-build-xvidcore >= 1.0.2
Requires(post):  self-build-x264 >= 0.0.0-9.20090522
Requires(post):  self-build-ffmpeg
Requires(post):  desktop-file-utils
Requires(post):  gtk2-devel >= 2.8.0
Requires(post):  cairo-devel
Requires(post):  qt4-devel
Requires(post):  qt4-designer

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

Packager:	munepi

%description
Avidemux is a free video editor designed for simple cutting, filtering and
encoding tasks. It supports many file types, including AVI, DVD compatible
MPEG files, MP4 and ASF, using a variety of codecs. Tasks can be automated
using projects, job queue and powerful scripting capabilities.

[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
Avidemux は簡単なカット，フィルターリング，エンコード作業のために
デザインされたフリーな動画エディターです．
種々のコーデックを使い，AVI, DVD 互換 MPEG, MP4, ASF を含む
たくさんのファイル形式に対応しています．
タスクは，プロジェクトやジョブキュー，強力なスクリプト処理により
自動的に行われます．

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

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

[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 %{SOURCE1} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
%{__install} -m 644 %{SOURCE2} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
%{__install} -m 644 %{SOURCE100} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
%{__install} -m 644 %{SOURCE101} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
%{__install} -m 644 %{SOURCE102} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
%{__install} -m 644 %{SOURCE103} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
%{__install} -m 644 %{SOURCE104} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
%{__install} -m 644 %{SOURCE105} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
%{__install} -m 644 %{SOURCE106} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
%{__install} -m 644 %{SOURCE110} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}
%{__install} -m 644 %{SOURCE111} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}


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

%posttrans
/usr/lib/rpm/self-build-rpm.sh %{name} %{pkgname}-vl.spec \
    http://download{,2}.berlios.de/%{source0path} 3110000

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

%changelog
* Sat Mar 20 2010 Munehiro Yamamoto <munepi@vinelinux.org> 2.5.2-2
- renamed %%{Source0} to avidemux-vl.spec

* Wed Feb 17 2010 Munehiro Yamamoto <munepi@vinelinux.org> 2.5.2-1
- new upstream release
  - update patches accordingly
  - added Obsoletes: %{pkgname}-qt < 2.5.0
- applied a progress bar to show approximately building time

* Sun Sep 06 2009 Munehiro Yamamoto <munepi@vinelinux.org> 2.4.4-2
- applied avidemux-2.4.4-cmake.patch
- check version between original spec and self-build spec in %%prep

* Sat May 23 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> - 2.4.4-1
- new upstream release
  - update patches accordingly
  - build with x264 >= 0.0.0-9.20090522
- dropped avidemux-2.4.3-ppc.patch, avidemux-x264.patch
- added BuildArch: noarch
- avoided to execute self-build-rpm.sh on RPM transaction
  - moved %%post actions to %%posttrans

* Sat Feb 14 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> - 2.4.3-7
- corrected release number in avidemux.spec
- dropped ExclusiveArch:	

* Fri Feb 13 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 2.4.3-6
- add ppc to ExclusiveArch

* Sun Feb 08 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 2.4.3-5
- changed to PreReq:  self-build-faad2 >= 2.0 from faad2-devel
- changed to PreReq:  self-build-libmad >= 0.15.1 from libmad-devel

* Sun Feb 01 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 2.4.3-4
- fixed %%files section

* Sun Jan 11 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 2.4.3-3
- added avidemux-x264.patch from Gentoo

* Mon Dec 08 2008 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 2.4.3-2
- applied avidemux-2.4.3-alsa-device-default.patch

* Mon Nov 24 2008 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 2.4.3-1
- initial build based on RPM Fusion of Fedora package
  - changed to BuildRequires: gettext from gettext-devel
  - added BuildRequires: qt4-designer for gtk subpackage
  - dropped avidemux-2.4.3-qt4.patch

### end of file
