From 796313656cd9b5e2d0915f89f41c129d3f58f193 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sun, 12 Feb 2023 15:05:20 -0500 Subject: [PATCH] ffmpeg: Add `meta.pkgConfigModules` and test --- pkgs/development/libraries/ffmpeg/generic.nix | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix index dceada0f7f8f..d0374c74901e 100644 --- a/pkgs/development/libraries/ffmpeg/generic.nix +++ b/pkgs/development/libraries/ffmpeg/generic.nix @@ -266,6 +266,10 @@ , MediaToolbox , VideoDecodeAcceleration , VideoToolbox +/* + * Testing + */ +, testers }: /* Maintainer notes: @@ -321,13 +325,13 @@ assert buildAvformat -> buildAvcodec && buildAvutil; # configure flag since 0.6 assert buildPostproc -> buildAvutil; assert buildSwscale -> buildAvutil; -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "ffmpeg" + (if ffmpegVariant == "small" then "" else "-${ffmpegVariant}"); inherit version; src = fetchgit { url = "https://git.ffmpeg.org/ffmpeg.git"; - rev = "n${version}"; + rev = "n${finalAttrs.version}"; inherit sha256; }; @@ -522,7 +526,7 @@ stdenv.mkDerivation rec { # outputs where we don't want them. Patch the generated config.h to remove all # such references except for data. postConfigure = let - toStrip = lib.remove "data" outputs; # We want to keep references to the data dir. + toStrip = lib.remove "data" finalAttrs.outputs; # We want to keep references to the data dir. in "remove-references-to ${lib.concatStringsSep " " (map (o: "-t ${placeholder o}") toStrip)} config.h"; @@ -656,6 +660,8 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; + passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; + meta = with lib; { description = "A complete, cross-platform solution to record, convert and stream audio and video"; homepage = "https://www.ffmpeg.org/"; @@ -671,7 +677,8 @@ stdenv.mkDerivation rec { ++ optional withGPL gpl2Plus ++ optional withGPLv3 gpl3Plus ++ optional withUnfree unfreeRedistributable; + pkgConfigModules = [ "libavutil" ]; platforms = platforms.all; maintainers = with maintainers; [ atemu ]; }; -} +})