at 24.11-pre 62 lines 1.7 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4, cmake 5, pkg-config 6, SDL2 7, libiconv 8, Cocoa 9, autoSignDarwinBinariesHook 10, libGLSupported ? lib.elem stdenv.hostPlatform.system lib.platforms.mesaPlatforms 11, openglSupport ? libGLSupported 12, libGL 13, libGLU 14}: 15 16let 17 inherit (lib) optionals makeLibraryPath; 18 19in 20stdenv.mkDerivation rec { 21 pname = "SDL_compat"; 22 version = "1.2.68"; 23 24 src = fetchFromGitHub { 25 owner = "libsdl-org"; 26 repo = "sdl12-compat"; 27 rev = "release-" + version; 28 hash = "sha256-f2dl3L7/qoYNl4sjik1npcW/W09zsEumiV9jHuKnUmM="; 29 }; 30 31 nativeBuildInputs = [ cmake pkg-config ] 32 ++ optionals (stdenv.isDarwin && stdenv.isAarch64) [ autoSignDarwinBinariesHook ]; 33 34 propagatedBuildInputs = [ SDL2 ] 35 ++ optionals stdenv.hostPlatform.isDarwin [ libiconv Cocoa ] 36 ++ optionals openglSupport [ libGL libGLU ]; 37 38 enableParallelBuilding = true; 39 40 setupHook = ../SDL/setup-hook.sh; 41 42 postFixup = '' 43 for lib in $out/lib/*${stdenv.hostPlatform.extensions.sharedLibrary}* ; do 44 if [[ -L "$lib" ]]; then 45 ${if stdenv.hostPlatform.isDarwin then '' 46 install_name_tool ${lib.strings.concatMapStrings (x: " -add_rpath ${makeLibraryPath [x]} ") propagatedBuildInputs} "$lib" 47 '' else '' 48 patchelf --set-rpath "$(patchelf --print-rpath $lib):${makeLibraryPath propagatedBuildInputs}" "$lib" 49 ''} 50 fi 51 done 52 ''; 53 54 meta = with lib; { 55 description = "A cross-platform multimedia library - build SDL 1.2 applications against 2.0"; 56 mainProgram = "sdl-config"; 57 homepage = "https://www.libsdl.org/"; 58 license = licenses.zlib; 59 maintainers = with maintainers; [ peterhoeg ]; 60 platforms = platforms.all; 61 }; 62}