planify: 4.11.6 -> 4.12.0 (#379469)
[NixPkgs.git] / pkgs / by-name / sn / snes9x / package.nix
blob3c027f6068e9477b89836000a9d299730157e1d1
2   lib,
3   SDL2,
4   alsa-lib,
5   cmake,
6   fetchFromGitHub,
7   gtkmm3,
8   libGL,
9   libX11,
10   libXdmcp,
11   libXext,
12   libXinerama,
13   libXrandr,
14   libXv,
15   libepoxy,
16   libpng,
17   libselinux,
18   minizip,
19   ninja,
20   pcre2,
21   pkg-config,
22   portaudio,
23   pulseaudio,
24   python3,
25   stdenv,
26   util-linuxMinimal,
27   wrapGAppsHook3,
28   zlib,
29   # Boolean flags
30   withGtk ? false,
33 stdenv.mkDerivation (finalAttrs: {
34   pname = "snes9x" + lib.optionalString withGtk "-gtk";
35   version = "1.63";
37   src = fetchFromGitHub {
38     owner = "snes9xgit";
39     repo = "snes9x";
40     rev = finalAttrs.version;
41     fetchSubmodules = true;
42     hash = "sha256-INMVyB3alwmsApO7ToAaUWgh7jlg2MeLxqHCEnUO88U=";
43   };
45   nativeBuildInputs =
46     [
47       pkg-config
48       python3
49     ]
50     ++ lib.optionals withGtk [
51       cmake
52       ninja
53       wrapGAppsHook3
54     ];
56   buildInputs =
57     [
58       libX11
59       libXv
60       minizip
61       zlib
62     ]
63     ++ lib.optionals stdenv.hostPlatform.isLinux [
64       alsa-lib
65       pulseaudio
66       libselinux
67       util-linuxMinimal # provides libmount
68     ]
69     ++ lib.optionals (!withGtk) [
70       libpng
71       libXext
72       libXinerama
73     ]
74     ++ lib.optionals withGtk [
75       gtkmm3
76       libepoxy
77       libXdmcp
78       libXrandr
79       pcre2
80       portaudio
81       SDL2
82     ];
84   hardeningDisable = [ "format" ];
86   configureFlags =
87     lib.optionals stdenv.hostPlatform.sse4_1Support [
88       "--enable-sse41"
89     ]
90     ++ lib.optionals stdenv.hostPlatform.avx2Support [
91       "--enable-avx2"
92     ];
94   postPatch = ''
95     substituteInPlace external/glad/src/egl.c \
96       --replace-fail libEGL.so.1 "${lib.getLib libGL}/lib/libEGL.so.1"
97     substituteInPlace external/glad/src/glx.c \
98       --replace-fail libGL.so.1 ${lib.getLib libGL}/lib/libGL.so.1
99   '';
101   preConfigure = ''
102     cd ${if withGtk then "gtk" else "unix"}
103   '';
105   installPhase = lib.optionalString (!withGtk) ''
106     runHook preInstall
108     install -Dm755 snes9x -t "$out/bin/"
109     install -Dm644 snes9x.conf.default -t "$out/share/doc/${finalAttrs.pname}/"
110     install -Dm644 ../docs/{control-inputs,controls,snapshots}.txt -t \
111       "$out/share/doc/${finalAttrs.pname}/"
113     runHook postInstall
114   '';
116   enableParallelBuilding = true;
118   meta =
119     let
120       interface = if withGtk then "GTK" else "X11";
121     in
122     {
123       homepage = "https://www.snes9x.com";
124       description = "Super Nintendo Entertainment System (SNES) emulator, ${interface} version";
125       longDescription = ''
126         Snes9x is a portable, freeware Super Nintendo Entertainment System (SNES)
127         emulator. It basically allows you to play most games designed for the SNES
128         and Super Famicom Nintendo game systems on your PC or Workstation; which
129         includes some real gems that were only ever released in Japan.
131         Version build with ${interface} interface.
132       '';
133       license = lib.licenses.unfreeRedistributable // {
134         url = "https://github.com/snes9xgit/snes9x/blob/${finalAttrs.src.rev}/LICENSE";
135       };
136       mainProgram = "snes9x";
137       maintainers = with lib.maintainers; [
138         AndersonTorres
139         qknight
140         thiagokokada
141         sugar700
142       ];
143       platforms = lib.platforms.unix;
144       broken = (withGtk && stdenv.hostPlatform.isDarwin);
145     };