%define name x264
%define version 0.0.0
%define date 20100216
%define time 2245
%define release 13.%{date}%{?_dist_release}

Summary: Library for encoding and decoding H264/AVC video streams
Name: %{name}
Version: %{version}
Release: %{release}
#Source: ftp://ftp.videolan.org/pub/videolan/x264/snapshots/%{name}-snapshot-%{date}-%{time}.tar.bz2
Source: http://www.videolan.org/pub/videolan/x264/snapshots/%{name}-snapshot-%{date}-%{time}.tar.bz2
Source1: %{name}.desktop
# # don't remove config.h and don't re-run version.sh
# #Patch0: x264-nover.patch
# Patch0: x264-nover-20100216.patch
# link with shared libx264
Patch1: x264-shared.patch
# don't strip if configured with --enable-debug
Patch2: x264-nostrip.patch
License: GPLv2+
Group: System Environment/Libraries
URL: http://www.videolan.org/developers/x264.html

%ifarch x86_64 %{ix86}
BuildRequires: yasm
%endif
# gpac-devel package provided by self-build-gpac
# in self-build-%{name}.spec as PreReq.
#BuildRequires: gpac-devel

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

%description
x264 is a free library for encoding H264/AVC video streams, written from
scratch.

%package devel
Summary: Development files for the x264 library
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: pkgconfig

%description devel
x264 is a free library for encoding H264/AVC video streams, written from
scratch.

This package contains header files, static library and API documentation 
for the x264.

%prep
%setup -q -n %{name}-snapshot-%{date}-%{time}
#% patch0 -p1 -b .nover
%patch1 -p1 -b .shared
%patch2 -p1 -b .nostrip
# AUTHORS file is in iso-8859-1
iconv -f iso-8859-1 -t utf-8 -o AUTHORS.utf8 AUTHORS
%__mv -f AUTHORS.utf8 AUTHORS

%build
./configure \
	--host=%{_target_platform} \
	--prefix=%{_prefix} \
	--exec-prefix=%{_exec_prefix} \
	--bindir=%{_bindir} \
	--includedir=%{_includedir} \
	--libdir=%{_libdir} \
	--extra-cflags="$RPM_OPT_FLAGS" \
	--enable-mp4-output \
	%{?_with_visualize:--enable-visualize} \
%ifnarch %{ix86}
	--disable-asm \
%endif
	--enable-pthread \
	--enable-debug \
	--enable-shared \
	--enable-pic 

%{__make} %{?_smp_mflags}

%install
%{__rm} -rf %{buildroot}
%{__make} DESTDIR=%{buildroot} install


%clean
%{__rm} -rf %{buildroot}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig


%files
%defattr(644, root, root, 0755)
%doc AUTHORS COPYING
%attr(755,root,root) %{_bindir}/x264
%{_libdir}/libx264.so.*

%files devel
%defattr(644, root, root, 0755)
%doc doc/ratecontrol.txt doc/vui.txt
%{_includedir}/x264.h
%exclude %{_libdir}/libx264.a
%{_libdir}/libx264.so
%{_libdir}/pkgconfig/%{name}.pc



%changelog
* Sat Mar 20 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.0-13.20100216
- change release to sync with self-build-x264

* Wed Feb 17 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.0-12.20100216
- updated source snapshot 20100216
- applied to link x264 binary to the shared library from RPM Fusion development

* Mon Sep 07 2009 Munehiro Yamamoto <munepi@vinelinux.org> 0.0.0-11.20090522
- changed Source0: to http://www.videolan.org/pub/videolan/x264/snapshots

* Sat Jun 06 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.0.0-10.20090522
- change release to sync with self-build-x264

* Sat May 23 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.0.0-9.20090522
- 20090522 snapshot
  - updated x264-vine.patch

* Fri Mar 20 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.0.0-8.20090110
- corrected release number

* Sun Mar 01 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.0.0-6.20090110
- added configure options: --enable-mp4-output
- added BuildRequires: gpac-devel

* Sun Jan 25 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.0.0-5.20090110
- change release to sync with self-build-x264

* Sun Jan 11 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.0.0-4.20090110
- 20090110 snapshot

* Thu Nov 13 2008 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.0.0-3.20081001
- fixed License: GPLv2+
- added BuildRequires: gettext
- source updated
- fixed x264-rpm.patch (merged x264-rpm.patch from RPM Fusion)
  and added x264-vine.patch
#- changed version from 0.0.0-1.20080225 to 0.0.0-20081111.1

* Sun Nov 02 2008 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.0.0-2.20080225vl1
- spec in utf8

* Sun May 18 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.0.0-1.20080225
- apply new versioning policy

* Wed Feb 27 2008 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.0.0-0.20080225vl1
- initial build for Vine Linux 4.2

* Sun Jan 20 2008 Munehiro Yamamoto <myamamoto@g.math.s.chiba-u.ac.jp> 0.57-0.r721vlmp1
- update to SVN r721

* Sat Aug 4 2007 Munehiro Yamamoto <myamamoto@g.math.s.chiba-u.ac.jp> 0.56-0.r667vlmp1
- initial build for Vine Linux 4.1

### end of file
