3
0
Fork 0
forked from mirrors/nixpkgs

libav: major update and refactoring

Also leaving 0_8 branch, as it's compatible with older ffmpeg versions.
I'm planning that all expressions will be able to switch easily
between ffmpeg and libav (whatever default we choose, but I prefer libav).
This commit is contained in:
Vladimír Čunát 2013-08-13 20:06:30 +02:00
parent 2a444fbdee
commit b003138081
3 changed files with 96 additions and 48 deletions
pkgs
development/libraries/libav
top-level

View file

@ -0,0 +1,12 @@
{ stdenv, fetchurl, libav_9 }:
let derivSrc = libav_9.derivSrc // rec {
name = "libav-0.8.8";
src = fetchurl {
url = "http://libav.org/releases/${name}.tar.xz";
sha256 = "1wnbmbs0z4f55y8r9bwb63l04zn383l1avy4c9x1ffb2xccgcp79";
};
};
in stdenv.mkDerivation derivSrc

View file

@ -1,59 +1,86 @@
{ stdenv, fetchurl, pkgconfig, yasm, xz { stdenv, fetchurl, pkgconfig, yasm, bzip2, zlib
, mp3Support ? true, lame ? null , mp3Support ? true, lame ? null
, speexSupport ? true, speex ? null , speexSupport ? true, speex ? null
, theoraSupport ? true, libtheora ? null , theoraSupport ? true, libtheora ? null
, vorbisSupport ? true, libvorbis ? null , vorbisSupport ? true, libvorbis ? null
, vpxSupport ? false, libvpx ? null , vpxSupport ? true, libvpx ? null
, x264Support ? false, x264 ? null , x264Support ? false, x264 ? null
, xvidSupport ? true, xvidcore ? null , xvidSupport ? true, xvidcore ? null
, faacSupport ? false, faac ? null , faacSupport ? false, faac ? null
, vaapiSupport ? false, libva ? null # ToDo: it has huge closure
, vdpauSupport ? true, libvdpau ? null
, freetypeSupport ? true, freetype ? null # it's small and almost everywhere
, SDL # only for avplay in $tools, adds nontrivial closure to it
, enableGPL ? true # ToDo: some additional default stuff may need GPL
, enableUnfree ? faacSupport
}: }:
assert speexSupport -> speex != null; assert faacSupport -> enableUnfree;
assert theoraSupport -> libtheora != null;
assert vorbisSupport -> libvorbis != null; with { inherit (stdenv.lib) optional optionals; };
assert vpxSupport -> libvpx != null;
assert x264Support -> x264 != null; /* ToDo:
assert xvidSupport -> xvidcore != null; - more deps, inspiration: http://packages.ubuntu.com/raring/libav-tools
- maybe do some more splitting into outputs
*/
let derivSrc = rec { # derivSrc is exported and re-used by expressions for older versions
name = "libav-9.8";
stdenv.mkDerivation rec {
name = "libav-0.7";
src = fetchurl { src = fetchurl {
url = "http://libav.org/releases/${name}.tar.xz"; url = "http://libav.org/releases/${name}.tar.xz";
sha256 = "04pl6y53xh6xmwzz0f12mg5vh62ylp5zwwinj6dxzd8pnbjg4lsz"; sha256 = "0r7hg9wg3cxjsmwzpa6f2p1a092g2iazyjjy23604ccskzbnirg3";
}; };
# `--enable-gpl' (as well as the `postproc' and `swscale') mean that configureFlags =
# the resulting library is GPL'ed, so it can only be used in GPL'ed assert stdenv.lib.all (x: x!=null) buildInputs;
# applications. [
configureFlags = [ #"--enable-postproc" # it's now a separate package in upstream
"--enable-gpl" "--disable-avserver" # upstream says it's in a bad state
"--enable-postproc" "--enable-avplay"
"--enable-swscale"
"--disable-ffserver"
"--disable-ffplay"
"--enable-shared" "--enable-shared"
"--enable-runtime-cpudetect" "--enable-runtime-cpudetect"
] ]
++ stdenv.lib.optional mp3Support "--enable-libmp3lame" ++ optionals enableGPL [ "--enable-gpl" "--enable-swscale" ]
++ stdenv.lib.optional speexSupport "--enable-libspeex" ++ optional mp3Support "--enable-libmp3lame"
++ stdenv.lib.optional theoraSupport "--enable-libtheora" ++ optional speexSupport "--enable-libspeex"
++ stdenv.lib.optional vorbisSupport "--enable-libvorbis" ++ optional theoraSupport "--enable-libtheora"
++ stdenv.lib.optional vpxSupport "--enable-libvpx" ++ optional vorbisSupport "--enable-libvorbis"
++ stdenv.lib.optional x264Support "--enable-libx264" ++ optional vpxSupport "--enable-libvpx"
++ stdenv.lib.optional xvidSupport "--enable-libxvid" ++ optional x264Support "--enable-libx264"
++ stdenv.lib.optional faacSupport "--enable-libfaac --enable-nonfree"; ++ optional xvidSupport "--enable-libxvid"
++ optional faacSupport "--enable-libfaac --enable-nonfree"
++ optional vaapiSupport "--enable-vaapi"
++ optional vdpauSupport "--enable-vdpau"
++ optional freetypeSupport "--enable-libfreetype"
;
buildInputs = [ pkgconfig lame yasm ] buildInputs = [ pkgconfig lame yasm zlib bzip2 SDL ]
++ stdenv.lib.optional mp3Support lame ++ optional mp3Support lame
++ stdenv.lib.optional speexSupport speex ++ optional speexSupport speex
++ stdenv.lib.optional theoraSupport libtheora ++ optional theoraSupport libtheora
++ stdenv.lib.optional vorbisSupport libvorbis ++ optional vorbisSupport libvorbis
++ stdenv.lib.optional vpxSupport libvpx ++ optional vpxSupport libvpx
++ stdenv.lib.optional x264Support x264 ++ optional x264Support x264
++ stdenv.lib.optional xvidSupport xvidcore ++ optional xvidSupport xvidcore
++ stdenv.lib.optional faacSupport faac; ++ optional faacSupport faac
++ optional vaapiSupport libva
++ optional vdpauSupport libvdpau
++ optional freetypeSupport freetype
;
enableParallelBuilding = true;
outputs = [ "out" "tools" ];
postInstall = ''
mkdir -p "$tools/bin"
mv "$out/bin/avplay" "$tools/bin"
cp -s "$out"/bin/* "$tools/bin/"
'';
doInstallCheck = true;
installCheckTarget = "check"; # tests need to be run *after* installation
crossAttrs = { crossAttrs = {
dontSetConfigureCross = true; dontSetConfigureCross = true;
@ -65,8 +92,15 @@ stdenv.mkDerivation rec {
]; ];
}; };
meta = { passthru = { inherit derivSrc vdpauSupport; };
meta = with stdenv.lib; {
homepage = http://libav.org/; homepage = http://libav.org/;
description = "A complete, cross-platform solution to record, convert and stream audio and video (fork of ffmpeg)"; description = "A complete, cross-platform solution to record, convert and stream audio and video (fork of ffmpeg)";
license = with licenses; if enableUnfree then unfree #ToDo: redistributable or not?
else if enableGPL then gpl2Plus else lgpl21Plus;
platforms = platforms.all;
}; };
} };
in stdenv.mkDerivation derivSrc

View file

@ -4457,7 +4457,9 @@ let
libassuan2_1 = callPackage ../development/libraries/libassuan/git.nix { }; libassuan2_1 = callPackage ../development/libraries/libassuan/git.nix { };
libav = callPackage ../development/libraries/libav { }; libav = libav_9;
libav_9 = callPackage ../development/libraries/libav { };
libav_0_8 = callPackage ../development/libraries/libav/0.8.x.nix { };
libavc1394 = callPackage ../development/libraries/libavc1394 { }; libavc1394 = callPackage ../development/libraries/libavc1394 { };