about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAtemu <atemu.main@gmail.com>2023-02-07 12:53:37 +0100
committerAtemu <atemu.main@gmail.com>2023-02-07 13:47:29 +0100
commite968d033212ad82743a536189e84ea857762e7ae (patch)
treef7b0c34221d41cde0407bbde8b5d621148825426
parent5b5def96bc51b8ec0611fd69e010906d7c0966d6 (diff)
ffmpeg_4: enable avresample again
As noted in
https://github.com/NixOS/nixpkgs/pull/211834#issuecomment-1417435991, removing
the deprecated avresample causes some packages to break. Keep avresample in
ffmpeg_4 only for now (it's removed in ffmpeg_5).
-rw-r--r--pkgs/development/libraries/ffmpeg/generic.nix29
1 files changed, 22 insertions, 7 deletions
diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix
index 0acf45212e9dd..dceada0f7f8f4 100644
--- a/pkgs/development/libraries/ffmpeg/generic.nix
+++ b/pkgs/development/libraries/ffmpeg/generic.nix
@@ -140,6 +140,9 @@
 , buildAvdevice ? withHeadlessDeps # Build avdevice library
 , buildAvfilter ? withHeadlessDeps # Build avfilter library
 , buildAvformat ? withHeadlessDeps # Build avformat library
+# Deprecated but depended upon by some packages.
+# https://github.com/NixOS/nixpkgs/pull/211834#issuecomment-1417435991)
+, buildAvresample ? withHeadlessDeps && lib.versionOlder version "5" # Build avresample library
 , buildAvutil ? withHeadlessDeps # Build avutil library
 , buildPostproc ? withHeadlessDeps # Build postproc library
 , buildSwresample ? withHeadlessDeps # Build swresample library
@@ -301,11 +304,11 @@ assert withPixelutils -> buildAvutil;
 assert buildFfmpeg -> buildAvcodec
                      && buildAvfilter
                      && buildAvformat
-                     && buildSwresample;
+                     && (buildSwresample || buildAvresample);
 assert buildFfplay -> buildAvcodec
                      && buildAvformat
                      && buildSwscale
-                     && buildSwresample;
+                     && (buildSwresample || buildAvresample);
 assert buildFfprobe -> buildAvcodec && buildAvformat;
 /*
  *  Library dependencies
@@ -392,6 +395,10 @@ stdenv.mkDerivation rec {
     (enableFeature buildAvdevice "avdevice")
     (enableFeature buildAvfilter "avfilter")
     (enableFeature buildAvformat "avformat")
+  ] ++ optionals (lib.versionOlder version "5") [
+    # Ffmpeg > 4 doesn't know about the flag anymore
+    (enableFeature buildAvresample "avresample")
+  ] ++ [
     (enableFeature buildAvutil "avutil")
     (enableFeature (buildPostproc && withGPL) "postproc")
     (enableFeature buildSwresample "swresample")
@@ -611,14 +618,22 @@ stdenv.mkDerivation rec {
 
   doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
 
-  # Fails with SIGABRT otherwise
+  # Fails with SIGABRT otherwise FIXME: Why?
   checkPhase = let
     ldLibraryPathEnv = if stdenv.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH";
+    libsToLink = [ ]
+      ++ optional buildAvcodec "libavcodec"
+      ++ optional buildAvdevice "libavdevice"
+      ++ optional buildAvfilter "libavfilter"
+      ++ optional buildAvformat "libavformat"
+      ++ optional buildAvresample "libavresample"
+      ++ optional buildAvutil "libavutil"
+      ++ optional buildPostproc "libpostproc"
+      ++ optional buildSwresample "libswresample"
+      ++ optional buildSwscale "libswscale"
+    ;
   in ''
-    ${ldLibraryPathEnv}="libavcodec:libavdevice:libavfilter:libavformat:libavutil:libpostproc${
-      optionalString (withHeadlessDeps) ":libswresample" # TODO this can probably go away
-    }:libswscale:''${${ldLibraryPathEnv}}" \
-      make check -j$NIX_BUILD_CORES
+    ${ldLibraryPathEnv}="${lib.concatStringsSep ":" libsToLink}" make check -j$NIX_BUILD_CORES
   '';
 
   outputs = optionals withBin [ "bin" ] # The first output is the one that gets symlinked by default!