2013-08-17 09:17:44 +04:00
|
|
|
{ stdenv, fetchurl, pkgconfig, yasm, bzip2, zlib
|
|
|
|
, mp3Support ? true, lame ? null
|
|
|
|
, speexSupport ? true, speex ? null
|
|
|
|
, theoraSupport ? true, libtheora ? null
|
|
|
|
, vorbisSupport ? true, libvorbis ? null
|
|
|
|
, vpxSupport ? true, libvpx ? null
|
|
|
|
, x264Support ? false, x264 ? null
|
|
|
|
, xvidSupport ? true, xvidcore ? 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
|
2011-07-15 16:20:34 +04:00
|
|
|
}:
|
|
|
|
|
2013-08-17 09:17:44 +04:00
|
|
|
assert faacSupport -> enableUnfree;
|
2011-07-15 16:20:34 +04:00
|
|
|
|
2013-08-17 09:17:44 +04:00
|
|
|
with { inherit (stdenv.lib) optional optionals; };
|
2011-07-15 16:20:34 +04:00
|
|
|
|
2013-08-17 09:17:44 +04:00
|
|
|
/* ToDo:
|
|
|
|
- more deps, inspiration: http://packages.ubuntu.com/raring/libav-tools
|
|
|
|
- maybe do some more splitting into outputs
|
|
|
|
*/
|
|
|
|
|
|
|
|
let
|
|
|
|
result = {
|
2014-06-28 10:16:36 +04:00
|
|
|
libav_0_8 = libavFun "0.8.13" "1fr3rzykrlm1cla0csm9hqa3gcqp19hf5rgn70nyb9w92r67v685";
|
2014-08-10 20:28:17 +04:00
|
|
|
libav_9 = libavFun "9.16" "18378gdgzqsxaacc9vl7ligwndbdvy95wbn50hs8xvdqn1rn916a";
|
2014-08-30 12:17:40 +04:00
|
|
|
libav_10 = libavFun "10.4" "1zzvjfdlv9swhq7dzvli1pk8cn02q1076ax9m3cx9ipilbg21639";
|
2011-07-15 16:20:34 +04:00
|
|
|
};
|
2013-08-17 09:17:44 +04:00
|
|
|
|
|
|
|
libavFun = version : sha256 : stdenv.mkDerivation rec {
|
|
|
|
name = "libav-${version}";
|
|
|
|
|
|
|
|
src = fetchurl {
|
2014-02-04 00:43:55 +04:00
|
|
|
url = "${meta.homepage}/releases/${name}.tar.xz";
|
2013-08-17 09:17:44 +04:00
|
|
|
inherit sha256;
|
|
|
|
};
|
|
|
|
configureFlags =
|
|
|
|
assert stdenv.lib.all (x: x!=null) buildInputs;
|
|
|
|
[
|
|
|
|
#"--enable-postproc" # it's now a separate package in upstream
|
|
|
|
"--disable-avserver" # upstream says it's in a bad state
|
|
|
|
"--enable-avplay"
|
|
|
|
"--enable-shared"
|
|
|
|
"--enable-runtime-cpudetect"
|
|
|
|
]
|
|
|
|
++ optionals enableGPL [ "--enable-gpl" "--enable-swscale" ]
|
|
|
|
++ optional mp3Support "--enable-libmp3lame"
|
|
|
|
++ optional speexSupport "--enable-libspeex"
|
|
|
|
++ optional theoraSupport "--enable-libtheora"
|
|
|
|
++ optional vorbisSupport "--enable-libvorbis"
|
|
|
|
++ optional vpxSupport "--enable-libvpx"
|
|
|
|
++ optional x264Support "--enable-libx264"
|
|
|
|
++ 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 zlib bzip2 SDL ]
|
|
|
|
++ optional mp3Support lame
|
|
|
|
++ optional speexSupport speex
|
|
|
|
++ optional theoraSupport libtheora
|
|
|
|
++ optional vorbisSupport libvorbis
|
|
|
|
++ optional vpxSupport libvpx
|
|
|
|
++ optional x264Support x264
|
|
|
|
++ optional xvidSupport xvidcore
|
|
|
|
++ 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/"
|
|
|
|
'';
|
|
|
|
|
2014-05-07 16:02:25 +04:00
|
|
|
doInstallCheck = false; # fails randomly
|
2013-08-17 09:17:44 +04:00
|
|
|
installCheckTarget = "check"; # tests need to be run *after* installation
|
|
|
|
|
|
|
|
crossAttrs = {
|
|
|
|
dontSetConfigureCross = true;
|
|
|
|
configureFlags = configureFlags ++ [
|
|
|
|
"--cross-prefix=${stdenv.cross.config}-"
|
|
|
|
"--enable-cross-compile"
|
|
|
|
"--target_os=linux"
|
|
|
|
"--arch=${stdenv.cross.arch}"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
passthru = { inherit vdpauSupport; };
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = http://libav.org/;
|
|
|
|
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;
|
2014-08-08 19:58:34 +04:00
|
|
|
platforms = platforms.linux;
|
2014-02-04 00:43:55 +04:00
|
|
|
maintainers = [ maintainers.vcunat ];
|
2013-08-17 09:17:44 +04:00
|
|
|
};
|
|
|
|
}; # libavFun
|
|
|
|
|
|
|
|
in result
|
|
|
|
|