2016-03-18 07:49:38 +01:00
|
|
|
{ stdenv, fetchurl, pkgconfig, yasm, bzip2, zlib, perl
|
2013-08-17 07:17:44 +02: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
|
2015-10-28 14:15:44 +01:00
|
|
|
, vaapiSupport ? true, libva ? null
|
2013-08-17 07:17:44 +02:00
|
|
|
, vdpauSupport ? true, libvdpau ? null
|
|
|
|
, freetypeSupport ? true, freetype ? null # it's small and almost everywhere
|
2014-08-30 23:30:31 +02:00
|
|
|
, SDL # only for avplay in $bin, adds nontrivial closure to it
|
2013-08-17 07:17:44 +02:00
|
|
|
, enableGPL ? true # ToDo: some additional default stuff may need GPL
|
|
|
|
, enableUnfree ? faacSupport
|
2017-06-28 22:13:11 +02:00
|
|
|
, hostPlatform
|
2011-07-15 14:20:34 +02:00
|
|
|
}:
|
|
|
|
|
2013-08-17 07:17:44 +02:00
|
|
|
assert faacSupport -> enableUnfree;
|
2011-07-15 14:20:34 +02:00
|
|
|
|
2017-02-09 02:52:13 +01:00
|
|
|
let inherit (stdenv.lib) optional optionals hasPrefix; in
|
2011-07-15 14:20:34 +02:00
|
|
|
|
2013-08-17 07:17:44 +02:00
|
|
|
/* ToDo:
|
|
|
|
- more deps, inspiration: http://packages.ubuntu.com/raring/libav-tools
|
|
|
|
- maybe do some more splitting into outputs
|
|
|
|
*/
|
|
|
|
|
|
|
|
let
|
|
|
|
result = {
|
2017-01-26 00:27:10 +01:00
|
|
|
libav_0_8 = libavFun "0.8.20" "0c7a2417c3a01eb74072691bb93ce802ae1be08f";
|
2017-07-05 17:37:39 +02:00
|
|
|
libav_11 = libavFun "11.10" "38db6721ca8423682e4d614c170eccc33ba32e00";
|
2017-01-15 17:43:00 +01:00
|
|
|
libav_12 = libavFun "12" "4ecde7274621c82a6882b7614d907b28de25cc4e";
|
2011-07-15 14:20:34 +02:00
|
|
|
};
|
2013-08-17 07:17:44 +02:00
|
|
|
|
2014-09-13 21:05:16 +02:00
|
|
|
libavFun = version : sha1 : stdenv.mkDerivation rec {
|
2013-08-17 07:17:44 +02:00
|
|
|
name = "libav-${version}";
|
|
|
|
|
|
|
|
src = fetchurl {
|
2014-02-03 21:43:55 +01:00
|
|
|
url = "${meta.homepage}/releases/${name}.tar.xz";
|
2014-09-13 21:05:16 +02:00
|
|
|
inherit sha1; # upstream directly provides sha1 of releases over https
|
2013-08-17 07:17:44 +02:00
|
|
|
};
|
2016-03-21 09:56:25 +01:00
|
|
|
|
2016-05-01 18:22:40 +02:00
|
|
|
patches = []
|
2016-06-22 10:24:26 +02:00
|
|
|
++ optional (vpxSupport && hasPrefix "0.8." version) ./vpxenc-0.8.17-libvpx-1.5.patch
|
2017-04-18 18:50:40 +02:00
|
|
|
;
|
2016-05-01 18:22:40 +02:00
|
|
|
|
2016-03-21 09:56:25 +01:00
|
|
|
preConfigure = "patchShebangs doc/texi2pod.pl";
|
|
|
|
|
2013-08-17 07:17:44 +02: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 07:49:38 +01:00
|
|
|
"--cc=cc"
|
2013-08-17 07:17:44 +02: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 07:49:38 +01:00
|
|
|
++ [ perl ] # for install-man target
|
2013-08-17 07:17:44 +02: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;
|
|
|
|
|
2016-08-29 02:30:01 +02:00
|
|
|
outputs = [ "bin" "dev" "out" ];
|
2015-10-04 11:29:37 +02:00
|
|
|
setOutputFlags = false;
|
2013-08-17 07:17:44 +02:00
|
|
|
|
2016-03-18 07:49:38 +01:00
|
|
|
# alltools to build smaller tools, incl. aviocat, ismindex, qt-faststart, etc.
|
|
|
|
buildFlags = "all alltools install-man";
|
|
|
|
|
2013-08-17 07:17:44 +02:00
|
|
|
postInstall = ''
|
2016-04-01 10:06:01 +02:00
|
|
|
moveToOutput bin "$bin"
|
2016-03-18 07:49:38 +01: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
|
2016-04-01 10:06:01 +02:00
|
|
|
mv "$tool" "$bin/bin/"
|
2016-03-18 07:49:38 +01:00
|
|
|
done
|
2013-08-17 07:17:44 +02:00
|
|
|
'';
|
|
|
|
|
2014-05-07 14:02:25 +02:00
|
|
|
doInstallCheck = false; # fails randomly
|
2013-08-17 07:17:44 +02:00
|
|
|
installCheckTarget = "check"; # tests need to be run *after* installation
|
|
|
|
|
|
|
|
crossAttrs = {
|
2017-04-26 06:06:11 +02:00
|
|
|
configurePlatforms = [];
|
2013-08-17 07:17:44 +02:00
|
|
|
configureFlags = configureFlags ++ [
|
2017-06-28 22:13:11 +02:00
|
|
|
"--cross-prefix=${stdenv.cc.prefix}"
|
2013-08-17 07:17:44 +02:00
|
|
|
"--enable-cross-compile"
|
|
|
|
"--target_os=linux"
|
2017-06-28 22:13:11 +02:00
|
|
|
"--arch=${hostPlatform.arch}"
|
2013-08-17 07:17:44 +02:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
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 07:49:38 +01:00
|
|
|
platforms = with platforms; linux ++ darwin;
|
2014-02-03 21:43:55 +01:00
|
|
|
maintainers = [ maintainers.vcunat ];
|
2013-08-17 07:17:44 +02:00
|
|
|
};
|
|
|
|
}; # libavFun
|
|
|
|
|
|
|
|
in result
|