Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at netboot-syslinux-multiplatform 105 lines 3.5 kB view raw
1{ lib, stdenv, SDL, SDL2, fetchurl, gzip, libvorbis, libmad, flac, libopus, opusfile, libogg, libxmp 2, Cocoa, CoreAudio, CoreFoundation, IOKit, OpenGL 3, copyDesktopItems, makeDesktopItem, pkg-config 4, useSDL2 ? stdenv.isDarwin # TODO: CoreAudio fails to initialize with SDL 1.x for some reason. 5}: 6 7stdenv.mkDerivation rec { 8 pname = "quakespasm"; 9 version = "0.95.1"; 10 11 src = fetchurl { 12 url = "mirror://sourceforge/quakespasm/quakespasm-${version}.tar.gz"; 13 sha256 = "sha256-hBmEV3s65yQysMiq4zEP4swfCgCCiT5dzZdhg7bSNOI="; 14 }; 15 16 sourceRoot = "${pname}-${version}/Quake"; 17 18 patches = lib.optionals stdenv.isDarwin [ 19 # Makes Darwin Makefile use system libraries instead of ones from app bundle 20 ./quakespasm-darwin-makefile-improvements.patch 21 ]; 22 23 nativeBuildInputs = [ 24 copyDesktopItems 25 pkg-config 26 ]; 27 28 buildInputs = [ 29 gzip libvorbis libmad flac libopus opusfile libogg libxmp 30 (if useSDL2 then SDL2 else SDL) 31 ] ++ lib.optionals stdenv.isDarwin [ 32 Cocoa CoreAudio IOKit OpenGL 33 ] ++ lib.optionals (stdenv.isDarwin && useSDL2) [ 34 CoreFoundation 35 ]; 36 37 buildFlags = [ 38 "DO_USERDIRS=1" 39 # Makefile defaults, set here to enforce consistency on Darwin build 40 "USE_CODEC_WAVE=1" 41 "USE_CODEC_MP3=1" 42 "USE_CODEC_VORBIS=1" 43 "USE_CODEC_FLAC=1" 44 "USE_CODEC_OPUS=1" 45 "USE_CODEC_MIKMOD=0" 46 "USE_CODEC_UMX=0" 47 "USE_CODEC_XMP=1" 48 "MP3LIB=mad" 49 "VORBISLIB=vorbis" 50 ] ++ lib.optionals useSDL2 [ 51 "SDL_CONFIG=sdl2-config" 52 "USE_SDL2=1" 53 ]; 54 55 makefile = if (stdenv.isDarwin) then "Makefile.darwin" else "Makefile"; 56 57 preInstall = '' 58 mkdir -p "$out/bin" 59 substituteInPlace Makefile --replace "/usr/local/games" "$out/bin" 60 substituteInPlace Makefile.darwin --replace "/usr/local/games" "$out/bin" 61 ''; 62 63 postInstall = lib.optionalString stdenv.isDarwin '' 64 # Let's build app bundle 65 mkdir -p $out/Applications/Quake.app/Contents/MacOS 66 mkdir -p $out/Applications/Quake.app/Contents/Resources 67 cp ../MacOSX/Info.plist $out/Applications/Quake.app/Contents/ 68 cp ../MacOSX/QuakeSpasm.icns $out/Applications/Quake.app/Contents/Resources/ 69 cp -r ../MacOSX/English.lproj $out/Applications/Quake.app/Contents/Resources/ 70 ln -sf $out/bin/quake $out/Applications/Quake.app/Contents/MacOS/quake 71 72 substituteInPlace $out/Applications/Quake.app/Contents/Info.plist \ 73 --replace '>''${EXECUTABLE_NAME}' '>quake' 74 substituteInPlace $out/Applications/Quake.app/Contents/Info.plist \ 75 --replace '>''${PRODUCT_NAME}' '>QuakeSpasm' 76 ''; 77 78 enableParallelBuilding = true; 79 80 desktopItems = [ 81 (makeDesktopItem { 82 name = "quakespasm"; 83 exec = "quake"; 84 desktopName = "Quakespasm"; 85 categories = [ "Game" ]; 86 }) 87 ]; 88 89 meta = with lib; { 90 description = "An engine for iD software's Quake"; 91 homepage = "https://quakespasm.sourceforge.net/"; 92 longDescription = '' 93 QuakeSpasm is a modern, cross-platform Quake 1 engine based on FitzQuake. 94 It includes support for 64 bit CPUs and custom music playback, a new sound driver, 95 some graphical niceities, and numerous bug-fixes and other improvements. 96 Quakespasm utilizes either the SDL or SDL2 frameworks, so choose which one 97 works best for you. SDL is probably less buggy, but SDL2 has nicer features 98 and smoother mouse input - though no CD support. 99 ''; 100 101 platforms = platforms.unix; 102 maintainers = with maintainers; [ mikroskeem ]; 103 mainProgram = "quake"; 104 }; 105}