File avifile.spec of Package avifile

#
# spec file for package avifile
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

%define series 0.7
%define _win32_dir /usr/lib/avifile-%{series}/win32

Name:           avifile
Version:        0.7.45
Release:        3.27
License:        GPL-2.0
Summary:        AVI file support library
Url:            http://avifile.sourceforge.net
Group:          System/Libraries
Source:         %{name}-%{series}-%{version}.tar.bz2
Source1:	binaries-011002.tgz
# PATCH-FIX-UPSTREAM marguerite@opensuse.org - remove install-hook in Makefile.am
Patch0:         avifile-am.patch
# PATCH-FIX-UPSTREAM marguerite@opensuse.org - Replace -lsdl with -lSDL in configure.in
Patch1:		avifile-sdl-libs.patch
# PATCH-FIX-UPSTREAM marguerite@opensuse.org - invalid conversion from 'const char*' to 'char*' 
Patch2:		avifile-gcc44.patch
# PATCH-FIX-UPSTREAM marguerite@opensuse.org - fix debian#667107 cannot bind packed field
Patch3:		ftbfs-gcc4.7.patch
# PATCH-FIX-UPSTREAM marguerite@opensuse.org - fix mp3encoder.cpp extra qualification
Patch4:		avifile-gcc41.patch
# PATCH-FIX-UPSTREAM marguerite@opensuse.org - fix linux/videodev.h to libv4l1-videodev.h
Patch5:		avifile-libv4l1-videodev.patch
# PATCH-FIX-UPSTREAM marguerite@opensuse.org - fix xf86dga int to unsigned int.
Patch6:		avifile-xf86dga.patch
# PATCH-FIX-UPSTREAM marguerite@opensuse.org - use system ffmpeg instead of bundled one.
Patch7:		avifile-system_wide_ffmpeg.patch
# PATCH-FIX-UPSTREAM marguerite@opensuse.org - fix ffmpeg include path and UINT64_C.
Patch8:		avifile-UINT64_C.patch
# PATCH-FIX-UPSTREAM marguerite@opensuse.org - port ffmpeg to 1.0+ version.
Patch9:		avifile-ffmpeg-1.0.patch
# PATCH-FIX-UPSTREAM marguerite@opensuse.org - enable system mad.
Patch10:	avifile-system-libmad.patch
# PATCH-FIX-UPSTREAM marguerite@opensuse.org - don't use bundled lame 3.70. let it dlopen.
Patch11:	avifile-no-lame-3.70.patch
# PATCH-FIX-UPSTREAM marguerite@opensuse.org - fix sequence point errors.
Patch12:	avifile-sequence-point.patch
# PATCH-FIX-UPSTREAM marguerite@opensuse.org - fix gcc47 warning.
Patch13:	avifile-strict-aliasing-punning.patch
%ifarch i586
# PATCH-FIX-UPSTREAM marguerite@opensuse.org - fix i586 has no u_long
Patch14:	avifile-u_long.patch
# PATCH-FIX-UPSTREAM marguerite@opensuse.org - fix 64bit-portability-issue
Patch15:	avifile-64bit-portability-issue.patch
%endif
# PATCH-FIX-UPSTREAM marguerite@opensuse.org - port ffmpeg to 2.0+ version
Patch16:	avifile-ffmpeg-2.0.patch
# PATCH-FIX-UPSTREAM marguerite@opensuse.org - remove stupid sed -g for gcc 4.8
Patch17:	avifile-record-gcc-switches.patch
BuildRequires:  freetype2-devel
BuildRequires:	gcc-c++
BuildRequires:  libSDL-devel
%if 0%{?suse_version} >= 1220
BuildRequires:  libxcb-devel
BuildRequires:  libXft-devel
BuildRequires:	libXi-devel
BuildRequires:  libXinerama-devel
BuildRequires:	libXt-devel
BuildRequires:  libXv-devel
BuildRequires:	libXxf86dga-devel
%endif
BuildRequires:  liba52-devel
BuildRequires:  libfaad-devel
BuildRequires:	libffmpeg-devel
BuildRequires:	libjpeg8-devel
BuildRequires:  libmad-devel
BuildRequires:  libmp3lame-devel
BuildRequires:	libtool
BuildRequires:	libv4l-devel
BuildRequires:  libvorbis-devel
BuildRequires:  libxvidcore-devel
BuildRequires:  zlib-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Avifile is a library that allows you to read and write compressed
AVI files (Indeo? Video, DivX, etc.) under x86 Linux. (De)compression
is performed with Win32 DLLs. It includes AVI player,
video4linux-compatible capture program and simple AVI recompres.

%package -n libaviplay-0_7-0
Summary:	Shared libraries for AVI read/writing
Group:	System/Libraries
Requires:	%{name}-data

%description -n libaviplay-0_7-0
Avifile is a library that allows you to read and write compressed
AVI files (Indeo? Video, DivX, etc.) under x86 Linux. (De)compression
is performed with Win32 DLLs. It includes AVI player,
video4linux-compatible capture program and simple AVI recompres.

This package provides shared libraries for avifile.

%package win32
Summary:	Win32 codecs for libavifile
Group:	System/Libraries

%description win32
Avifile is a library that allows you to read and write compressed
AVI files (Indeo? Video, DivX, etc.) under x86 Linux. (De)compression
is performed with Win32 DLLs. It includes AVI player,
video4linux-compatible capture program and simple AVI recompres.

This package provides win32 codecs for avifile.

%package data
Summary:	Toolkit for libavifile
Group:	Productivity/Multimedia/Other

%description data
Avifile is a library that allows you to read and write compressed
AVI files (Indeo? Video, DivX, etc.) under x86 Linux. (De)compression
is performed with Win32 DLLs. It includes AVI player,
video4linux-compatible capture program and simple AVI recompres.

This package provides data files for avifile.

%package -n libavifile-devel
Summary:	Development header files for avifile
Group:	Development/Libraries/C and C++
Requires:	libaviplay-0_7-0 = %{version}

%description -n libavifile-devel
Avifile is a library that allows you to read and write compressed
AVI files (Indeo? Video, DivX, etc.) under x86 Linux. (De)compression
is performed with Win32 DLLs. It includes AVI player,
video4linux-compatible capture program and simple AVI recompres.

This package provides development headers for avifile.

%prep
%setup -q -n %{name}-%{series}-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%if 0%{?suse_version} >= 1220
%patch5 -p1
%endif
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%ifarch i586
%patch14 -p1
%patch15 -p1
%endif
%patch16 -p1
%patch17 -p1
./autogen.sh

%build
mkdir -p %{_sourcedir}/usr/lib/avifile-%{series}/
tar -xzf %{SOURCE1} -C %{_sourcedir}/usr/lib/avifile-%{series}/
# qt is qt3.
%configure --enable-win32 \
	--with-win32-path=%{_sourcedir}%{_win32_dir} \
	--disable-lame \
	--enable-lamebin \
	--without-qt \
        --enable-mad \
	--enable-libmad
make %{?_smp_mflags}

%install
%make_install

install -d %{buildroot}%{_win32_dir}
cp -r %{_sourcedir}%{_win32_dir}/* %{buildroot}%{_win32_dir}/

find %{buildroot}%{_libdir} -name "*.la" -delete -print

%post -n libaviplay-0_7-0 -p /sbin/ldconfig

%postun -n libaviplay-0_7-0 -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc ChangeLog README COPYING
%{_bindir}/avibench
%{_bindir}/avicat
%{_bindir}/avimake
%{_bindir}/avitype
%{_bindir}/avirec
%{_bindir}/kv4lsetup
%{_mandir}/man1/avibench.1.gz
%{_mandir}/man1/avicap.1.gz
%{_mandir}/man1/avicat.1.gz
%{_mandir}/man1/avimake.1.gz
%{_mandir}/man1/aviplay.1.gz
%{_mandir}/man1/avirec.1.gz
%{_mandir}/man1/avirecompress.1.gz
%{_mandir}/man1/avitype.1.gz
%{_mandir}/man1/kv4lsetup.1.gz

%files -n libaviplay-0_7-0
%defattr(-,root,root)
%{_libdir}/avifile-%{series}
%{_libdir}/libaviplay-0.7.so.0
%{_libdir}/libaviplay-0.7.so.0.0.45
%ifarch i586
%exclude %{_libdir}/avifile-%{series}/win32
%endif

%files data
%defattr(-,root,root)
%{_datadir}/avifile-%{series}

%files win32
%defattr(-,root,root)
%ifarch x86_64
%dir /usr/lib/avifile-%{series}
%endif
%{_win32_dir}

%files -n libavifile-devel
%defattr(-,root,root)
%{_bindir}/avifile-config
%{_includedir}/avifile-%{series}/
%{_libdir}/libaviplay.so
%{_libdir}/pkgconfig/avifile.pc
%{_datadir}/aclocal/avifile.m4
%{_mandir}/man1/avifile-config.1.gz

%changelog
* Tue Apr  1 2014 i@margueirte.su
- fix ffmpeg 2.0+ build
- added patch: avifile-ffmpeg-2.0.patch
- added patch: avifile-record-gcc-switches.patch
  * remove sed code which is stupid, removes "-g" in
    "-grecord-gcc-switches" in RPM_OPT_FLAGS
* Sun May 19 2013 i@margueirte.su
- initial package 0.7.45
- fix new autotool/gcc errors
- fix new SDL finding errors
- port to ffmpeg 1.0+
- port to libv4l1
- use system ffmpeg and libmad
- don't use bundled lame 3.70. let it dlopen for system's.