python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / applications / emulators / zsnes / default.nix
blobb9dd0f77a4ff48e60879bd094b078a5424197d2c
1 { lib, stdenv, fetchFromGitHub, nasm, SDL, zlib, libpng, ncurses, libGLU, libGL
2 , makeDesktopItem }:
4 let
5   desktopItem = makeDesktopItem {
6     name = "zsnes";
7     exec = "zsnes";
8     icon = "zsnes";
9     comment = "A SNES emulator";
10     desktopName = "zsnes";
11     genericName = "zsnes";
12     categories = [ "Game" ];
13   };
15 in stdenv.mkDerivation {
16   pname = "zsnes";
17   version = "1.51";
19   src = fetchFromGitHub {
20     owner = "emillon";
21     repo = "zsnes";
22     rev = "fc160b2538738995f600f8405d23a66b070dac02";
23     sha256 = "1gy79d5wdaacph0cc1amw7mqm7i0716n6mvav16p1svi26iz193v";
24   };
26   buildInputs = [ nasm SDL zlib libpng ncurses libGLU libGL ];
28   prePatch = ''
29     for i in $(cat debian/patches/series); do
30       echo "applying $i"
31       patch -p1 < "debian/patches/$i"
32     done
33   '';
35   # Workaround build failure on -fno-common toolchains:
36   #   ld: initc.o:(.bss+0x28): multiple definition of `HacksDisable'; cfg.o:(.bss+0x59e3): first defined here
37   # Use pre-c++17 standard (c++17 forbids throw annotations)
38   NIX_CFLAGS_COMPILE = "-fcommon -std=c++14";
40   preConfigure = ''
41     cd src
42     sed -i "/^STRIP/d" configure
43     sed -i "/\$STRIP/d" configure
44   '';
46   configureFlags = [ "--enable-release" ];
48   postInstall = ''
49     function installIcon () {
50         mkdir -p $out/share/icons/hicolor/$1/apps/
51         cp icons/$1x32.png $out/share/icons/hicolor/$1/apps/zsnes.png
52     }
53     installIcon "16x16"
54     installIcon "32x32"
55     installIcon "48x48"
56     installIcon "64x64"
58     mkdir -p $out/share/applications
59     ln -s ${desktopItem}/share/applications/* $out/share/applications/
60   '';
62   meta = {
63     description = "A Super Nintendo Entertainment System Emulator";
64     license = lib.licenses.gpl2Plus;
65     maintainers = [ lib.maintainers.sander ];
66     homepage = "https://www.zsnes.com";
67     platforms = [ "i686-linux" "x86_64-linux" ];
68   };