1{ stdenv, fetchurl, mono, makeWrapper, lua
2, SDL2, freetype, openal, systemd, pkgconfig
3}:
4
5let
6 version = "20141029";
7in stdenv.mkDerivation rec {
8 name = "openra-${version}";
9
10 meta = with stdenv.lib; {
11 description = "Real Time Strategy game engine recreates the C&C titles";
12 homepage = "http://www.open-ra.org/";
13 license = licenses.gpl3;
14 platforms = platforms.linux;
15 maintainers = with maintainers; [ iyzsong ];
16 };
17
18 src = fetchurl {
19 name = "${name}.tar.gz";
20 url = "https://github.com/OpenRA/OpenRA/archive/release-${version}.tar.gz";
21 sha256 = "082rwcy866k636s4qhbry3ja2p81mdz58bh1dw2mic5mv2q6p67r";
22 };
23
24 dontStrip = true;
25
26 buildInputs = [ lua ];
27 nativeBuildInputs = [ mono makeWrapper lua pkgconfig ];
28
29 patchPhase = ''
30 sed -i 's/^VERSION.*/VERSION = release-${version}/g' Makefile
31 substituteInPlace configure --replace /bin/bash "$shell" --replace /usr/local/lib "${lua}/lib"
32 '';
33
34 preConfigure = ''
35 makeFlags="prefix=$out"
36 make version
37 '';
38
39 postInstall = with stdenv.lib; let
40 runtime = makeLibraryPath [ SDL2 freetype openal systemd lua ];
41 in ''
42 wrapProgram $out/lib/openra/launch-game.sh \
43 --prefix PATH : "${mono}/bin" \
44 --set PWD $out/lib/openra/ \
45 --prefix LD_LIBRARY_PATH : "${runtime}"
46
47 mkdir -p $out/bin
48 echo "cd $out/lib/openra && $out/lib/openra/launch-game.sh" > $out/bin/openra
49 chmod +x $out/bin/openra
50 '';
51}