summary refs log tree commit diff
path: root/pkgs/games/tremulous/default.nix
blob: fc9bc985c00f2ad5c0344358a1ce84628aec74f5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
{ stdenv, fetchurl, unzip, libGLU, libGL, libX11, SDL, openal, runtimeShell }:
stdenv.mkDerivation rec {
  pname = "tremulous";
  version = "1.1.0";
  src1 = fetchurl {
    url = "mirror://sourceforge/tremulous/${pname}-${version}.zip";
    sha256 = "11w96y7ggm2sn5ncyaffsbg0vy9pblz2av71vqp9725wbbsndfy7";
  };
  # http://tremulous.net/wiki/Client_versions
  src2 = fetchurl {
    url = "http://releases.mercenariesguild.net/client/mgclient_source_Release_1.011.tar.gz";
    sha256 = "1vrsi7va7hdp8k824663s1pyw9zpsd4bwwr50j7i1nn72b0v9a26";
  };
  src3 = fetchurl {
    url = "http://releases.mercenariesguild.net/tremded/mg_tremded_source_1.01.tar.gz";
    sha256 = "1njrqlhzjvy9myddzkagszwdcf3m4h08wip888w2rmbshs6kz6ql";
  };
  buildInputs = [ unzip libGLU libGL libX11 SDL openal ];
  unpackPhase = ''
    unzip $src1
    cd tremulous
    tar xvf $src2
    mkdir mg_tremded_source
    cd mg_tremded_source
    tar xvf $src3
    cd ..
  '';
  patches = [ ./parse.patch ];
  patchFlags = "-p 0";
  NIX_LD_FLAGS = ''
    -rpath ${stdenv.cc}/lib
    -rpath ${stdenv.cc}/lib64
  '';
  buildPhase = ''
    cd Release_1.011
    make
    cd ..
    cd mg_tremded_source
    make
    cd ..
  '';
  installPhase = ''
    arch=$(uname -m | sed -e s/i.86/x86/)
    mkdir -p $out/opt/tremulous
    cp -v Release_1.011/build/release-linux-$arch/tremulous.$arch $out/opt/tremulous/
    cp -v mg_tremded_source/build/release-linux-$arch/tremded.$arch $out/opt/tremulous/
    cp -rv base $out/opt/tremulous
    mkdir -p $out/bin
    for b in tremulous tremded
    do
        cat << EOF > $out/bin/$b
    #!${runtimeShell}
    cd $out/opt/tremulous
    exec ./$b.$arch "\$@"
    EOF
        chmod +x $out/bin/$b
    done
  '';
  dontPatchELF = true;
  meta = with stdenv.lib; {
    description = "A game that blends a team based FPS with elements of an RTS";
    longDescription = ''
      Tremulous is a free, open source game that blends a team based FPS with
      elements of an RTS. Players can choose from 2 unique races, aliens and
      humans. Players on both teams are able to build working structures
      in-game like an RTS. These structures provide many functions, the most
      important being spawning. The designated builders must ensure there are
      spawn structures or other players will not be able to rejoin the game
      after death. Other structures provide automated base defense (to some
      degree), healing functions and much more...
    '';
    homepage = http://www.tremulous.net;
    license = with licenses; [
      gpl2
      cc-by-sa-25 /* media */
    ];
    maintainers = with maintainers; [ astsmtl ];
    platforms = platforms.linux;
    broken = true;
  };
}