higan: 106 -> 110

This commit is contained in:
AndersonTorres 2020-04-06 08:46:00 -03:00
parent 7cfd7367c1
commit 187718251e
2 changed files with 104 additions and 78 deletions

View File

@ -1,26 +1,25 @@
diff -Naur higan_v105-source.old/higan/GNUmakefile higan_v105-source.new/higan/GNUmakefile diff -Naur higan-110-old/higan/GNUmakefile higan-110-new/higan/GNUmakefile
--- higan_v105-source.old/higan/GNUmakefile 2017-10-07 01:34:22.000000000 -0300 --- higan-110-old/higan/GNUmakefile 2020-04-15 11:06:00.279935557 -0300
+++ higan_v105-source.new/higan/GNUmakefile 2017-10-17 00:02:40.580957396 -0200 +++ higan-110-new/higan/GNUmakefile 2020-04-15 11:08:32.982417291 -0300
@@ -26,7 +26,7 @@ @@ -11,7 +11,7 @@
flags += -fopenmp include $(nall.path)/GNUmakefile
link += -fopenmp
ifeq ($(binary),application)
- flags += -march=native
+ flags +=
link += -Wl,-export-dynamic
link += -lX11 -lXext
else ifeq ($(binary),library)
diff -Naur higan_v105-source.old/nall/GNUmakefile higan_v105-source.new/nall/GNUmakefile
--- higan_v105-source.old/nall/GNUmakefile 2017-09-23 18:34:22.000000000 -0300
+++ higan_v105-source.new/nall/GNUmakefile 2017-10-17 00:03:33.568916550 -0200
@@ -40,8 +40,8 @@
objcflags := -x objective-c -std=c11
cppflags := -x c++ -std=c++14
objcppflags := -x objective-c++ -std=c++14
-flags :=
-link :=
+flags := $(CXXFLAGS)
+link := $(LDFLAGS)
# compiler detection ifeq ($(platform),local)
ifeq ($(compiler),) - flags += -march=native
+ flags +=
endif
ifeq ($(platform),windows)
diff -Naur higan-110-old/nall/GNUmakefile higan-110-new/nall/GNUmakefile
--- higan-110-old/nall/GNUmakefile 2020-04-15 11:06:00.396935154 -0300
+++ higan-110-new/nall/GNUmakefile 2020-04-15 11:10:37.738011488 -0300
@@ -127,7 +127,8 @@
# linux settings
ifeq ($(platform),linux)
- options += -ldl
+ flags += $(CXXFLAGS)
+ options += $(LDFLAGS) -ldl
endif
# bsd settings

View File

@ -1,108 +1,135 @@
{ stdenv, fetchurl { stdenv, fetchFromGitHub
, p7zip, pkgconfig, libicns , pkgconfig
, libX11, libXv , libX11, libXv
, udev , udev
, libGLU, libGL, SDL , libGLU, libGL, SDL2
, Carbon, Cocoa, OpenGL, OpenAL
, libao, openal, libpulseaudio , libao, openal, libpulseaudio
, alsaLib
, gtk2, gtksourceview , gtk2, gtksourceview
, runtimeShell }: , runtimeShell
# Darwin dependencies
, libicns, Carbon, Cocoa, OpenGL, OpenAL}:
with stdenv.lib; let
inherit (stdenv.lib) optionals;
in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "higan"; pname = "higan";
version = "106"; version = "110";
sourceName = "higan_v${version}-source";
src = fetchurl { src = fetchFromGitHub {
urls = [ "https://download.byuu.org/${sourceName}.7z" ]; owner = "higan-emu";
sha256 = "063dzp9wrdnbvagraxi31xg0154y2gf67rrd0mnc8h104cgzjr35"; repo = "higan";
curlOpts = "--user-agent 'Mozilla/5.0'"; # the good old user-agent trick... rev = "v${version}";
sha256 = "11rvm53c3p2f6zk8xbyv2j51xp8zmqnch7zravhj3fk590qrjrr2";
}; };
patches = [ ./0001-change-flags.diff ]; patches = [ ./0001-change-flags.diff ];
postPatch = '' postPatch = ''
sed '1i#include <cmath>' -i higan/fc/ppu/ppu.cpp sed '1i#include <cmath>' -i higan/fc/ppu/ppu.cpp
for file in icarus/GNUmakefile higan/target-tomoko/GNUmakefile; do for file in icarus/GNUmakefile higan/target-higan/GNUmakefile; do
substituteInPlace "$file" \ substituteInPlace "$file" \
--replace 'sips -s format icns data/$(name).png --out out/$(name).app/Contents/Resources/$(name).icns' \ --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' 'png2icns out/$(name).app/Contents/Resources/$(name).icns data/$(name).png'
done done
''; '';
nativeBuildInputs = [ p7zip pkgconfig ] nativeBuildInputs = [ pkgconfig ]
++ optional stdenv.isDarwin [ libicns ]; ++ optionals stdenv.isDarwin [ libicns ];
buildInputs = buildInputs = [ SDL2 libao ]
[ SDL libao ] ++ optionals stdenv.isLinux [ alsaLib udev libpulseaudio openal
++ optionals stdenv.isLinux [ openal libpulseaudio udev libX11 libXv libGLU libGL gtk2 gtksourceview ] gtk2 gtksourceview libX11 libXv
++ optionals stdenv.isDarwin [ Carbon Cocoa OpenGL OpenAL ] libGLU libGL ]
; ++ optionals stdenv.isDarwin [ Carbon Cocoa OpenGL OpenAL ];
unpackPhase = ''
7z x $src
sourceRoot=${sourceName}
'';
buildPhase = '' buildPhase = ''
make compiler=c++ -C icarus make compiler=c++ -C higan openmp=true target=higan
make compiler=c++ -C higan make compiler=c++ -C genius openmp=true
make compiler=c++ -C icarus openmp=true
''; '';
# Now the cheats file will be distributed separately installPhase = (if stdenv.isDarwin then ''
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" mkdir "$out"
mv higan/out/higan.app "$out"/ mv higan/out/higan.app "$out"/
mv icarus/out/icarus.app "$out"/ mv icarus/out/icarus.app "$out"/
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
'') + '' '') + ''
mkdir -p "$out"/share/higan mkdir -p "$out"/share/higan "$out"/share/icarus
cp --recursive --no-dereference --preserve='links' --no-preserve='ownership' \ cp --recursive --no-dereference --preserve='links' --no-preserve='ownership' \
higan/systems/* "$out"/share/higan/ higan/System/ "$out"/share/higan/
cp --recursive --no-dereference --preserve='links' --no-preserve='ownership' \
icarus/Database icarus/Firmware $out/share/icarus/
''; '';
fixupPhase = let fixupPhase = let
dest = if !stdenv.isDarwin then "\\$HOME/.local/share/higan" else "\\$HOME/Library/Application Support/higan"; dest = if stdenv.isDarwin
then "\\$HOME/Library/Application Support/higan"
else "\\$HOME/higan";
in '' in ''
# A dirty workaround, suggested by @cpages: # A dirty workaround, suggested by @cpages:
# we create a first-run script to populate # we create a first-run script to populate
# the local $HOME with all the auxiliary # $HOME with all the stuff needed at runtime
# stuff needed by higan at runtime
mkdir -p "$out"/bin mkdir -p "$out"/bin
cat <<EOF > $out/bin/higan-init.sh cat <<EOF > $out/bin/higan-init.sh
#!${runtimeShell} #!${runtimeShell}
cp --recursive --update $out/share/higan/*.sys "${dest}"/ cp --recursive --update $out/share/higan/System/ "${dest}"/
EOF EOF
chmod +x $out/bin/higan-init.sh chmod +x $out/bin/higan-init.sh
''; '';
meta = { meta = with stdenv.lib; {
description = "An open-source, cycle-accurate Nintendo multi-system emulator"; description = "An open-source, cycle-accurate multi-system emulator";
longDescription = '' longDescription = ''
higan (formerly bsnes) is a multi-system game console emulator. 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.
It currently supports the following systems: It currently supports the following systems:
- Nintendo's Famicom, Super Famicom (with subsystems: - Famicom + Famicom Disk System
Super Game Boy, BS-X Satellaview, Sufami Turbo); - Super Famicom + Super Game Boy
Game Boy, Game Boy Color, Game Boy Advance; - Game Boy + Game Boy Color
- Sega's Master System, Game Gear, Mega Drive; - Game Boy Advance + Game Boy Player
- NEC's PC Engine, SuperGrafx; - SG-1000 + SC-3000
- Bandai's WonderSwan, WonderSwan Color. - 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
''; '';
homepage = "https://byuu.org/emulation/higan/"; homepage = "https://byuu.org/higan/";
license = licenses.gpl3Plus; license = licenses.gpl3Plus;
maintainers = with maintainers; [ AndersonTorres ]; maintainers = with maintainers; [ AndersonTorres ];
platforms = with platforms; unix; platforms = platforms.unix;
}; };
} }
# TODO: Qt and GTK3+ support