2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub
|
2021-01-17 02:30:45 +00:00
|
|
|
, pkg-config
|
2014-08-08 20:34:41 +01:00
|
|
|
, libX11, libXv
|
|
|
|
, udev
|
2020-04-06 12:46:00 +01:00
|
|
|
, libGLU, libGL, SDL2
|
2015-05-27 20:42:15 +01:00
|
|
|
, libao, openal, libpulseaudio
|
2020-04-06 12:46:00 +01:00
|
|
|
, alsaLib
|
2019-02-26 11:45:54 +00:00
|
|
|
, gtk2, gtksourceview
|
2020-04-06 12:46:00 +01:00
|
|
|
, runtimeShell
|
|
|
|
# Darwin dependencies
|
|
|
|
, libicns, Carbon, Cocoa, OpenGL, OpenAL}:
|
2014-08-08 20:34:41 +01:00
|
|
|
|
2020-04-06 12:46:00 +01:00
|
|
|
let
|
2021-01-15 13:21:58 +00:00
|
|
|
inherit (lib) optionals;
|
2020-04-06 12:46:00 +01:00
|
|
|
in
|
2014-08-08 20:34:41 +01:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "higan";
|
2020-04-06 12:46:00 +01:00
|
|
|
version = "110";
|
2014-08-08 20:34:41 +01:00
|
|
|
|
2020-04-06 12:46:00 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "higan-emu";
|
|
|
|
repo = "higan";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "11rvm53c3p2f6zk8xbyv2j51xp8zmqnch7zravhj3fk590qrjrr2";
|
2014-08-08 20:34:41 +01:00
|
|
|
};
|
|
|
|
|
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
|
|
|
|
|
2020-04-06 12:46:00 +01:00
|
|
|
for file in icarus/GNUmakefile higan/target-higan/GNUmakefile; do
|
2020-03-29 02:48:56 +01:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2021-01-17 02:30:45 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ]
|
2020-04-06 12:46:00 +01:00
|
|
|
++ optionals stdenv.isDarwin [ libicns ];
|
2015-12-12 16:23:56 +00:00
|
|
|
|
2020-04-06 12:46:00 +01:00
|
|
|
buildInputs = [ SDL2 libao ]
|
|
|
|
++ optionals stdenv.isLinux [ alsaLib udev libpulseaudio openal
|
|
|
|
gtk2 gtksourceview libX11 libXv
|
|
|
|
libGLU libGL ]
|
|
|
|
++ optionals stdenv.isDarwin [ Carbon Cocoa OpenGL OpenAL ];
|
2014-09-07 02:57:52 +01:00
|
|
|
|
|
|
|
buildPhase = ''
|
2020-04-06 12:46:00 +01:00
|
|
|
make compiler=c++ -C higan openmp=true target=higan
|
|
|
|
make compiler=c++ -C genius openmp=true
|
|
|
|
make compiler=c++ -C icarus openmp=true
|
2014-09-07 02:57:52 +01:00
|
|
|
'';
|
|
|
|
|
2020-04-06 12:46:00 +01:00
|
|
|
installPhase = (if stdenv.isDarwin then ''
|
2020-03-29 02:48:56 +01:00
|
|
|
mkdir "$out"
|
|
|
|
mv higan/out/higan.app "$out"/
|
|
|
|
mv icarus/out/icarus.app "$out"/
|
2020-04-06 12:46:00 +01:00
|
|
|
mv genius/out/genius.app "$out"/
|
|
|
|
'' else ''
|
|
|
|
install -dm 755 "$out"/bin "$out"/share/applications "$out"/share/pixmaps
|
|
|
|
|
|
|
|
install -m 755 higan/out/higan -t "$out"/bin/
|
|
|
|
install -m 644 higan/target-higan/resource/higan.desktop \
|
|
|
|
-t $out/share/applications/
|
|
|
|
install -m 644 higan/target-higan/resource/higan.svg \
|
|
|
|
$out/share/pixmaps/higan-icon.svg
|
|
|
|
install -m 644 higan/target-higan/resource/higan.png \
|
|
|
|
$out/share/pixmaps/higan-icon.png
|
|
|
|
|
|
|
|
install -m 755 icarus/out/icarus -t "$out"/bin/
|
|
|
|
install -m 644 icarus/data/icarus.desktop -t $out/share/applications/
|
|
|
|
install -m 644 icarus/data/icarus.svg $out/share/pixmaps/icarus-icon.svg
|
|
|
|
install -m 644 icarus/data/icarus.png $out/share/pixmaps/icarus-icon.png
|
|
|
|
|
|
|
|
install -m 755 genius/out/genius -t "$out"/bin/
|
|
|
|
install -m 644 genius/data/genius.desktop -t $out/share/applications/
|
|
|
|
install -m 644 genius/data/genius.svg $out/share/pixmaps/genius-icon.svg
|
|
|
|
install -m 644 genius/data/genius.png $out/share/pixmaps/genius-icon.png
|
2020-03-29 02:48:56 +01:00
|
|
|
'') + ''
|
2020-04-06 12:46:00 +01:00
|
|
|
mkdir -p "$out"/share/higan "$out"/share/icarus
|
|
|
|
cp --recursive --no-dereference --preserve='links' --no-preserve='ownership' \
|
|
|
|
higan/System/ "$out"/share/higan/
|
2016-08-22 18:12:03 +01:00
|
|
|
cp --recursive --no-dereference --preserve='links' --no-preserve='ownership' \
|
2020-04-06 12:46:00 +01:00
|
|
|
icarus/Database icarus/Firmware $out/share/icarus/
|
2014-09-07 02:57:52 +01:00
|
|
|
'';
|
|
|
|
|
2020-03-29 02:48:56 +01:00
|
|
|
fixupPhase = let
|
2020-04-06 12:46:00 +01:00
|
|
|
dest = if stdenv.isDarwin
|
|
|
|
then "\\$HOME/Library/Application Support/higan"
|
|
|
|
else "\\$HOME/higan";
|
2020-03-29 02:48:56 +01:00
|
|
|
in ''
|
2014-09-07 02:57:52 +01:00
|
|
|
# A dirty workaround, suggested by @cpages:
|
|
|
|
# we create a first-run script to populate
|
2020-04-06 12:46:00 +01:00
|
|
|
# $HOME with all the stuff needed at runtime
|
2014-09-07 02:57:52 +01:00
|
|
|
|
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-04-06 12:46:00 +01:00
|
|
|
cp --recursive --update $out/share/higan/System/ "${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
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-04-06 12:46:00 +01:00
|
|
|
description = "An open-source, cycle-accurate multi-system emulator";
|
2014-08-08 20:34:41 +01:00
|
|
|
longDescription = ''
|
2020-04-06 12:46:00 +01:00
|
|
|
higan is a multi-system game console emulator. The purpose of higan is to
|
|
|
|
serve as hardware documentation in source code form: it is meant to be as
|
|
|
|
accurate and complete as possible, with code that is easy to read and
|
|
|
|
understand.
|
|
|
|
|
2014-08-08 20:34:41 +01:00
|
|
|
It currently supports the following systems:
|
2020-04-06 12:46:00 +01:00
|
|
|
- Famicom + Famicom Disk System
|
|
|
|
- Super Famicom + Super Game Boy
|
|
|
|
- Game Boy + Game Boy Color
|
|
|
|
- Game Boy Advance + Game Boy Player
|
|
|
|
- SG-1000 + SC-3000
|
|
|
|
- Master System + Game Gear
|
|
|
|
- Mega Drive + Mega CD
|
|
|
|
- PC Engine + SuperGrafx
|
|
|
|
- MSX + MSX2
|
|
|
|
- ColecoVision
|
|
|
|
- Neo Geo Pocket + Neo Geo Pocket Color
|
|
|
|
- WonderSwan + WonderSwan Color + SwanCrystal + Pocket Challenge V2
|
2014-08-08 20:34:41 +01:00
|
|
|
'';
|
2020-04-06 12:46:00 +01:00
|
|
|
homepage = "https://byuu.org/higan/";
|
2014-09-07 02:57:52 +01:00
|
|
|
license = licenses.gpl3Plus;
|
2017-02-19 18:27:04 +00:00
|
|
|
maintainers = with maintainers; [ AndersonTorres ];
|
2020-04-06 12:46:00 +01:00
|
|
|
platforms = platforms.unix;
|
2014-08-08 20:34:41 +01:00
|
|
|
};
|
|
|
|
}
|
2020-04-06 12:46:00 +01:00
|
|
|
# TODO: Qt and GTK3+ support
|