diff --git a/pkgs/development/libraries/SDL_compat/default.nix b/pkgs/development/libraries/SDL_compat/default.nix new file mode 100644 index 000000000000..2ba0a095f688 --- /dev/null +++ b/pkgs/development/libraries/SDL_compat/default.nix @@ -0,0 +1,52 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, pkg-config +, SDL2 +, libGLSupported ? lib.elem stdenv.hostPlatform.system lib.platforms.mesaPlatforms +, openglSupport ? libGLSupported +, libGL +, libGLU +}: + +let + inherit (lib) optionals makeLibraryPath; + +in +stdenv.mkDerivation rec { + pname = "SDL_compat"; + version = "1.2.52"; + + src = fetchFromGitHub { + owner = "libsdl-org"; + repo = "sdl12-compat"; + rev = "release-" + version; + hash = "sha256-PDGlMI8q74JaqMQ5oX9Zt5CEr7frFQWECbuwq5g25eg="; + }; + + nativeBuildInputs = [ cmake pkg-config ]; + + propagatedBuildInputs = [ SDL2 ] + ++ optionals openglSupport [ libGL libGLU ]; + + enableParallelBuilding = true; + + setupHook = ../SDL/setup-hook.sh; + + postFixup = '' + for lib in $out/lib/*.so* ; do + if [[ -L "$lib" ]]; then + patchelf --set-rpath "$(patchelf --print-rpath $lib):${makeLibraryPath propagatedBuildInputs}" "$lib" + fi + done + ''; + + meta = with lib; { + description = "A cross-platform multimedia library - build SDL 1.2 applications against 2.0"; + homepage = "https://www.libsdl.org/"; + license = licenses.zlib; + maintainers = with maintainers; [ peterhoeg ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0f4597100d21..c5eb06ce8478 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -20436,13 +20436,17 @@ with pkgs; autoreconfHook = buildPackages.autoreconfHook269; }; - SDL = callPackage ../development/libraries/SDL ({ + SDL_classic = callPackage ../development/libraries/SDL ({ inherit (darwin.apple_sdk.frameworks) OpenGL CoreAudio CoreServices AudioUnit Kernel Cocoa GLUT; } // lib.optionalAttrs stdenv.hostPlatform.isAndroid { # libGLU doesn’t work with Android’s SDL libGLU = null; }); + SDL_compat = callPackage ../development/libraries/SDL_compat { }; + + SDL = SDL_classic; + SDL_audiolib = callPackage ../development/libraries/SDL_audiolib { }; SDL_sixel = callPackage ../development/libraries/SDL_sixel { };