9 , libGLSupported ? lib.elem stdenv.hostPlatform.system lib.platforms.mesaPlatforms
10 , openglSupport ? libGLSupported
16 inherit (lib) optionals makeLibraryPath;
19 stdenv.mkDerivation rec {
23 src = fetchFromGitHub {
25 repo = "sdl12-compat";
26 rev = "release-" + version;
27 hash = "sha256-8b9rFI4iRpBJqeJ2KRJ9vRyv9gYwa9jRWCuXRfA3x50=";
30 nativeBuildInputs = [ cmake pkg-config ];
32 propagatedBuildInputs = [ SDL2 ]
33 ++ optionals stdenv.hostPlatform.isDarwin [ libiconv Cocoa ]
34 ++ optionals openglSupport [ libGL libGLU ];
36 enableParallelBuilding = true;
38 setupHook = ../SDL/setup-hook.sh;
41 for lib in $out/lib/*${stdenv.hostPlatform.extensions.sharedLibrary}* ; do
42 if [[ -L "$lib" ]]; then
43 ${if stdenv.hostPlatform.isDarwin then ''
44 install_name_tool ${lib.strings.concatMapStrings (x: " -add_rpath ${makeLibraryPath [x]} ") propagatedBuildInputs} "$lib"
46 patchelf --set-rpath "$(patchelf --print-rpath $lib):${makeLibraryPath propagatedBuildInputs}" "$lib"
53 description = "A cross-platform multimedia library - build SDL 1.2 applications against 2.0";
54 homepage = "https://www.libsdl.org/";
55 license = licenses.zlib;
56 maintainers = with maintainers; [ peterhoeg ];
57 platforms = platforms.all;