about summary refs log tree commit diff
path: root/pkgs/misc/emulators/dosbox/default.nix
blob: e2bcc9fe26f3829e69a97c5544b107e8976d5b2a (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
{stdenv, fetchurl, SDL, makeDesktopItem}:

stdenv.mkDerivation rec { 
  name = "dosbox-0.72";
  
  src = fetchurl {
    url = "mirror://sourceforge/dosbox/${name}.tar.gz";
    sha256 = "0ydck7jgvdwnpxakg2y83dmk2dnwx146cgidbmdn7h75y7cxfiqp";
  };
  
  buildInputs = [SDL];    
  
  # Add missing includes in order to fix compilation with glibc 2.9
  patchPhase = ''
    echo "#include <string.h>" > tmp.cpp
    for i in src/hardware/gameblaster.cpp src/hardware/tandy_sound.cpp
    do
      cat tmp.cpp $i > $i.new
      mv $i.new $i
    done
    echo "#include <stdlib.h>" > tmp.cpp
    cat tmp.cpp src/shell/shell_cmds.cpp > src/shell/shell_cmds.cpp.new
    mv src/shell/shell_cmds.cpp.new src/shell/shell_cmds.cpp
  '';
   
  desktopItem = makeDesktopItem {
    name = "dosbox";
    exec = "dosbox";
    comment = "x86 emulator with internal DOS";
    desktopName = "DOSBox";
    genericName = "DOS emulator";
    categories = "Application;Emulator;";
  };

  postInstall = ''
     ensureDir $out/share/applications
     cp ${desktopItem}/share/applications/* $out/share/applications
  '';

  meta = {
    homepage = http://www.dosbox.com/;
    description = "A DOS emulator";
  };
}