From d32cb37277093e405e93e3cd69807a3a07873e80 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Sun, 5 Nov 2023 16:51:57 +0100 Subject: sdl2: record provided pkg-config modules in meta This is verified using testers.hasPkgConfigModules which leads to a slight refactor of the expression. --- pkgs/development/libraries/SDL2/default.nix | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pkgs/development/libraries/SDL2/default.nix b/pkgs/development/libraries/SDL2/default.nix index 7b741b803de..d74ab371bb1 100644 --- a/pkgs/development/libraries/SDL2/default.nix +++ b/pkgs/development/libraries/SDL2/default.nix @@ -49,19 +49,21 @@ , audiofile , libiconv , withStatic ? false +# passthru.tests +, testers }: # NOTE: When editing this expression see if the same change applies to # SDL expression too -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "SDL2"; version = "2.28.3"; src = fetchFromGitHub { owner = "libsdl-org"; repo = "SDL"; - rev = "release-${version}"; + rev = "release-${finalAttrs.version}"; hash = "sha256-/kQ2IyvAfmZ+zIUt1WuEIeX0nYPGXDlAQk2qDsQnFFs="; }; dontDisableStatic = if withStatic then 1 else 0; @@ -96,7 +98,7 @@ stdenv.mkDerivation rec { ++ lib.optionals x11Support [ libX11 ]; propagatedBuildInputs = lib.optionals x11Support [ xorgproto ] - ++ dlopenPropagatedBuildInputs; + ++ finalAttrs.dlopenPropagatedBuildInputs; dlopenBuildInputs = lib.optionals alsaSupport [ alsa-lib audiofile ] ++ lib.optional dbusSupport dbus @@ -109,7 +111,7 @@ stdenv.mkDerivation rec { ++ lib.optionals drmSupport [ libdrm mesa ]; buildInputs = [ libiconv ] - ++ dlopenBuildInputs + ++ finalAttrs.dlopenBuildInputs ++ lib.optional ibusSupport ibus ++ lib.optionals waylandSupport [ wayland-protocols ] ++ lib.optionals stdenv.isDarwin [ AudioUnit Cocoa CoreAudio CoreServices ForceFeedback OpenGL ]; @@ -156,7 +158,7 @@ stdenv.mkDerivation rec { # list the symbols used in this way. postFixup = let - rpath = lib.makeLibraryPath (dlopenPropagatedBuildInputs ++ dlopenBuildInputs); + rpath = lib.makeLibraryPath (finalAttrs.dlopenPropagatedBuildInputs ++ finalAttrs.dlopenBuildInputs); in lib.optionalString (stdenv.hostPlatform.extensions.sharedLibrary == ".so") '' for lib in $out/lib/*.so* ; do @@ -171,6 +173,9 @@ stdenv.mkDerivation rec { passthru = { inherit openglSupport; updateScript = nix-update-script { extraArgs = ["--version-regex" "release-(.*)"]; }; + tests.pkg-config = testers.hasPkgConfigModules { + package = finalAttrs.finalPackage; + }; }; meta = with lib; { @@ -180,5 +185,6 @@ stdenv.mkDerivation rec { license = licenses.zlib; platforms = platforms.all; maintainers = with maintainers; [ cpages ]; + pkgConfigModules = [ "sdl2" ]; }; -} +}) -- cgit 1.4.1