Making ffmpeg friendly for arm.

This commit is contained in:
Lluís Batlle i Rossell 2016-03-22 15:00:36 +01:00 committed by Lluís Batlle i Rossell
parent 40b0538239
commit bd58b895e0

View File

@ -1,11 +1,13 @@
{ stdenv, fetchurl, pkgconfig, perl, texinfo, yasm { stdenv, fetchurl, pkgconfig, perl, texinfo, yasm
, alsaLib, bzip2, fontconfig, freetype, gnutls, libiconv, lame, libass, libogg , alsaLib, bzip2, fontconfig, freetype, gnutls, libiconv, lame, libass, libogg
, libtheora, libva, libvdpau, libvorbis, libvpx, lzma, libpulseaudio, SDL, soxr , libtheora, libva, libvorbis, libvpx, lzma, libpulseaudio, soxr
, x264, xvidcore, zlib , x264, xvidcore, zlib
, openglSupport ? false, mesa ? null , openglSupport ? false, mesa ? null
# Build options # Build options
, runtimeCpuDetectBuild ? true # Detect CPU capabilities at runtime , runtimeCpuDetectBuild ? true # Detect CPU capabilities at runtime
, multithreadBuild ? true # Multithreading via pthreads/win32 threads , multithreadBuild ? true # Multithreading via pthreads/win32 threads
, sdlSupport ? !stdenv.isArm, SDL ? null
, vdpauSupport ? !stdenv.isArm, libvdpau ? null
# Developer options # Developer options
, debugDeveloper ? false , debugDeveloper ? false
, optimizationsDeveloper ? true , optimizationsDeveloper ? true
@ -39,7 +41,7 @@
*/ */
let let
inherit (stdenv) icCygwin isDarwin isFreeBSD isLinux; inherit (stdenv) icCygwin isDarwin isFreeBSD isLinux isArm;
inherit (stdenv.lib) optional optionals enableFeature; inherit (stdenv.lib) optional optionals enableFeature;
cmpVer = builtins.compareVersions; cmpVer = builtins.compareVersions;
@ -51,8 +53,8 @@ let
# Version specific fix # Version specific fix
verFix = withoutFix: fixVer: withFix: if reqMatch fixVer then withFix else withoutFix; verFix = withoutFix: fixVer: withFix: if reqMatch fixVer then withFix else withoutFix;
# Disable dependency that needs fixes before it will work on Darwin # Disable dependency that needs fixes before it will work on Darwin or Arm
disDarwinFix = origArg: minVer: fixArg: if (isDarwin && reqMin minVer) then fixArg else origArg; disDarwinOrArmFix = origArg: minVer: fixArg: if ((isDarwin || isArm) && reqMin minVer) then fixArg else origArg;
in in
assert openglSupport -> mesa != null; assert openglSupport -> mesa != null;
@ -117,11 +119,11 @@ stdenv.mkDerivation rec {
(ifMinVer "0.6" (enableFeature (isLinux || isFreeBSD) "vaapi")) (ifMinVer "0.6" (enableFeature (isLinux || isFreeBSD) "vaapi"))
"--enable-vdpau" "--enable-vdpau"
"--enable-libvorbis" "--enable-libvorbis"
(disDarwinFix (ifMinVer "0.6" "--enable-libvpx") "0.6" "--disable-libvpx") (disDarwinOrArmFix (ifMinVer "0.6" "--enable-libvpx") "0.6" "--disable-libvpx")
(ifMinVer "2.4" "--enable-lzma") (ifMinVer "2.4" "--enable-lzma")
(ifMinVer "2.2" (enableFeature openglSupport "opengl")) (ifMinVer "2.2" (enableFeature openglSupport "opengl"))
(disDarwinFix (ifMinVer "0.9" "--enable-libpulse") "0.9" "--disable-libpulse") (disDarwinOrArmFix (ifMinVer "0.9" "--enable-libpulse") "0.9" "--disable-libpulse")
(ifMinVer "2.5" "--enable-sdl") # Only configurable since 2.5, auto detected before then (ifMinVer "2.5" (if sdlSupport then "--enable-sdl" else "")) # Only configurable since 2.5, auto detected before then
(ifMinVer "1.2" "--enable-libsoxr") (ifMinVer "1.2" "--enable-libsoxr")
"--enable-libx264" "--enable-libx264"
"--enable-libxvid" "--enable-libxvid"
@ -141,10 +143,13 @@ stdenv.mkDerivation rec {
bzip2 fontconfig freetype gnutls libiconv lame libass libogg libtheora bzip2 fontconfig freetype gnutls libiconv lame libass libogg libtheora
libvdpau libvorbis lzma SDL soxr x264 xvidcore zlib libvdpau libvorbis lzma SDL soxr x264 xvidcore zlib
] ++ optional openglSupport mesa ] ++ optional openglSupport mesa
++ optionals (!isDarwin) [ libvpx libpulseaudio ] # Need to be fixed on Darwin ++ optionals (!isDarwin && !isArm) [ libvpx libpulseaudio ] # Need to be fixed on Darwin and ARM
++ optional (isLinux || isFreeBSD) libva ++ optional ((isLinux || isFreeBSD) && !isArm) libva
++ optional isLinux alsaLib ++ optional isLinux alsaLib
++ optional isDarwin Cocoa; ++ optional isDarwin Cocoa
++ optional vdpauSupport libvdpau
++ optional sdlSupport SDL;
enableParallelBuilding = true; enableParallelBuilding = true;
@ -178,8 +183,8 @@ stdenv.mkDerivation rec {
}; };
passthru = { passthru = {
vaapiSupport = if reqMin "0.6" && (isLinux || isFreeBSD) then true else false; vaapiSupport = if reqMin "0.6" && ((isLinux || isFreeBSD) && !isArm) then true else false;
vdpauSupport = true; inherit vdpauSupport;
}; };
meta = with stdenv.lib; { meta = with stdenv.lib; {