#
# Conditional build:
-%bcond_without asm
+%bcond_without asm # x86 assembler
+%bcond_without doc # don't build doc
+%bcond_with tests # build tests (not useful, creates libgtest.a)
+%bcond_without ssse3 # use SSSE3 instructions (Intel since Core2, Via Nano)
-%ifarch %{x8664}
-# buggy, non PIC asm code
-%undefine with_asm
+%ifnarch %{ix86} %{x8664} x32
+%undefine with_asm
+%endif
+
+%if "%{pld_release}" == "ac"
+# not supported by compiler
+%undefine with_ssse3
%endif
Summary: VP8, a high-quality video codec
+Summary(pl.UTF-8): VP8 - kodek obrazu wysokiej jakości
Name: libvpx
-Version: 0.9.0
-Release: 2
+Version: 1.8.2
+Release: 1
License: BSD
Group: Libraries
-Source0: http://webm.googlecode.com/files/%{name}-%{version}.tar.bz2
-# Source0-md5: 9eb8e818d2f3263623c258fe66924082
-Patch0: %{name}-0.9.0-no-explicit-dep-on-static-lib.patch
+# original download URL: http://downloads.webmproject.org/releases/webm/index.html
+# ...but use github mirror to get consistent tarballs
+#Source0Download: https://github.com/webmproject/libvpx/releases
+Source0: https://github.com/webmproject/libvpx/archive/v%{version}/%{name}-%{version}.tar.gz
+# Source0-md5: 6dbccca688886c66a216d7e445525bce
URL: http://www.webmproject.org/
-BuildRequires: autoconf
-BuildRequires: automake
BuildRequires: doxygen
-%{?with_asm:BuildRequires: yasm}
+%{?with_tests:BuildRequires: libstdc++-devel}
+BuildRequires: pkgconfig
+BuildRequires: rpmbuild(macros) >= 1.673
+BuildRequires: sed >= 4.0
+%{?with_asm:BuildRequires: yasm >= 0.8}
+%if %{with doc}
+BuildRequires: %{php_name}-pcre
+BuildRequires: %{php_name}-program
+%endif
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+%define generic_target generic-gnu
+%define vpxtarget %{generic_target}
+%ifarch %{x8664}
+%define vpxtarget x86_64-linux-gcc
+%endif
+%ifarch %{ix86}
+%define vpxtarget x86-linux-gcc
+%endif
+%ifarch ppc
+%define vpxtarget ppc32-linux-gcc
+%endif
+%ifarch ppc64
+%define vpxtarget ppc64-linux-gcc
+%endif
+
%description
VP8, a high-quality video codec.
+%description -l pl.UTF-8
+VP8 - kodek obrazu wysokiej jakości.
+
%package devel
-Summary: Header files and develpment documentation for libvpx
+Summary: Header files for libvpx
+Summary(pl.UTF-8): Pliki nagłówkowe biblioteki libvpx
Group: Development/Libraries
-Requires: %{name} = %{epoch}:%{version}-%{release}
+Requires: %{name} = %{version}-%{release}
%description devel
-Header files and documentation for libvpx.
+Header files for libvpx library.
+
+%description devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki libvpx.
%package static
Summary: Static libvpx library
+Summary(pl.UTF-8): Statyczna biblioteka libvpx
Group: Development/Libraries
-Requires: %{name}-devel = %{epoch}:%{version}-%{release}
+Requires: %{name}-devel = %{version}-%{release}
%description static
Static libvpx library.
+%description static -l pl.UTF-8
+Statyczna biblioteka libvpx.
+
+%package tools
+Summary: VPX decoding/encoding tools
+Summary(pl.UTF-8): Narzędzia do kodowania/dekodowania formatu VPX
+Group: Applications/Graphics
+Requires: %{name} = %{version}-%{release}
+
+%description tools
+VPX decoding/encoding tools.
+
+%description tools -l pl.UTF-8
+Narzędzia do kodowania/dekodowania formatu VPX.
+
%prep
%setup -q
-%patch0 -p1
%build
-install -d build
-cd build
+install -d obj
+cd obj
# not autoconf configure
+CC="%{__cc}" \
+CXX="%{__cxx}" \
+CFLAGS="%{rpmcflags} %{rpmcppflags} %{!?with_asm:-DYUV_DISABLE_ASM}" \
../configure \
%if %{with asm}
-%ifarch %{x8664}
- --target=x86_64-linux-gcc \
-%endif
-%ifarch %{ix86}
- --target=x86-linux-gcc \
+ --as=yasm \
%endif
-%else
- --target=generic-gnu \
-%endif
- --enable-pic \
+ --target=%{vpxtarget} \
+ --enable-shared \
+ %{!?with_ssse3:--disable-ssse3} \
--disable-optimizations \
+ --%{!?with_tests:dis}%{?with_tests:en}able-unit-tests \
+ --%{!?with_doc:dis}%{?with_doc:en}able-docs \
+ --%{!?with_doc:dis}%{?with_doc:en}able-install-docs \
+ --enable-vp8 \
--enable-vp8 \
--enable-postproc \
--enable-runtime-cpu-detect
-# Hack our optflags in.
-sed -i "s|\"vpx_config.h\"|\"vpx_config.h\" %{rpmcflags} %{rpmcppflags} -fPIC|g" {libs,examples,docs}-*.mk
-sed -i "s|STRIP=.*|STRIP=|g" {libs,examples,docs}-*.mk
-
%{__make} verbose=true target=libs \
- CC="%{__cc}"
-
-%{__cc} %{rpmldflags} -fPIC -o libvpx.so.0.0.0 -shared -Wl,-soname,libvpx.so.0 vpx_codec/src/*.o vpx_mem/*.o \
- vpx_scale/generic/*.o vp8/common/*.o vp8/common/generic/*.o vp8/*.o vp8/encoder/*.o \
- vp8/encoder/generic/*.o vp8/decoder/*.o vp8/decoder/generic/*.o vpx_config.c.o \
-%if %{with asm}
- vp8/common/x*/*.o vp8/encoder/x*/*.o vp8/decoder/x*/*.o vpx_ports/*.o \
-%endif
- -lm -lpthread
-
-# Temporarily dance the static libs out of the way
-mv libvpx.a libNOTvpx.a
-mv libvpx_g.a libNOTvpx_g.a
-
-# We need to do this so the examples can link against it.
-ln -sf libvpx.so.0.0.0 libvpx.so
+ HAVE_GNU_STRIP=no \
+ LDFLAGS="%{rpmldflags}"
%{__make} verbose=true target=examples \
- CC="%{__cc}"
-%{__make} verbose=true target=docs
+ LDFLAGS="%{rpmldflags} -L."
-# Put them back so the install doesn't fail
-mv libNOTvpx.a libvpx.a
-mv libNOTvpx_g.a libvpx_g.a
+%if %{with doc}
+%{__make} verbose=true target=docs
+%endif
%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT{%{_bindir},%{_includedir}/vpx,%{_libdir}}
-install -d outdir
-%{__make} -C build install \
- DIST_DIR=$(pwd)/outdir
-
-mv outdir/bin/{simple_decoder,vp8_simple_decoder}
-mv outdir/bin/{twopass_encoder,vp8_twopass_encoder}
-install -p outdir/bin/* $RPM_BUILD_ROOT%{_bindir}
+%{__make} -C obj verbose=true install \
+ LIBSUBDIR=%{_lib} \
+ DIST_DIR=$RPM_BUILD_ROOT%{_prefix}
-ln -s libvpx.so.0.0.0 build/libvpx.so.0.0
-ln -s libvpx.so.0.0.0 build/libvpx.so.0
-install -p build/libvpx.so* $RPM_BUILD_ROOT%{_libdir}
+# redundant minor version symlink (not SONAME)
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/libvpx.so.6.2
-cp -a outdir/include/*.h $RPM_BUILD_ROOT%{_includedir}/vpx
-cp -a outdir/lib/*.a $RPM_BUILD_ROOT%{_libdir}
+# adjust prefix and libdir
+%{__sed} -i -e 's,^prefix=.*,prefix=%{_prefix},;s,^libdir=.*,libdir=%{_libdir},' $RPM_BUILD_ROOT%{_pkgconfigdir}/vpx.pc
%clean
rm -rf $RPM_BUILD_ROOT
-%post -p /sbin/ldconfig
+%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(644,root,root,755)
-%attr(755,root,root) %{_bindir}/*
-%attr(755,root,root) %{_libdir}/libvpx.so.*.*
-%attr(755,root,root) %ghost %{_libdir}/libvpx.so.0
+%doc AUTHORS CHANGELOG LICENSE PATENTS README
+%attr(755,root,root) %{_libdir}/libvpx.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libvpx.so.6
%files devel
%defattr(644,root,root,755)
-%attr(755,root,root) %{_libdir}/libvpx*.so
+%attr(755,root,root) %{_libdir}/libvpx.so
%{_includedir}/vpx
+%{_pkgconfigdir}/vpx.pc
%files static
%defattr(644,root,root,755)
%{_libdir}/libvpx.a
+
+%files tools
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/vpxdec
+%attr(755,root,root) %{_bindir}/vpxenc