2021-01-17 00:15:33 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, nasm, SDL, zlib, libpng, ncurses, libGLU, libGL
|
2020-04-24 23:36:52 +00:00
|
|
|
, makeDesktopItem }:
|
|
|
|
|
|
|
|
let
|
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
name = "zsnes";
|
|
|
|
exec = "zsnes";
|
|
|
|
icon = "zsnes";
|
|
|
|
comment = "A SNES emulator";
|
|
|
|
desktopName = "zsnes";
|
|
|
|
genericName = "zsnes";
|
2022-03-05 16:20:37 +00:00
|
|
|
categories = [ "Game" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
in stdenv.mkDerivation {
|
2021-08-18 13:19:15 +00:00
|
|
|
pname = "zsnes";
|
|
|
|
version = "1.51";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "emillon";
|
|
|
|
repo = "zsnes";
|
|
|
|
rev = "fc160b2538738995f600f8405d23a66b070dac02";
|
|
|
|
sha256 = "1gy79d5wdaacph0cc1amw7mqm7i0716n6mvav16p1svi26iz193v";
|
|
|
|
};
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
patches = [
|
|
|
|
./zlib-1.3.patch
|
|
|
|
./fortify3.patch
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [ nasm SDL zlib libpng ncurses libGLU libGL ];
|
|
|
|
|
|
|
|
prePatch = ''
|
|
|
|
for i in $(cat debian/patches/series); do
|
|
|
|
echo "applying $i"
|
|
|
|
patch -p1 < "debian/patches/$i"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
# Workaround build failure on -fno-common toolchains:
|
|
|
|
# ld: initc.o:(.bss+0x28): multiple definition of `HacksDisable'; cfg.o:(.bss+0x59e3): first defined here
|
2022-11-04 12:27:35 +00:00
|
|
|
# Use pre-c++17 standard (c++17 forbids throw annotations)
|
2023-03-04 12:14:45 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = "-fcommon -std=c++14";
|
2022-06-16 17:23:12 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
preConfigure = ''
|
|
|
|
cd src
|
|
|
|
sed -i "/^STRIP/d" configure
|
|
|
|
sed -i "/\$STRIP/d" configure
|
|
|
|
'';
|
|
|
|
|
|
|
|
configureFlags = [ "--enable-release" ];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
function installIcon () {
|
|
|
|
mkdir -p $out/share/icons/hicolor/$1/apps/
|
|
|
|
cp icons/$1x32.png $out/share/icons/hicolor/$1/apps/zsnes.png
|
|
|
|
}
|
|
|
|
installIcon "16x16"
|
|
|
|
installIcon "32x32"
|
|
|
|
installIcon "48x48"
|
|
|
|
installIcon "64x64"
|
|
|
|
|
|
|
|
mkdir -p $out/share/applications
|
|
|
|
ln -s ${desktopItem}/share/applications/* $out/share/applications/
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "A Super Nintendo Entertainment System Emulator";
|
2021-01-17 00:15:33 +00:00
|
|
|
license = lib.licenses.gpl2Plus;
|
|
|
|
maintainers = [ lib.maintainers.sander ];
|
2022-01-03 16:56:52 +00:00
|
|
|
homepage = "https://www.zsnes.com";
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = [ "i686-linux" "x86_64-linux" ];
|
2024-02-29 20:09:43 +00:00
|
|
|
mainProgram = "zsnes";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|