Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 106 lines 2.2 kB view raw
1/* 2 The reusable code, and package attributes, between OpenRA engine packages (engine.nix) 3 and out-of-tree mod packages (mod.nix). 4*/ 5{ 6 lib, 7 makeSetupHook, 8 curl, 9 unzip, 10 dos2unix, 11 pkg-config, 12 makeWrapper, 13 lua, 14 mono, 15 python3, 16 libGL, 17 freetype, 18 openal, 19 SDL2, 20 # It is not necessary to run the game, but it is nicer to be given an error dialog in the case of failure, 21 # rather than having to look to the logs why it is not starting. 22 zenity, 23}: 24 25let 26 inherit (lib) 27 licenses 28 maintainers 29 makeBinPath 30 makeLibraryPath 31 optional 32 platforms 33 ; 34 35 path = makeBinPath ( 36 [ 37 mono 38 python3 39 ] 40 ++ optional (zenity != null) zenity 41 ); 42 rpath = makeLibraryPath [ 43 lua 44 freetype 45 openal 46 SDL2 47 ]; 48 mkdirp = makeSetupHook { 49 name = "openra-mkdirp-hook"; 50 } ./mkdirp.sh; 51 52in 53{ 54 patchEngine = dir: version: '' 55 sed -i \ 56 -e 's/^VERSION.*/VERSION = ${version}/g' \ 57 -e '/fetch-geoip-db/d' \ 58 -e '/GeoLite2-Country.mmdb.gz/d' \ 59 ${dir}/Makefile 60 61 sed -i 's|locations=.*|locations=${lua}/lib|' ${dir}/thirdparty/configure-native-deps.sh 62 ''; 63 64 wrapLaunchGame = openraSuffix: binaryName: '' 65 # Setting TERM=xterm fixes an issue with terminfo in mono: System.Exception: Magic number is wrong: 542 66 # https://github.com/mono/mono/issues/6752#issuecomment-365212655 67 wrapProgram $out/lib/openra${openraSuffix}/launch-game.sh \ 68 --prefix PATH : "${path}" \ 69 --prefix LD_LIBRARY_PATH : "${rpath}" \ 70 --set TERM xterm 71 72 makeWrapper $out/lib/openra${openraSuffix}/launch-game.sh $(mkdirp $out/bin)/${binaryName} \ 73 --chdir "$out/lib/openra${openraSuffix}" 74 ''; 75 76 packageAttrs = { 77 buildInputs = [ libGL ]; 78 79 # TODO: Test if this is correct. 80 nativeBuildInputs = [ 81 curl 82 unzip 83 dos2unix 84 pkg-config 85 makeWrapper 86 mkdirp 87 mono 88 python3 89 ]; 90 91 makeFlags = [ "prefix=$(out)" ]; 92 93 doCheck = true; 94 95 dontStrip = true; 96 97 meta = { 98 maintainers = with maintainers; [ 99 fusion809 100 msteen 101 ]; 102 license = licenses.gpl3; 103 platforms = platforms.linux; 104 }; 105 }; 106}