4949, audiofile
5050, libiconv
5151, withStatic ? false
52+ # passthru.tests
53+ , testers
5254} :
5355
5456# NOTE: When editing this expression see if the same change applies to
5557# SDL expression too
5658
57- stdenv . mkDerivation rec {
59+ stdenv . mkDerivation ( finalAttrs : {
5860 pname = "SDL2" ;
5961 version = "2.28.3" ;
6062
6163 src = fetchFromGitHub {
6264 owner = "libsdl-org" ;
6365 repo = "SDL" ;
64- rev = "release-${ version } " ;
66+ rev = "release-${ finalAttrs . version } " ;
6567 hash = "sha256-/kQ2IyvAfmZ+zIUt1WuEIeX0nYPGXDlAQk2qDsQnFFs=" ;
6668 } ;
6769 dontDisableStatic = if withStatic then 1 else 0 ;
@@ -96,7 +98,7 @@ stdenv.mkDerivation rec {
9698 ++ lib . optionals x11Support [ libX11 ] ;
9799
98100 propagatedBuildInputs = lib . optionals x11Support [ xorgproto ]
99- ++ dlopenPropagatedBuildInputs ;
101+ ++ finalAttrs . dlopenPropagatedBuildInputs ;
100102
101103 dlopenBuildInputs = lib . optionals alsaSupport [ alsa-lib audiofile ]
102104 ++ lib . optional dbusSupport dbus
@@ -109,7 +111,7 @@ stdenv.mkDerivation rec {
109111 ++ lib . optionals drmSupport [ libdrm mesa ] ;
110112
111113 buildInputs = [ libiconv ]
112- ++ dlopenBuildInputs
114+ ++ finalAttrs . dlopenBuildInputs
113115 ++ lib . optional ibusSupport ibus
114116 ++ lib . optionals waylandSupport [ wayland-protocols ]
115117 ++ lib . optionals stdenv . isDarwin [ AudioUnit Cocoa CoreAudio CoreServices ForceFeedback OpenGL ] ;
@@ -156,7 +158,7 @@ stdenv.mkDerivation rec {
156158 # list the symbols used in this way.
157159 postFixup =
158160 let
159- rpath = lib . makeLibraryPath ( dlopenPropagatedBuildInputs ++ dlopenBuildInputs ) ;
161+ rpath = lib . makeLibraryPath ( finalAttrs . dlopenPropagatedBuildInputs ++ finalAttrs . dlopenBuildInputs ) ;
160162 in
161163 lib . optionalString ( stdenv . hostPlatform . extensions . sharedLibrary == ".so" ) ''
162164 for lib in $out/lib/*.so* ; do
@@ -171,6 +173,9 @@ stdenv.mkDerivation rec {
171173 passthru = {
172174 inherit openglSupport ;
173175 updateScript = nix-update-script { extraArgs = [ "--version-regex" "release-(.*)" ] ; } ;
176+ tests . pkg-config = testers . hasPkgConfigModules {
177+ package = finalAttrs . finalPackage ;
178+ } ;
174179 } ;
175180
176181 meta = with lib ; {
@@ -180,5 +185,6 @@ stdenv.mkDerivation rec {
180185 license = licenses . zlib ;
181186 platforms = platforms . all ;
182187 maintainers = with maintainers ; [ cpages ] ;
188+ pkgConfigModules = [ "sdl2" ] ;
183189 } ;
184- }
190+ } )
0 commit comments