summary refs log tree commit diff
path: root/pkgs/misc/emulators/zsnes/default.nix
blob: d878d34184a850acdf79e60fda6640566ca21f1f (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
{stdenv, fetchurl, nasm, SDL, zlib, libpng, ncurses, mesa}:

stdenv.mkDerivation {
  name = "zsnes-1.51";
  
  src = fetchurl {
    url = mirror://sourceforge/zsnes/zsnes151src.tar.bz2;
    sha256 = "08s64qsxziv538vmfv38fg1rfrz5k95dss5zdkbfxsbjlbdxwmi8";
  };

  buildInputs = [ nasm SDL zlib libpng ncurses mesa ];
  
  preConfigure = ''
    cd src
    
    # Fix for undefined strncasecmp()
    echo '#include <strings.h>' > tmp.cpp 
    cat tmp.cpp tools/strutil.h > tools/strutil.h.new
    mv tools/strutil.h.new tools/strutil.h
    
    # Fix for undefined system()
    echo '#include <stdlib.h>' > tmp.cpp
    cat tmp.cpp tools/depbuild.cpp > tools/depbuild.cpp.new
    mv tools/depbuild.cpp.new tools/depbuild.cpp
    
    # Fix for lots of undefined strcmp, strncmp etc.
    echo '#include <string.h>' > tmp.cpp 
    cat tmp.cpp parsegen.cpp > parsegen.cpp.new
    mv parsegen.cpp.new parsegen.cpp
  '';
  
  meta = {
    description = "A Super Nintendo Entertainment System Emulator";
    license = "GPLv2";
  };
}