diff options
Diffstat (limited to 'pkgs/development/libraries/SDL2/default.nix')
-rw-r--r-- | pkgs/development/libraries/SDL2/default.nix | 216 |
1 files changed, 140 insertions, 76 deletions
diff --git a/pkgs/development/libraries/SDL2/default.nix b/pkgs/development/libraries/SDL2/default.nix index 91903c9f68516..fa64b148b092c 100644 --- a/pkgs/development/libraries/SDL2/default.nix +++ b/pkgs/development/libraries/SDL2/default.nix @@ -1,56 +1,66 @@ -{ lib -, stdenv -, config -, fetchFromGitHub -, nix-update-script -, pkg-config -, libGLSupported ? lib.elem stdenv.hostPlatform.system lib.platforms.mesaPlatforms -, openglSupport ? libGLSupported -, libGL -, alsaSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid -, alsa-lib -, x11Support ? !stdenv.hostPlatform.isWindows && !stdenv.hostPlatform.isAndroid -, libX11 -, xorgproto -, libICE -, libXi -, libXScrnSaver -, libXcursor -, libXinerama -, libXext -, libXxf86vm -, libXrandr -, waylandSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid -, wayland -, wayland-protocols -, wayland-scanner -, drmSupport ? false -, libdrm -, mesa -, libxkbcommon -, dbusSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid -, dbus -, udevSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid -, udev -, ibusSupport ? false -, ibus -, libdecorSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid -, libdecor -, pipewireSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid -, pipewire # NOTE: must be built with SDL2 without pipewire support -, pulseaudioSupport ? config.pulseaudio or stdenv.isLinux && !stdenv.hostPlatform.isAndroid -, libpulseaudio -, AudioUnit -, Cocoa -, CoreAudio -, CoreServices -, ForceFeedback -, OpenGL -, audiofile -, libiconv -, withStatic ? stdenv.hostPlatform.isMinGW +{ + lib, + stdenv, + config, + fetchFromGitHub, + nix-update-script, + pkg-config, + libGLSupported ? lib.elem stdenv.hostPlatform.system lib.platforms.mesaPlatforms, + openglSupport ? libGLSupported, + libGL, + alsaSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid, + alsa-lib, + x11Support ? !stdenv.hostPlatform.isWindows && !stdenv.hostPlatform.isAndroid, + libX11, + xorgproto, + libICE, + libXi, + libXScrnSaver, + libXcursor, + libXinerama, + libXext, + libXxf86vm, + libXrandr, + waylandSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid, + wayland, + wayland-protocols, + wayland-scanner, + drmSupport ? false, + libdrm, + mesa, + libxkbcommon, + dbusSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid, + dbus, + udevSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid, + udev, + ibusSupport ? false, + ibus, + libdecorSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid, + libdecor, + pipewireSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid, + pipewire, # NOTE: must be built with SDL2 without pipewire support + pulseaudioSupport ? config.pulseaudio or stdenv.isLinux && !stdenv.hostPlatform.isAndroid, + libpulseaudio, + AudioUnit, + Cocoa, + CoreAudio, + CoreServices, + ForceFeedback, + OpenGL, + audiofile, + libiconv, + withStatic ? stdenv.hostPlatform.isMinGW, # passthru.tests -, testers + testers, + guile-sdl2, + jazz2, + SDL2_ttf, + SDL2_net, + SDL2_gfx, + SDL2_sound, + SDL2_mixer, + SDL2_image, + python3Packages, }: # NOTE: When editing this expression see if the same change applies to @@ -58,16 +68,19 @@ stdenv.mkDerivation (finalAttrs: { pname = "SDL2"; - version = "2.30.3"; + version = "2.30.5"; src = fetchFromGitHub { owner = "libsdl-org"; repo = "SDL"; rev = "release-${finalAttrs.version}"; - hash = "sha256-ycY/AkWulV3vAu/+vKw+j/b6jTZWjqKjIgjRwqNHFl8="; + hash = "sha256-ZonlvXAAWCTfDYf/w5RxP1Av67v89kex4H43xkbPYEA="; }; dontDisableStatic = if withStatic then 1 else 0; - outputs = [ "out" "dev" ]; + outputs = [ + "out" + "dev" + ]; outputBin = "dev"; # sdl-config patches = [ @@ -89,41 +102,74 @@ stdenv.mkDerivation (finalAttrs: { depsBuildBuild = [ pkg-config ]; - nativeBuildInputs = [ pkg-config ] ++ lib.optionals waylandSupport [ wayland wayland-scanner ]; + nativeBuildInputs = + [ pkg-config ] + ++ lib.optionals waylandSupport [ + wayland + wayland-scanner + ]; - dlopenPropagatedBuildInputs = [ ] + dlopenPropagatedBuildInputs = + [ ] # Propagated for #include <GLES/gl.h> in SDL_opengles.h. ++ lib.optional (openglSupport && !stdenv.isDarwin) libGL # Propagated for #include <X11/Xlib.h> and <X11/Xatom.h> in SDL_syswm.h. ++ lib.optionals x11Support [ libX11 ]; - propagatedBuildInputs = lib.optionals x11Support [ xorgproto ] - ++ finalAttrs.dlopenPropagatedBuildInputs; + propagatedBuildInputs = + lib.optionals x11Support [ xorgproto ] ++ finalAttrs.dlopenPropagatedBuildInputs; - dlopenBuildInputs = lib.optionals alsaSupport [ alsa-lib audiofile ] + dlopenBuildInputs = + lib.optionals alsaSupport [ + alsa-lib + audiofile + ] ++ lib.optional dbusSupport dbus ++ lib.optional libdecorSupport libdecor ++ lib.optional pipewireSupport pipewire ++ lib.optional pulseaudioSupport libpulseaudio ++ lib.optional udevSupport udev - ++ lib.optionals waylandSupport [ wayland libxkbcommon ] - ++ lib.optionals x11Support [ libICE libXi libXScrnSaver libXcursor libXinerama libXext libXrandr libXxf86vm ] - ++ lib.optionals drmSupport [ libdrm mesa ]; - - buildInputs = [ libiconv ] + ++ lib.optionals waylandSupport [ + wayland + libxkbcommon + ] + ++ lib.optionals x11Support [ + libICE + libXi + libXScrnSaver + libXcursor + libXinerama + libXext + libXrandr + libXxf86vm + ] + ++ lib.optionals drmSupport [ + libdrm + mesa + ]; + + buildInputs = + [ libiconv ] ++ finalAttrs.dlopenBuildInputs ++ lib.optional ibusSupport ibus ++ lib.optionals waylandSupport [ wayland-protocols ] - ++ lib.optionals stdenv.isDarwin [ AudioUnit Cocoa CoreAudio CoreServices ForceFeedback OpenGL ]; + ++ lib.optionals stdenv.isDarwin [ + AudioUnit + Cocoa + CoreAudio + CoreServices + ForceFeedback + OpenGL + ]; enableParallelBuilding = true; - configureFlags = [ - "--disable-oss" - ] ++ lib.optional (!x11Support) "--without-x" - ++ lib.optional alsaSupport "--with-alsa-prefix=${alsa-lib.out}/lib" - ++ lib.optional stdenv.hostPlatform.isWindows "--disable-video-opengles" - ++ lib.optional stdenv.isDarwin "--disable-sdltest"; + configureFlags = + [ "--disable-oss" ] + ++ lib.optional (!x11Support) "--without-x" + ++ lib.optional alsaSupport "--with-alsa-prefix=${alsa-lib.out}/lib" + ++ lib.optional stdenv.hostPlatform.isWindows "--disable-video-opengles" + ++ lib.optional stdenv.isDarwin "--disable-sdltest"; # We remove libtool .la files when static libs are requested, # because they make the builds of downstream libs like `SDL_tff` @@ -158,7 +204,9 @@ stdenv.mkDerivation (finalAttrs: { # list the symbols used in this way. postFixup = let - rpath = lib.makeLibraryPath (finalAttrs.dlopenPropagatedBuildInputs ++ finalAttrs.dlopenBuildInputs); + rpath = lib.makeLibraryPath ( + finalAttrs.dlopenPropagatedBuildInputs ++ finalAttrs.dlopenBuildInputs + ); in lib.optionalString (stdenv.hostPlatform.extensions.sharedLibrary == ".so") '' for lib in $out/lib/*.so* ; do @@ -172,9 +220,25 @@ stdenv.mkDerivation (finalAttrs: { passthru = { inherit openglSupport; - updateScript = nix-update-script { extraArgs = [ "--version-regex" "release-(.*)" ]; }; - tests.pkg-config = testers.hasPkgConfigModules { - package = finalAttrs.finalPackage; + updateScript = nix-update-script { + extraArgs = [ + "--version-regex" + "release-(.*)" + ]; + }; + tests = { + pkg-config = testers.hasPkgConfigModules { package = finalAttrs.finalPackage; }; + inherit + guile-sdl2 + jazz2 + SDL2_ttf + SDL2_net + SDL2_gfx + SDL2_sound + SDL2_mixer + SDL2_image + ; + inherit (python3Packages) pygame pygame-ce pygame-sdl2; }; }; |