From 46e469902c6061baaf6bbbdbda17803181c7b7b2 Mon Sep 17 00:00:00 2001 From: rvveber Date: Wed, 24 Dec 2025 19:57:38 +0100 Subject: [PATCH] untrunc-anthwlock: fix build to use `ffmpeg_6` and improve to use `pkg-config` (cherry picked from commit a192fc21ebd76b0eec5b2fa9d5fc69c68ffd14b6) --- pkgs/by-name/un/untrunc-anthwlock/package.nix | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/un/untrunc-anthwlock/package.nix b/pkgs/by-name/un/untrunc-anthwlock/package.nix index bd9dd27c9868..f18f9df61fe6 100644 --- a/pkgs/by-name/un/untrunc-anthwlock/package.nix +++ b/pkgs/by-name/un/untrunc-anthwlock/package.nix @@ -2,8 +2,9 @@ lib, stdenv, fetchFromGitHub, - ffmpeg, + ffmpeg_6, libui, + pkg-config, unstableGitUpdater, wrapGAppsHook3, }: @@ -19,13 +20,27 @@ stdenv.mkDerivation { hash = "sha256-4GIPj8so7POEwxKZzFBoJTu76XKbGHYmXC/ILeo0dVE="; }; - nativeBuildInputs = [ wrapGAppsHook3 ]; + nativeBuildInputs = [ + pkg-config + wrapGAppsHook3 + ]; buildInputs = [ - ffmpeg + # Uses ffmpeg internals; keep ffmpeg_6 until upstream supports newer API. + # Upstream fix: https://github.com/anthwlock/untrunc/pull/249 + ffmpeg_6 libui ]; + strictDeps = true; + + postPatch = '' + substituteInPlace Makefile \ + --replace "-isystem/usr/include/ffmpeg" "\$(shell pkg-config --cflags libavformat libavcodec libavutil libui)" \ + --replace "-lavformat -lavcodec -lavutil" "\$(shell pkg-config --libs libavformat libavcodec libavutil)" \ + --replace "-lui -lpthread" "\$(shell pkg-config --libs libui) -lpthread" + ''; + buildPhase = '' runHook preBuild make IS_RELEASE=1 untrunc @@ -50,6 +65,7 @@ stdenv.mkDerivation { description = "Restore a truncated mp4/mov (improved version of ponchio/untrunc)"; homepage = "https://github.com/anthwlock/untrunc"; license = lib.licenses.gpl2Only; + mainProgram = "untrunc"; platforms = lib.platforms.all; maintainers = [ lib.maintainers.romildo ]; };