2014-08-08 20:34:41 +01:00
|
|
|
{ stdenv, fetchurl
|
2020-03-29 02:48:56 +01:00
|
|
|
, p7zip, pkgconfig, libicns
|
2014-08-08 20:34:41 +01:00
|
|
|
, libX11, libXv
|
|
|
|
, udev
|
2019-11-10 16:44:34 +00:00
|
|
|
, libGLU, libGL, SDL
|
2020-03-29 02:48:56 +01:00
|
|
|
, Carbon, Cocoa, OpenGL, OpenAL
|
2015-05-27 20:42:15 +01:00
|
|
|
, libao, openal, libpulseaudio
|
2019-02-26 11:45:54 +00:00
|
|
|
, gtk2, gtksourceview
|
|
|
|
, runtimeShell }:
|
2014-08-08 20:34:41 +01:00
|
|
|
|
2015-04-06 02:54:16 +01:00
|
|
|
with stdenv.lib;
|
2014-08-08 20:34:41 +01:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "higan";
|
2017-11-28 09:23:42 +00:00
|
|
|
version = "106";
|
2016-04-15 18:46:33 +01:00
|
|
|
sourceName = "higan_v${version}-source";
|
2014-08-08 20:34:41 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-06-28 19:43:35 +01:00
|
|
|
urls = [ "https://download.byuu.org/${sourceName}.7z" ];
|
2017-11-28 09:23:42 +00:00
|
|
|
sha256 = "063dzp9wrdnbvagraxi31xg0154y2gf67rrd0mnc8h104cgzjr35";
|
2014-08-08 20:34:41 +01:00
|
|
|
curlOpts = "--user-agent 'Mozilla/5.0'"; # the good old user-agent trick...
|
|
|
|
};
|
|
|
|
|
2015-12-12 16:23:56 +00:00
|
|
|
patches = [ ./0001-change-flags.diff ];
|
2020-03-29 02:48:56 +01:00
|
|
|
postPatch = ''
|
|
|
|
sed '1i#include <cmath>' -i higan/fc/ppu/ppu.cpp
|
|
|
|
|
|
|
|
for file in icarus/GNUmakefile higan/target-tomoko/GNUmakefile; do
|
|
|
|
substituteInPlace "$file" \
|
|
|
|
--replace 'sips -s format icns data/$(name).png --out out/$(name).app/Contents/Resources/$(name).icns' \
|
|
|
|
'png2icns out/$(name).app/Contents/Resources/$(name).icns data/$(name).png'
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ p7zip pkgconfig ]
|
|
|
|
++ optional stdenv.isDarwin [ libicns ];
|
2015-12-12 16:23:56 +00:00
|
|
|
|
2015-04-06 02:54:16 +01:00
|
|
|
buildInputs =
|
2020-03-29 02:48:56 +01:00
|
|
|
[ SDL libao ]
|
|
|
|
++ optionals stdenv.isLinux [ openal libpulseaudio udev libX11 libXv libGLU libGL gtk2 gtksourceview ]
|
|
|
|
++ optionals stdenv.isDarwin [ Carbon Cocoa OpenGL OpenAL ]
|
|
|
|
;
|
2015-12-12 16:23:56 +00:00
|
|
|
|
|
|
|
unpackPhase = ''
|
|
|
|
7z x $src
|
|
|
|
sourceRoot=${sourceName}
|
|
|
|
'';
|
2014-09-07 02:57:52 +01:00
|
|
|
|
|
|
|
buildPhase = ''
|
2016-04-15 18:46:33 +01:00
|
|
|
make compiler=c++ -C icarus
|
|
|
|
make compiler=c++ -C higan
|
2014-09-07 02:57:52 +01:00
|
|
|
'';
|
|
|
|
|
2017-08-08 02:50:31 +01:00
|
|
|
# Now the cheats file will be distributed separately
|
2020-03-29 02:48:56 +01:00
|
|
|
installPhase = (if !stdenv.isDarwin then ''
|
|
|
|
mkdir -p "$out"/bin "$out"/share/applications "$out"/share/pixmaps
|
|
|
|
install -m 755 icarus/out/icarus "$out"/bin/
|
|
|
|
install -m 755 higan/out/higan "$out"/bin/
|
|
|
|
install -m 644 higan/data/higan.desktop "$out"/share/applications/
|
|
|
|
install -m 644 higan/data/higan.png "$out"/share/pixmaps/higan-icon.png
|
|
|
|
install -m 644 higan/resource/logo/higan.png "$out"/share/pixmaps/higan-logo.png
|
|
|
|
'' else ''
|
|
|
|
mkdir "$out"
|
|
|
|
mv higan/out/higan.app "$out"/
|
|
|
|
mv icarus/out/icarus.app "$out"/
|
|
|
|
'') + ''
|
|
|
|
mkdir -p "$out"/share/higan
|
2016-08-22 18:12:03 +01:00
|
|
|
cp --recursive --no-dereference --preserve='links' --no-preserve='ownership' \
|
2020-03-29 02:48:56 +01:00
|
|
|
higan/systems/* "$out"/share/higan/
|
2014-09-07 02:57:52 +01:00
|
|
|
'';
|
|
|
|
|
2020-03-29 02:48:56 +01:00
|
|
|
fixupPhase = let
|
|
|
|
dest = if !stdenv.isDarwin then "\\$HOME/.local/share/higan" else "\\$HOME/Library/Application Support/higan";
|
|
|
|
in ''
|
2014-09-07 02:57:52 +01:00
|
|
|
# A dirty workaround, suggested by @cpages:
|
|
|
|
# we create a first-run script to populate
|
|
|
|
# the local $HOME with all the auxiliary
|
|
|
|
# stuff needed by higan at runtime
|
|
|
|
|
2020-03-29 02:48:56 +01:00
|
|
|
mkdir -p "$out"/bin
|
2014-09-07 02:57:52 +01:00
|
|
|
cat <<EOF > $out/bin/higan-init.sh
|
2019-02-26 11:45:54 +00:00
|
|
|
#!${runtimeShell}
|
2014-09-07 02:57:52 +01:00
|
|
|
|
2020-03-29 02:48:56 +01:00
|
|
|
cp --recursive --update $out/share/higan/*.sys "${dest}"/
|
2016-04-15 18:46:33 +01:00
|
|
|
|
2014-09-07 02:57:52 +01:00
|
|
|
EOF
|
2014-08-08 20:34:41 +01:00
|
|
|
|
2014-09-07 02:57:52 +01:00
|
|
|
chmod +x $out/bin/higan-init.sh
|
|
|
|
'';
|
2014-08-08 20:34:41 +01:00
|
|
|
|
2015-04-06 02:54:16 +01:00
|
|
|
meta = {
|
2014-08-08 20:34:41 +01:00
|
|
|
description = "An open-source, cycle-accurate Nintendo multi-system emulator";
|
|
|
|
longDescription = ''
|
2018-10-27 10:45:59 +01:00
|
|
|
higan (formerly bsnes) is a multi-system game console emulator.
|
2014-08-08 20:34:41 +01:00
|
|
|
It currently supports the following systems:
|
2019-02-26 11:45:54 +00:00
|
|
|
- Nintendo's Famicom, Super Famicom (with subsystems:
|
|
|
|
Super Game Boy, BS-X Satellaview, Sufami Turbo);
|
2017-02-19 18:27:04 +00:00
|
|
|
Game Boy, Game Boy Color, Game Boy Advance;
|
|
|
|
- Sega's Master System, Game Gear, Mega Drive;
|
|
|
|
- NEC's PC Engine, SuperGrafx;
|
2017-11-28 09:23:42 +00:00
|
|
|
- Bandai's WonderSwan, WonderSwan Color.
|
2014-08-08 20:34:41 +01:00
|
|
|
'';
|
2018-10-07 03:35:41 +01:00
|
|
|
homepage = https://byuu.org/emulation/higan/;
|
2014-09-07 02:57:52 +01:00
|
|
|
license = licenses.gpl3Plus;
|
2017-02-19 18:27:04 +00:00
|
|
|
maintainers = with maintainers; [ AndersonTorres ];
|
|
|
|
platforms = with platforms; unix;
|
2014-08-08 20:34:41 +01:00
|
|
|
};
|
|
|
|
}
|