Merge pull request #189646 from SuperSandro2000/ffmpeg
This commit is contained in:
@@ -1,17 +1,12 @@
|
||||
{ callPackage, fetchpatch
|
||||
# Darwin frameworks
|
||||
, Cocoa, CoreMedia, VideoToolbox
|
||||
, stdenv, lib
|
||||
, ...
|
||||
}@args:
|
||||
{ callPackage, fetchpatch, ... }@args:
|
||||
|
||||
callPackage ./generic.nix (rec {
|
||||
version = "4.4.2";
|
||||
branch = version;
|
||||
sha256 = "sha256-+YpIJSDEdQdSGpB5FNqp77wThOBZG1r8PaGKqJfeKUg=";
|
||||
darwinFrameworks = [ Cocoa CoreMedia VideoToolbox ];
|
||||
|
||||
patches = [
|
||||
# sdl2 recently changed their versioning
|
||||
# SDL2 recently changed their versioning
|
||||
(fetchpatch {
|
||||
url = "https://git.videolan.org/?p=ffmpeg.git;a=patch;h=e5163b1d34381a3319214a902ef1df923dd2eeba";
|
||||
hash = "sha256-nLhP2+34cj5EgpnUrePZp60nYAxmbhZAEDfay4pBVk0=";
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
{ callPackage
|
||||
# Darwin frameworks
|
||||
, Cocoa, CoreMedia, VideoToolbox
|
||||
, ...
|
||||
}@args:
|
||||
{ callPackage, ... }@args:
|
||||
|
||||
callPackage ./generic.nix (rec {
|
||||
version = "5.1.2";
|
||||
branch = version;
|
||||
sha256 = "sha256-OaC8yNmFSfFsVwYkZ4JGpqxzbAZs69tAn5UC6RWyLys=";
|
||||
darwinFrameworks = [ Cocoa CoreMedia VideoToolbox ];
|
||||
} // args)
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
{ lib, stdenv, buildPackages, fetchurl, pkg-config, addOpenGLRunpath, perl, texinfo, yasm
|
||||
, alsa-lib, bzip2, fontconfig, freetype, gnutls, libiconv, lame, libass, libogg
|
||||
, libssh, libtheora, libva, libdrm, libvorbis, libvpx, xz, soxr
|
||||
, libssh, libtheora, libva, libdrm, libvorbis, xz, soxr
|
||||
, x264, x265, xvidcore, zimg, zlib, libopus, speex, nv-codec-headers, dav1d
|
||||
, srt ? null
|
||||
, openglSupport ? false, libGLU ? null, libGL ? null
|
||||
, libmfxSupport ? false, intel-media-sdk ? null
|
||||
, libaomSupport ? false, libaom ? null
|
||||
, vpxSupport ? !stdenv.isAarch32, libvpx
|
||||
, srtSupport ? true, srt
|
||||
, vaapiSupport ? ((stdenv.isLinux || stdenv.isFreeBSD) && !stdenv.isAarch32)
|
||||
, openglSupport ? false, libGLU, libGL
|
||||
, libmfxSupport ? false, intel-media-sdk
|
||||
, libaomSupport ? false, libaom
|
||||
# Build options
|
||||
, runtimeCpuDetectBuild ? true # Detect CPU capabilities at runtime
|
||||
, multithreadBuild ? true # Multithreading via pthreads/win32 threads
|
||||
, sdlSupport ? !stdenv.isAarch32, SDL ? null, SDL2 ? null
|
||||
, vdpauSupport ? !stdenv.isAarch32, libvdpau ? null
|
||||
, sdlSupport ? !stdenv.isAarch32, SDL2
|
||||
, vdpauSupport ? !stdenv.isAarch32, libvdpau
|
||||
# Developer options
|
||||
, debugDeveloper ? false
|
||||
, optimizationsDeveloper ? true
|
||||
, extraWarningsDeveloper ? false
|
||||
# Darwin frameworks
|
||||
, Cocoa, darwinFrameworks ? [ Cocoa ]
|
||||
, Cocoa, CoreMedia, VideoToolbox
|
||||
# Inherit generics
|
||||
, branch, sha256, version, patches ? [], knownVulnerabilities ? []
|
||||
, doCheck ? true
|
||||
@@ -35,12 +36,6 @@
|
||||
* pulseaudio
|
||||
*
|
||||
* Known issues:
|
||||
* 0.6 - fails to compile (unresolved) (so far, only disabling a number of
|
||||
* features works, but that is not a feasible solution)
|
||||
* 0.6.90 - mmx: compile errors (fix: disable for 0.6.90-rc0)
|
||||
* 1.1 - libsoxr: compile error (fix: disable for 1.1)
|
||||
* Support was initially added in 1.1 before soxr api change, fix
|
||||
* would probably be to add soxr-1.0
|
||||
* ALL - Cross-compiling will disable features not present on host OS
|
||||
* (e.g. dxva2 support [DirectX] will not be enabled unless natively
|
||||
* compiled on Cygwin)
|
||||
@@ -48,34 +43,16 @@
|
||||
*/
|
||||
|
||||
let
|
||||
inherit (stdenv) isDarwin isFreeBSD isLinux isAarch32;
|
||||
inherit (lib) optional optionals optionalString enableFeature filter;
|
||||
|
||||
cmpVer = builtins.compareVersions;
|
||||
reqMin = requiredVersion: (cmpVer requiredVersion branch != 1);
|
||||
reqMatch = requiredVersion: (cmpVer requiredVersion branch == 0);
|
||||
reqMin = requiredVersion: (builtins.compareVersions requiredVersion branch != 1);
|
||||
|
||||
ifMinVer = minVer: flag: if reqMin minVer then flag else null;
|
||||
|
||||
ifVerOlder = maxVer: flag: if (lib.versionOlder branch maxVer) then flag else null;
|
||||
|
||||
# Version specific fix
|
||||
verFix = withoutFix: fixVer: withFix: if reqMatch fixVer then withFix else withoutFix;
|
||||
|
||||
# Disable dependency that needs fixes before it will work on Darwin or Arm
|
||||
disDarwinOrArmFix = origArg: minVer: fixArg: if ((isDarwin || isAarch32) && reqMin minVer) then fixArg else origArg;
|
||||
|
||||
vaapiSupport = reqMin "0.6" && ((isLinux || isFreeBSD) && !isAarch32);
|
||||
|
||||
vpxSupport = reqMin "0.6" && !isAarch32;
|
||||
in
|
||||
|
||||
assert openglSupport -> libGL != null && libGLU != null;
|
||||
assert libmfxSupport -> intel-media-sdk != null;
|
||||
assert libaomSupport -> libaom != null;
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
|
||||
pname = "ffmpeg";
|
||||
inherit version;
|
||||
|
||||
@@ -87,8 +64,7 @@ stdenv.mkDerivation rec {
|
||||
postPatch = "patchShebangs .";
|
||||
inherit patches;
|
||||
|
||||
outputs = [ "bin" "dev" "out" "man" ]
|
||||
++ optional (reqMin "1.0") "doc" ; # just dev-doc
|
||||
outputs = [ "bin" "dev" "out" "man" "doc" ];
|
||||
setOutputFlags = false; # doesn't accept all and stores configureFlags in libs!
|
||||
|
||||
configurePlatforms = [];
|
||||
@@ -100,8 +76,8 @@ stdenv.mkDerivation rec {
|
||||
"--enable-version3"
|
||||
# Build flags
|
||||
"--enable-shared"
|
||||
(ifMinVer "0.6" "--enable-pic")
|
||||
(ifMinVer "4.0" (enableFeature (srt != null) "libsrt"))
|
||||
"--enable-pic"
|
||||
(ifMinVer "4.0" (enableFeature srtSupport "libsrt"))
|
||||
(enableFeature runtimeCpuDetectBuild "runtime-cpudetect")
|
||||
"--enable-hardcoded-tables"
|
||||
] ++
|
||||
@@ -113,63 +89,61 @@ stdenv.mkDerivation rec {
|
||||
else
|
||||
["--disable-pthreads" "--disable-w32threads"])
|
||||
++ [
|
||||
(ifMinVer "0.9" "--disable-os2threads") # We don't support OS/2
|
||||
"--disable-os2threads" # We don't support OS/2
|
||||
"--enable-network"
|
||||
(ifMinVer "2.4" "--enable-pixelutils")
|
||||
"--enable-pixelutils"
|
||||
# Executables
|
||||
"--enable-ffmpeg"
|
||||
"--disable-ffplay"
|
||||
(ifMinVer "0.6" "--enable-ffprobe")
|
||||
(if reqMin "4" then null else "--disable-ffserver")
|
||||
"--enable-ffprobe"
|
||||
(ifVerOlder "4" "--disable-ffserver")
|
||||
# Libraries
|
||||
(ifMinVer "0.6" "--enable-avcodec")
|
||||
(ifMinVer "0.6" "--enable-avdevice")
|
||||
"--enable-avcodec"
|
||||
"--enable-avdevice"
|
||||
"--enable-avfilter"
|
||||
(ifMinVer "0.6" "--enable-avformat")
|
||||
(ifMinVer "1.0" (ifVerOlder "5.0" "--enable-avresample"))
|
||||
(ifMinVer "1.1" "--enable-avutil")
|
||||
"--enable-avformat"
|
||||
(ifVerOlder "5.0" "--enable-avresample")
|
||||
"--enable-avutil"
|
||||
"--enable-postproc"
|
||||
(ifMinVer "0.9" "--enable-swresample")
|
||||
"--enable-swresample"
|
||||
"--enable-swscale"
|
||||
# Docs
|
||||
(ifMinVer "0.6" "--disable-doc")
|
||||
"--disable-doc"
|
||||
# External Libraries
|
||||
"--enable-libass"
|
||||
"--enable-bzlib"
|
||||
"--enable-gnutls"
|
||||
(ifMinVer "1.0" "--enable-fontconfig")
|
||||
(ifMinVer "0.7" "--enable-libfreetype")
|
||||
"--enable-fontconfig"
|
||||
"--enable-libfreetype"
|
||||
"--enable-libmp3lame"
|
||||
(ifMinVer "1.2" "--enable-iconv")
|
||||
"--enable-iconv"
|
||||
"--enable-libtheora"
|
||||
(ifMinVer "2.1" "--enable-libssh")
|
||||
(ifMinVer "0.6" (enableFeature vaapiSupport "vaapi"))
|
||||
(ifMinVer "3.4" (enableFeature vaapiSupport "libdrm"))
|
||||
"--enable-libssh"
|
||||
(enableFeature vaapiSupport "vaapi")
|
||||
(enableFeature vaapiSupport "libdrm")
|
||||
(enableFeature vdpauSupport "vdpau")
|
||||
"--enable-libvorbis"
|
||||
(ifMinVer "0.6" (enableFeature vpxSupport "libvpx"))
|
||||
(ifMinVer "2.4" "--enable-lzma")
|
||||
(ifMinVer "2.2" (enableFeature openglSupport "opengl"))
|
||||
(enableFeature vpxSupport "libvpx")
|
||||
"--enable-lzma"
|
||||
(enableFeature openglSupport "opengl")
|
||||
(ifMinVer "4.2" (enableFeature libmfxSupport "libmfx"))
|
||||
(ifMinVer "4.2" (enableFeature libaomSupport "libaom"))
|
||||
(disDarwinOrArmFix (ifMinVer "0.9" (lib.optionalString pulseaudioSupport "--enable-libpulse")) "0.9" "--disable-libpulse")
|
||||
(ifMinVer "2.5" (if sdlSupport && reqMin "3.2" then "--enable-sdl2" else if sdlSupport then "--enable-sdl" else null)) # autodetected before 2.5, SDL1 support removed in 3.2 for SDL2
|
||||
(ifMinVer "1.2" "--enable-libsoxr")
|
||||
(lib.optionalString pulseaudioSupport "--enable-libpulse")
|
||||
(enableFeature sdlSupport "sdl2")
|
||||
"--enable-libsoxr"
|
||||
"--enable-libx264"
|
||||
"--enable-libxvid"
|
||||
"--enable-libzimg"
|
||||
"--enable-zlib"
|
||||
(ifMinVer "2.8" "--enable-libopus")
|
||||
"--enable-libopus"
|
||||
"--enable-libspeex"
|
||||
(ifMinVer "2.8" "--enable-libx265")
|
||||
(ifMinVer "4.2" (enableFeature (dav1d != null) "libdav1d"))
|
||||
"--enable-libx265"
|
||||
(ifMinVer "4.2" (enableFeature (reqMin "4.2") "libdav1d"))
|
||||
# Developer flags
|
||||
(enableFeature debugDeveloper "debug")
|
||||
(enableFeature optimizationsDeveloper "optimizations")
|
||||
(enableFeature extraWarningsDeveloper "extra-warnings")
|
||||
"--disable-stripping"
|
||||
# Disable mmx support for 0.6.90
|
||||
(verFix null "0.6.90" "--disable-mmx")
|
||||
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||
"--cross-prefix=${stdenv.cc.targetPrefix}"
|
||||
"--enable-cross-compile"
|
||||
@@ -180,18 +154,18 @@ stdenv.mkDerivation rec {
|
||||
|
||||
buildInputs = [
|
||||
bzip2 fontconfig freetype gnutls libiconv lame libass libogg libssh libtheora
|
||||
libvorbis xz soxr x264 x265 xvidcore zimg zlib libopus speex srt nv-codec-headers
|
||||
libvorbis xz soxr x264 x265 xvidcore zimg zlib libopus speex nv-codec-headers
|
||||
] ++ optionals openglSupport [ libGL libGLU ]
|
||||
++ optional libmfxSupport intel-media-sdk
|
||||
++ optional libaomSupport libaom
|
||||
++ optional vpxSupport libvpx
|
||||
++ optionals (!isDarwin && !isAarch32 && pulseaudioSupport) [ libpulseaudio ] # Need to be fixed on Darwin and ARM
|
||||
++ optional ((isLinux || isFreeBSD) && !isAarch32) libva
|
||||
++ optional ((isLinux || isFreeBSD) && !isAarch32) libdrm
|
||||
++ optional isLinux alsa-lib
|
||||
++ optionals isDarwin darwinFrameworks
|
||||
++ optionals (!stdenv.isDarwin && !stdenv.isAarch32 && pulseaudioSupport) [ libpulseaudio ] # Need to be fixed on Darwin and ARM
|
||||
++ optionals vaapiSupport [ libva libdrm ]
|
||||
++ optional stdenv.isLinux alsa-lib
|
||||
++ optionals stdenv.isDarwin [ Cocoa CoreMedia VideoToolbox ]
|
||||
++ optional vdpauSupport libvdpau
|
||||
++ optional sdlSupport (if reqMin "3.2" then SDL2 else SDL)
|
||||
++ optional sdlSupport SDL2
|
||||
++ optional srtSupport srt
|
||||
++ optional (reqMin "4.2") dav1d;
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
Reference in New Issue
Block a user