2016-03-18 06:49:38 +00:00
|
|
|
{ stdenv, fetchurl, pkgconfig, yasm, bzip2, zlib, perl
|
2013-08-17 05:17:44 +00:00
|
|
|
, 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 12:20:34 +00:00
|
|
|
}:
|
|
|
|
|
2013-08-17 05:17:44 +00:00
|
|
|
assert faacSupport -> enableUnfree;
|
2011-07-15 12:20:34 +00:00
|
|
|
|
2013-08-17 05:17:44 +00:00
|
|
|
with { inherit (stdenv.lib) optional optionals; };
|
2011-07-15 12:20:34 +00:00
|
|
|
|
2013-08-17 05:17:44 +00:00
|
|
|
/* ToDo:
|
|
|
|
- more deps, inspiration: http://packages.ubuntu.com/raring/libav-tools
|
|
|
|
- maybe do some more splitting into outputs
|
|
|
|
*/
|
|
|
|
|
|
|
|
let
|
|
|
|
result = {
|
2015-03-12 19:14:44 +00:00
|
|
|
libav_0_8 = libavFun "0.8.17" "31ace2daeb8c105deed9cd3476df47318d417714";
|
|
|
|
libav_9 = libavFun "9.18" "e10cde4587c4d4d3bb11d30c7b47e953664cd714";
|
2015-06-02 09:02:11 +00:00
|
|
|
libav_11 = libavFun "11.4" "c2ab12102de187f2675a56b828b4a5e9136ab747";
|
2011-07-15 12:20:34 +00:00
|
|
|
};
|
2013-08-17 05:17:44 +00:00
|
|
|
|
2014-09-13 19:05:16 +00:00
|
|
|
libavFun = version : sha1 : stdenv.mkDerivation rec {
|
2013-08-17 05:17:44 +00:00
|
|
|
name = "libav-${version}";
|
|
|
|
|
|
|
|
src = fetchurl {
|
2014-02-03 20:43:55 +00:00
|
|
|
url = "${meta.homepage}/releases/${name}.tar.xz";
|
2014-09-13 19:05:16 +00:00
|
|
|
inherit sha1; # upstream directly provides sha1 of releases over https
|
2013-08-17 05:17:44 +00:00
|
|
|
};
|
|
|
|
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"
|
2016-03-18 06:49:38 +00:00
|
|
|
"--cc=cc"
|
2013-08-17 05:17:44 +00:00
|
|
|
]
|
|
|
|
++ 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 ]
|
2016-03-18 06:49:38 +00:00
|
|
|
++ [ perl ] # for install-man target
|
2013-08-17 05:17:44 +00:00
|
|
|
++ 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" ];
|
|
|
|
|
2016-03-18 06:49:38 +00:00
|
|
|
# alltools to build smaller tools, incl. aviocat, ismindex, qt-faststart, etc.
|
|
|
|
buildFlags = "all alltools install-man";
|
|
|
|
|
2013-08-17 05:17:44 +00:00
|
|
|
postInstall = ''
|
2016-03-18 06:49:38 +00:00
|
|
|
# move avplay to get rid of the SDL dependency in the main output
|
2013-08-17 05:17:44 +00:00
|
|
|
mkdir -p "$tools/bin"
|
|
|
|
mv "$out/bin/avplay" "$tools/bin"
|
2016-03-18 06:49:38 +00:00
|
|
|
|
|
|
|
# alltools target compiles an executable in tools/ for every C
|
|
|
|
# source file in tools/, so move those to $out
|
|
|
|
for tool in $(find tools -type f -executable); do
|
|
|
|
mv "$tool" "$out/bin/"
|
|
|
|
done
|
2013-08-17 05:17:44 +00:00
|
|
|
'';
|
|
|
|
|
2014-05-07 12:02:25 +00:00
|
|
|
doInstallCheck = false; # fails randomly
|
2013-08-17 05:17:44 +00: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;
|
2016-03-18 06:49:38 +00:00
|
|
|
platforms = with platforms; linux ++ darwin;
|
2014-02-03 20:43:55 +00:00
|
|
|
maintainers = [ maintainers.vcunat ];
|
2013-08-17 05:17:44 +00:00
|
|
|
};
|
|
|
|
}; # libavFun
|
|
|
|
|
|
|
|
in result
|