2021-10-01 09:20:50 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, SDL2
|
2021-06-28 23:13:55 +00:00
|
|
|
, alsa-lib
|
2021-10-01 09:20:50 +00:00
|
|
|
, gtk3
|
|
|
|
, gtksourceview3
|
|
|
|
, libGL
|
|
|
|
, libGLU
|
|
|
|
, libX11
|
|
|
|
, libXv
|
|
|
|
, libao
|
|
|
|
, libpulseaudio
|
|
|
|
, openal
|
|
|
|
, pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
, runtimeShell
|
2021-10-01 09:20:50 +00:00
|
|
|
, udev
|
2020-04-24 23:36:52 +00:00
|
|
|
# Darwin dependencies
|
2021-10-01 09:20:50 +00:00
|
|
|
, libicns
|
|
|
|
, Carbon
|
|
|
|
, Cocoa
|
|
|
|
, OpenAL
|
|
|
|
, OpenGL
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "higan";
|
2021-10-01 09:20:50 +00:00
|
|
|
version = "115+unstable=2021-08-18";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "higan-emu";
|
|
|
|
repo = "higan";
|
2021-10-01 09:20:50 +00:00
|
|
|
rev = "9bf1b3314b2bcc73cbc11d344b369c31562aff10";
|
|
|
|
hash = "sha256-HZItJ97x20OjFKv2OVbMja7g+c1ZXcgcaC/XDe3vMZM=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-10-01 09:20:50 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
libicns
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
SDL2
|
|
|
|
libao
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
alsa-lib
|
|
|
|
gtk3
|
|
|
|
gtksourceview3
|
|
|
|
libGL
|
|
|
|
libGLU
|
|
|
|
libX11
|
|
|
|
libXv
|
|
|
|
libpulseaudio
|
|
|
|
openal
|
|
|
|
udev
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
Carbon
|
|
|
|
Cocoa
|
|
|
|
OpenAL
|
|
|
|
OpenGL
|
|
|
|
];
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# Includes cmath header
|
|
|
|
./001-include-cmath.patch
|
|
|
|
# Uses png2icns instead of sips
|
|
|
|
./002-sips-to-png2icns.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
dontConfigure = true;
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-10-01 09:20:50 +00:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-10-01 09:20:50 +00:00
|
|
|
make -j $NIX_BUILD_CORES compiler=${stdenv.cc.targetPrefix}c++ \
|
|
|
|
platform=linux openmp=true hiro=gtk3 build=accuracy local=false \
|
|
|
|
cores="cv fc gb gba md ms msx ngp pce sfc sg ws" -C higan-ui
|
|
|
|
make -j $NIX_BUILD_CORES compiler=${stdenv.cc.targetPrefix}c++ \
|
|
|
|
platform=linux openmp=true hiro=gtk3 -C icarus
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-10-01 09:20:50 +00:00
|
|
|
runHook postBuild
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-10-01 09:20:50 +00:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
'' + (if stdenv.isDarwin then ''
|
|
|
|
mkdir ${placeholder "out"}
|
|
|
|
mv higan/out/higan.app ${placeholder "out"}/
|
|
|
|
mv icarus/out/icarus.app ${placeholder "out"}/
|
2020-04-24 23:36:52 +00:00
|
|
|
'' else ''
|
2021-10-01 09:20:50 +00:00
|
|
|
install -d ${placeholder "out"}/bin
|
|
|
|
install higan-ui/out/higan -t ${placeholder "out"}/bin/
|
|
|
|
install icarus/out/icarus -t ${placeholder "out"}/bin/
|
|
|
|
|
|
|
|
install -d ${placeholder "out"}/share/applications
|
|
|
|
install higan-ui/resource/higan.desktop -t ${placeholder "out"}/share/applications/
|
|
|
|
install icarus/resource/icarus.desktop -t ${placeholder "out"}/share/applications/
|
|
|
|
|
|
|
|
install -d ${placeholder "out"}/share/pixmaps
|
|
|
|
install higan/higan/resource/higan.svg ${placeholder "out"}/share/pixmaps/higan-icon.svg
|
|
|
|
install higan/higan/resource/logo.png ${placeholder "out"}/share/pixmaps/higan-icon.png
|
|
|
|
install icarus/resource/icarus.svg ${placeholder "out"}/share/pixmaps/icarus-icon.svg
|
|
|
|
install icarus/resource/icarus.png ${placeholder "out"}/share/pixmaps/icarus-icon.png
|
2020-04-24 23:36:52 +00:00
|
|
|
'') + ''
|
2021-10-01 09:20:50 +00:00
|
|
|
install -d ${placeholder "out"}/share/higan
|
|
|
|
cp -rd extras/ higan/System/ ${placeholder "out"}/share/higan/
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-10-01 09:20:50 +00:00
|
|
|
install -d ${placeholder "out"}/share/icarus
|
|
|
|
cp -rd icarus/Database icarus/Firmware ${placeholder "out"}/share/icarus/
|
|
|
|
'' + (
|
2020-04-24 23:36:52 +00:00
|
|
|
# A dirty workaround, suggested by @cpages:
|
|
|
|
# we create a first-run script to populate
|
|
|
|
# $HOME with all the stuff needed at runtime
|
2021-10-01 09:20:50 +00:00
|
|
|
let
|
|
|
|
dest = if stdenv.isDarwin
|
|
|
|
then "\\$HOME/Library/Application Support/higan"
|
|
|
|
else "\\$HOME/higan";
|
|
|
|
in ''
|
|
|
|
mkdir -p ${placeholder "out"}/bin
|
|
|
|
cat <<EOF > ${placeholder "out"}/bin/higan-init.sh
|
2020-04-24 23:36:52 +00:00
|
|
|
#!${runtimeShell}
|
|
|
|
|
2021-10-01 09:20:50 +00:00
|
|
|
cp --recursive --update ${placeholder "out"}/share/higan/System/ "${dest}"/
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
EOF
|
|
|
|
|
2021-10-01 09:20:50 +00:00
|
|
|
chmod +x ${placeholder "out"}/bin/higan-init.sh
|
|
|
|
'') + ''
|
|
|
|
|
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2021-10-01 09:20:50 +00:00
|
|
|
homepage = "https://github.com/higan-emu/higan";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "An open-source, cycle-accurate multi-system emulator";
|
|
|
|
longDescription = ''
|
2021-10-01 09:20:50 +00:00
|
|
|
higan is a multi-system emulator, originally developed by Near, with an
|
|
|
|
uncompromising focus on accuracy and code readability.
|
|
|
|
|
|
|
|
It currently emulates the following systems: 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.
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
license = licenses.gpl3Plus;
|
|
|
|
maintainers = with maintainers; [ AndersonTorres ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|
2021-10-01 09:20:50 +00:00
|
|
|
# TODO: select between Qt, GTK2 and GTK3
|