about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAtemu <atemu.main@gmail.com>2024-03-13 19:39:21 +0100
committerAtemu <atemu.main@gmail.com>2024-03-13 19:49:15 +0100
commit883295650adf2b7b718a2461261809182de7d4b0 (patch)
tree2dda374a86d3779306058df8f654d62b13a39e1c
parent4ee0840ba2ecc50458ab1677d108afcd691f4815 (diff)
ffmpeg: move extraPatches to generic drv
This effectively obsoletes extraPatches
-rw-r--r--pkgs/development/libraries/ffmpeg/4.nix26
-rw-r--r--pkgs/development/libraries/ffmpeg/generic.nix27
2 files changed, 27 insertions, 26 deletions
diff --git a/pkgs/development/libraries/ffmpeg/4.nix b/pkgs/development/libraries/ffmpeg/4.nix
index b5d169b59744d..3b587b20b6d6a 100644
--- a/pkgs/development/libraries/ffmpeg/4.nix
+++ b/pkgs/development/libraries/ffmpeg/4.nix
@@ -1,29 +1,5 @@
 import ./generic.nix {
   version = "4.4.4";
   hash = "sha256-Q8bkuF/1uJfqttJJoObnnLX3BEduv+qxsvOrVhMvRjA=";
-  extraPatches = [
-    {
-      name = "libsvtav1-1.5.0-compat-compressed_ten_bit_format.patch";
-      url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/031f1561cd286596cdb374da32f8aa816ce3b135";
-      hash = "sha256-mSnmAkoNikDpxcN+A/hpB7mUbbtcMvm4tG6gZFuroe8=";
-    }
-    {
-        # Backport fix for binutils-2.41.
-        name = "binutils-2.41.patch";
-        url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/effadce6c756247ea8bae32dc13bb3e6f464f0eb";
-        hash = "sha256-vlBUMJ1bORQHRNpuzc5iXsTWwS/CN5BmGIA8g7H7mJE=";
-    }
-    # The upstream patch isn’t for ffmpeg 4, but it will apply with a few tweaks.
-    # Fixes a crash when built with clang 16 due to UB in ff_seek_frame_binary.
-    {
-      name = "utils-fix_crash_in_ff_seek_frame_binary.patch";
-      url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/ab792634197e364ca1bb194f9abe36836e42f12d";
-      hash = "sha256-UxZ4VneZpw+Q/UwkEUDNdb2nOx1QnMrZ40UagspNTxI=";
-      postFetch = ''
-        substituteInPlace "$out" \
-          --replace libavformat/seek.c libavformat/utils.c \
-          --replace 'const AVInputFormat *const ' 'const AVInputFormat *'
-      '';
-    }
-  ];
+  extraPatches = [ ];
 }
diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix
index 24ea17d0d86e0..5a4b4d8222bf3 100644
--- a/pkgs/development/libraries/ffmpeg/generic.nix
+++ b/pkgs/development/libraries/ffmpeg/generic.nix
@@ -305,7 +305,7 @@
  */
 
 let
-  inherit (lib) optional optionals optionalString enableFeature versionAtLeast;
+  inherit (lib) optional optionals optionalString enableFeature versionOlder versionAtLeast;
 in
 
 
@@ -363,6 +363,31 @@ stdenv.mkDerivation (finalAttrs: {
   '';
 
   patches = map (patch: fetchpatch patch) (extraPatches
+    ++ optionals (versionOlder version "5") [
+      {
+        name = "libsvtav1-1.5.0-compat-compressed_ten_bit_format.patch";
+        url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/031f1561cd286596cdb374da32f8aa816ce3b135";
+        hash = "sha256-mSnmAkoNikDpxcN+A/hpB7mUbbtcMvm4tG6gZFuroe8=";
+      }
+      {
+        # Backport fix for binutils-2.41.
+        name = "binutils-2.41.patch";
+        url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/effadce6c756247ea8bae32dc13bb3e6f464f0eb";
+        hash = "sha256-vlBUMJ1bORQHRNpuzc5iXsTWwS/CN5BmGIA8g7H7mJE=";
+      }
+      # The upstream patch isn’t for ffmpeg 4, but it will apply with a few tweaks.
+      # Fixes a crash when built with clang 16 due to UB in ff_seek_frame_binary.
+      {
+        name = "utils-fix_crash_in_ff_seek_frame_binary.patch";
+        url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/ab792634197e364ca1bb194f9abe36836e42f12d";
+        hash = "sha256-UxZ4VneZpw+Q/UwkEUDNdb2nOx1QnMrZ40UagspNTxI=";
+        postFetch = ''
+          substituteInPlace "$out" \
+            --replace libavformat/seek.c libavformat/utils.c \
+            --replace 'const AVInputFormat *const ' 'const AVInputFormat *'
+        '';
+      }
+    ]
     ++ (lib.optional (lib.versionAtLeast finalAttrs.version "6" && lib.versionOlder finalAttrs.version "6.1")
       { # this can be removed post 6.1
         name = "fix_aacps_tablegen";