summary refs log tree commit diff
path: root/pkgs/games/egoboo/default.nix
blob: 506868efe312f07fe011e3fba3a1aaa8a1530a42 (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
{ lib, stdenv, fetchurl, libGLU, libGL, SDL, SDL_mixer, SDL_image, SDL_ttf }:

stdenv.mkDerivation rec {
  # pf5234 (a developer?) at freenode #egoboo told me that I better use 2.7.3 until
  # they fix more, because it even has at least one bugs less than 2.7.4.
  # 2.8.0 does not start properly on linux
  # They just starting making that 2.8.0 work on linux.
  pname = "egoboo";
  version = "2.7.3";

  src = fetchurl {
    url = "mirror://sourceforge/egoboo/egoboo-${version}.tar.gz";
    sha256 = "18cjgp9kakrsa90jcb4cl8hhh9k57mi5d1sy5ijjpd3p7zl647hd";
  };

  buildPhase = ''
    cd source
    make -C enet all
    # The target 'all' has trouble
    make -C game -f Makefile.unix egoboo
  '';

  # The user will need to have all the files in '.' to run egoboo, with
  # writeable controls.txt and setup.txt
  installPhase = ''
    mkdir -p $out/share/egoboo-${version}
    cp -v game/egoboo $out/share/egoboo-${version}
    cd ..
    cp -v -Rd controls.txt setup.txt players modules basicdat $out/share/egoboo-${version}
  '';

  buildInputs = [ libGLU libGL SDL SDL_mixer SDL_image SDL_ttf ];

  /*
    This big commented thing may be needed for versions 2.8.0 or beyond
    I keep it here for future updates.

    # Some files have to go to $HOME, but we put them in the 'shared'.
    patchPhase = ''
      sed -i -e 's,''${HOME}/.''${PROJ_NAME},''${PREFIX}/share/games/''${PROJ_NAME},g' Makefile
    '';

    preBuild = ''
      makeFlags=PREFIX=$out
    '';
  */

  NIX_LDFLAGS = "-lm";

  meta = {
    description = "3D dungeon crawling adventure";

    homepage = "http://egoboo.sourceforge.net/";
    license = lib.licenses.gpl2Plus;

    # I take it out of hydra as it does not work as well as I'd like
    # maintainers = [ lib.maintainers.bjg ];
    # platforms = lib.platforms.all;
  };
}