File libav.spec of Package libav

#
# spec file for package libav
#
# Copyright (c) 2015 SUSE LINUX 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 avcodecso     libavcodec-libav56
%define avdeviceso    libavdevice-libav55
%define avfilterso    libavfilter-libav5
%define avformatso    libavformat-libav56
%define avresampleso  libavresample-libav2
%define avutilso      libavutil-libav54
%define swscaleso     libswscale-libav3
Name:           libav
Version:        11.4
Release:        0
Summary:        Library working with various multimedia formats
License:        GPL-2.0+
Group:          Development/Libraries/C and C++
Url:            https://libav.org/
Source:         http://%{name}.org/releases/%{name}-%{version}.tar.xz
BuildRequires:  libgsm-devel
BuildRequires:  pkg-config
BuildRequires:  yasm
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(bzip2)
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(frei0r)
BuildRequires:  pkgconfig(gnutls)
BuildRequires:  pkgconfig(jack)
BuildRequires:  pkgconfig(libcdio_paranoia)
BuildRequires:  pkgconfig(libdc1394-2)
BuildRequires:  pkgconfig(libopenjpeg)
BuildRequires:  pkgconfig(libpulse)
BuildRequires:  pkgconfig(libraw1394)
BuildRequires:  pkgconfig(libva)
BuildRequires:  pkgconfig(opus)
BuildRequires:  pkgconfig(schroedinger-1.0)
BuildRequires:  pkgconfig(sdl)
BuildRequires:  pkgconfig(speex)
BuildRequires:  pkgconfig(theora)
BuildRequires:  pkgconfig(vdpau)
BuildRequires:  pkgconfig(vorbis)
BuildRequires:  pkgconfig(vpx)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xext)
BuildRequires:  pkgconfig(xfixes)
BuildRequires:  pkgconfig(zlib)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
libav is a C library that works with various multimedia formats.

%package -n %{avcodecso}
Summary:        Codec library from libav
Group:          System/Libraries

%description -n %{avcodecso}
Codec library provided from libav.

%package -n %{avdeviceso}
Summary:        Device library from libav
Group:          System/Libraries

%description -n %{avdeviceso}
Device library provided from libav.

%package -n %{avfilterso}
Summary:        Filter library from libav
Group:          System/Libraries

%description -n %{avfilterso}
Filter library provided from libav.

%package -n %{avformatso}
Summary:        Format library from libav
Group:          System/Libraries

%description -n %{avformatso}
Format library provided from libav.

%package -n %{avresampleso}
Summary:        Resample library from libav
Group:          System/Libraries

%description -n %{avresampleso}
Resample library provided from libav.

%package -n %{avutilso}
Summary:        Utilities library from libav
Group:          System/Libraries

%description -n %{avutilso}
Utilities library provided from libav.

%package -n %{swscaleso}
Summary:        Swscale library from libav
Group:          System/Libraries

%description -n %{swscaleso}
Swscale library provided from libav.

%package -n libavcodec-libav-devel
Summary:        Development files for libavcodec
Group:          Development/Libraries/C and C++
Requires:       %{avcodecso} = %{version}
Requires:       libavutil-libav-devel = %{version}
Conflicts:      libavcodec-devel

%description -n libavcodec-libav-devel
Headers and libraries to program against libavcodec.

%package -n libavdevice-libav-devel
Summary:        Development files for libavdevice
Group:          Development/Libraries/C and C++
Requires:       %{avdeviceso} = %{version}
Requires:       libavformat-libav-devel = %{version}
Conflicts:      libavdevice-devel

%description -n libavdevice-libav-devel
Headers and libraries to program against libavdevice.

%package -n libavfilter-libav-devel
Summary:        Development files for libavfilter
Group:          Development/Libraries/C and C++
Requires:       %{avfilterso} = %{version}
Requires:       libavutil-libav-devel = %{version}
Conflicts:      libavfilter-devel

%description -n libavfilter-libav-devel
Headers and libraries to program against libavfilter.

%package -n libavformat-libav-devel
Summary:        Development files for libavformat
Group:          Development/Libraries/C and C++
Requires:       %{avformatso} = %{version}
Requires:       libavcodec-libav-devel = %{version}
Conflicts:      libavformat-devel

%description -n libavformat-libav-devel
Headers and libraries to program against libavformat.

%package -n libavresample-libav-devel
Summary:        Development files for libavresample
Group:          Development/Libraries/C and C++
Requires:       %{avresampleso} = %{version}
Requires:       libavutil-libav-devel = %{version}
Conflicts:      libavresample-devel

%description -n libavresample-libav-devel
Headers and libraries to program against libavresample.

%package -n libavutil-libav-devel
Summary:        Development files for libavutil
Group:          Development/Libraries/C and C++
Requires:       %{avutilso} = %{version}
Conflicts:      libavutil-devel

%description -n libavutil-libav-devel
Headers and libraries to program against libavutil.

%package -n libswscale-libav-devel
Summary:        Development files for libswscale
Group:          Development/Libraries/C and C++
Requires:       %{swscaleso} = %{version}
Requires:       libavutil-libav-devel = %{version}
Conflicts:      libavutil-devel
Conflicts:      libswscale-devel

%description -n libswscale-libav-devel
Headers and libraries to program against libswscale.

%package devel
Summary:        Files for Developing with libav
Group:          Development/Libraries/C and C++
Requires:       libavcodec-libav-devel
Requires:       libavdevice-libav-devel
Requires:       libavfilter-libav-devel
Requires:       libavformat-libav-devel
Requires:       libavresample-libav-devel
Requires:       libavutil-libav-devel
Requires:       libswscale-libav-devel

%description devel
libav is a C library that works with various multimedia formats.

This package contains the libav development files.

%package tools
Summary:        Tools for multimedia access
Group:          Productivity/Multimedia/Video/Editors and Convertors
Conflicts:      ffmpeg

%description tools
Various tools providing access to multimedia metadata and similar things.

%prep
%setup -q

# Remove build time references so build-compare can do its work
FAKE_BUILDTIME=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%H:%%M')
FAKE_BUILDDATE=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%b %%e %%Y')
sed -e "s/__TIME__/\"$FAKE_BUILDTIME\"/" -i cmdutils.c
sed -e "s/__DATE__/\"$FAKE_BUILDDATE\"/" -i cmdutils.c

%build
TOOLS="aviocat graph2dot ismindex pktdumper qt-faststart trasher cws2fws"

# For future reviews check the configure output and review the enabled
# muxers/etc to ensure the enable list is up-to-date
CFLAGS='%{optflags}'
./configure \
	--prefix=%{_prefix} --libdir=%{_libdir} --shlibdir=%{_libdir} \
	--extra-cflags='%{optflags}' --optflags='%{optflags}' \
	--incdir="%{_includedir}/libav" --build-suffix="-libav" --enable-pic \
	--enable-shared --disable-static \
	--enable-runtime-cpudetect \
	--enable-gpl \
	--disable-openssl \
	--enable-frei0r \
	--enable-gnutls \
	--enable-libcdio \
	--enable-libdc1394 \
	--enable-libfreetype \
	--enable-libgsm \
	--enable-libopenjpeg \
	--enable-libopus \
	--enable-libpulse \
	--enable-libschroedinger \
	--enable-libspeex \
	--enable-libtheora \
	--enable-libvorbis \
	--enable-libvpx \
	--enable-pic \
	--enable-pthreads \
	--enable-vaapi \
	--enable-vdpau \
	--enable-x11grab \
%if !0%{?BUILD_ORIG}
	--disable-encoders \
	--disable-decoders \
	--disable-muxers \
	--disable-demuxers \
	--enable-encoder="flac,gif,jpegls,libopenjpeg,libtheora,libvorbis,libvpx,png" \
	--enable-decoder="flac,gif,jpegls,ljpeg,libopenjpeg,libtheora,libvpx,png,vorbis,vp3,vp5,vp6,vp6a,vp6f,vp8,vp9,webp" \
	--enable-muxer="flac,gif,image2,image2pipe,matroska,matroska_audio,null,webm" \
	--enable-demuxer="flac,gif,image2,image2pipe,matroska"
%endif

make %{?_smp_mflags} V=1

for i in ${TOOLS}; do
	make tools/${i} V=1
done

%install
make DESTDIR=%{buildroot} install install-man

# tools
for i in ${TOOLS}; do
	cp tools/${i} %{buildroot}%{_bindir}/
done

%post -n %{avcodecso} -p /sbin/ldconfig

%post -n %{avdeviceso} -p /sbin/ldconfig

%post -n %{avfilterso} -p /sbin/ldconfig

%post -n %{avformatso} -p /sbin/ldconfig

%post -n %{avresampleso} -p /sbin/ldconfig

%post -n %{avutilso} -p /sbin/ldconfig

%post -n %{swscaleso} -p /sbin/ldconfig

%postun -n %{avcodecso} -p /sbin/ldconfig

%postun -n %{avdeviceso} -p /sbin/ldconfig

%postun -n %{avfilterso} -p /sbin/ldconfig

%postun -n %{avformatso} -p /sbin/ldconfig

%postun -n %{avresampleso} -p /sbin/ldconfig

%postun -n %{avutilso} -p /sbin/ldconfig

%postun -n %{swscaleso} -p /sbin/ldconfig

%files -n %{avcodecso}
%defattr(0644,root,root,0755)
%{_libdir}/libavcodec-libav.so.*

%files -n %{avdeviceso}
%defattr(0644,root,root,0755)
%{_libdir}/libavdevice-libav.so.*

%files -n %{avfilterso}
%defattr(0644,root,root,0755)
%{_libdir}/libavfilter-libav.so.*

%files -n %{avformatso}
%defattr(0644,root,root,0755)
%{_libdir}/libavformat-libav.so.*

%files -n %{avresampleso}
%defattr(0644,root,root,0755)
%{_libdir}/libavresample-libav.so.*

%files -n %{avutilso}
%defattr(0644,root,root,0755)
%{_libdir}/libavutil-libav.so.*

%files -n %{swscaleso}
%defattr(0644,root,root,0755)
%{_libdir}/libswscale-libav.so.*

%files -n libavcodec-libav-devel
%defattr(0644,root,root,0755)
%dir %{_includedir}/libav
%{_includedir}/libav/libavcodec
%{_libdir}/libavcodec-libav.so
%{_libdir}/pkgconfig/libavcodec.pc

%files -n libavdevice-libav-devel
%defattr(0644,root,root,0755)
%dir %{_includedir}/libav
%{_includedir}/libav/libavdevice
%{_libdir}/libavdevice-libav.so
%{_libdir}/pkgconfig/libavdevice.pc

%files -n libavfilter-libav-devel
%defattr(0644,root,root,0755)
%dir %{_includedir}/libav
%{_includedir}/libav/libavfilter
%{_libdir}/libavfilter-libav.so
%{_libdir}/pkgconfig/libavfilter.pc

%files -n libavformat-libav-devel
%defattr(0644,root,root,0755)
%dir %{_includedir}/libav
%{_includedir}/libav/libavformat
%{_libdir}/libavformat-libav.so
%{_libdir}/pkgconfig/libavformat.pc

%files -n libavresample-libav-devel
%defattr(0644,root,root,0755)
%dir %{_includedir}/libav
%{_includedir}/libav/libavresample
%{_libdir}/libavresample-libav.so
%{_libdir}/pkgconfig/libavresample.pc

%files -n libavutil-libav-devel
%defattr(0644,root,root,0755)
%dir %{_includedir}/libav
%{_includedir}/libav/libavutil
%{_libdir}/libavutil-libav.so
%{_libdir}/pkgconfig/libavutil.pc

%files -n libswscale-libav-devel
%defattr(0644,root,root,0755)
%dir %{_includedir}/libav
%{_includedir}/libav/libswscale
%{_libdir}/libswscale-libav.so
%{_libdir}/pkgconfig/libswscale.pc

%files tools
%defattr(-,root,root)
%doc Changelog COPYING.GPLv2 CREDITS LICENSE README
%{_bindir}/*
%{_datadir}/avconv
%{_mandir}/man1/*

%changelog
openSUSE Build Service is sponsored by