summary refs log tree commit diff
path: root/pkgs/games/micropolis/default.nix
blob: a294128969c5db2524d3dc05246e1ae01965087e (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
{ stdenv, fetchurl, libX11, libXpm, libXext, xextproto, byacc }:

stdenv.mkDerivation {
  name = "micropolis-2010-12-18"; # version from the patch timestamp

  src = fetchurl {
    url = http://www.donhopkins.com/home/micropolis/micropolis-activity-source.tgz;
    sha256 = "1b3c72dc3680a34b5fc5a740a6fb5cfc0b8775514da8ab7bb3b2965b20d4f8bc";
  };

  patches =
    [ (fetchurl {
        url = http://rmdir.de/~michael/micropolis_git.patch;
        sha256 = "0sjl61av7lab3a5vif1jpyicmdb2igvqq6nwaw0s3agg6dh69v1d";
      })
    ];

  buildInputs = [ libX11 libXpm libXext xextproto byacc ];

  preConfigure =
    ''
      cd src
      sed -i "s@^CFLAGS.*\$@&\nCFLAGS += -I${libXpm.dev}/include/X11@" tk/makefile
      sed -i "s@^INCLUDES.*\$@&\n\t-I$PWD/tcl \\\\@" sim/makefile
    '';

  postInstall =
    ''
      mkdir -p $out/bin
      mkdir -p $out/usr/share/games/micropolis
      cd ..
      for d in activity cities images manual res; do
        cp -R $d $out/usr/share/games/micropolis
      done
      cp Micropolis $out/usr/share/games/micropolis
      cat > $out/bin/micropolis << EOF 
      #!/bin/bash
      cd $out/usr/share/games/micropolis
      ./Micropolis
      EOF
      chmod 755 $out/bin/micropolis
    '';

  meta = {
    description = "GPL'ed version of S*m C*ty";
    homepage = http://www.donhopkins.com/home/micropolis/;
    license = "GPL";
  };
}