From 7070c2d9008f8f637d25f9da2f4fd129a8619f5e Mon Sep 17 00:00:00 2001 From: AndersonTorres Date: Sat, 12 Dec 2015 14:23:56 -0200 Subject: [PATCH] Higan: 094 -> 095 In order to increase portability and flexibility, now the build phase explicitly sets "compiler=c++" as a make parameter. Further, there is a link "higan" for backwards compatibility; higan was split in icarus (the game ROMS database manager) and tomoko (the emulator itself). --- .../emulators/higan/0001-change-flags.diff | 35 +++++++++++++ pkgs/misc/emulators/higan/default.nix | 52 +++++++++---------- pkgs/top-level/all-packages.nix | 4 +- 3 files changed, 61 insertions(+), 30 deletions(-) create mode 100644 pkgs/misc/emulators/higan/0001-change-flags.diff diff --git a/pkgs/misc/emulators/higan/0001-change-flags.diff b/pkgs/misc/emulators/higan/0001-change-flags.diff new file mode 100644 index 00000000000..78f4a248c5f --- /dev/null +++ b/pkgs/misc/emulators/higan/0001-change-flags.diff @@ -0,0 +1,35 @@ +diff -rupN higan_v095-source.orig/GNUmakefile higan_v095-source/GNUmakefile +--- higan_v095-source.orig/GNUmakefile 2015-11-04 10:28:26.173428178 +0100 ++++ higan_v095-source/GNUmakefile 2015-11-04 10:28:31.752231593 +0100 +@@ -12,7 +12,8 @@ target := tomoko + # console := true + + # compiler +-flags += -I. -O3 ++flags += -I. $(CXXFLAGS) ++link += $(LDFLAGS) + objects := libco + + # profile-guided optimization mode +@@ -43,7 +44,7 @@ ifeq ($(platform),windows) + else ifeq ($(platform),macosx) + flags += -march=native + else ifeq ($(platform),linux) +- flags += -march=native -fopenmp ++ flags += -fopenmp + link += -fopenmp + link += -Wl,-export-dynamic + link += -lX11 -lXext -ldl +diff -rupN higan_v095-source.orig/icarus/GNUmakefile higan_v095-source/icarus/GNUmakefile +--- higan_v095-source.orig/icarus/GNUmakefile 2015-11-04 10:28:26.186486119 +0100 ++++ higan_v095-source/icarus/GNUmakefile 2015-11-04 10:28:48.755059317 +0100 +@@ -1,8 +1,8 @@ + include ../nall/GNUmakefile + include ../hiro/GNUmakefile + +-flags += -I.. -O3 +-link += ++flags += -I.. $(CXXFLAGS) ++link += $(LDFLAGS) + objects := obj/hiro.o obj/icarus.o + objects += $(if $(call streq,$(platform),windows),obj/resource.o) diff --git a/pkgs/misc/emulators/higan/default.nix b/pkgs/misc/emulators/higan/default.nix index 95793de9884..080805e9df5 100644 --- a/pkgs/misc/emulators/higan/default.nix +++ b/pkgs/misc/emulators/higan/default.nix @@ -1,56 +1,51 @@ { stdenv, fetchurl -, pkgconfig +, p7zip, pkgconfig , libX11, libXv , udev , mesa, SDL , libao, openal, libpulseaudio -, profile ? "performance" # Options: accuracy, balanced, performance -, guiToolkit ? "gtk" # can be gtk or qt4 -, gtk ? null, qt4 ? null }: - -assert guiToolkit == "gtk" || guiToolkit == "qt4"; -assert (guiToolkit == "gtk" -> gtk != null) || (guiToolkit == "qt4" -> qt4 != null); +, gtk, gtksourceview +, profile ? "balanced" # Options: accuracy, balanced, performance +}: with stdenv.lib; stdenv.mkDerivation rec { - name = "higan-${version}"; - version = "094"; - sourceName = "higan_v${version}-source"; + name = "higan-${meta.version}"; + sourceName = "higan_v${meta.version}-source"; src = fetchurl { - urls = [ "http://files.byuu.org/download/${sourceName}.tar.xz" ]; - sha256 = "06qm271pzf3qf2labfw2lx6k0xcd89jndmn0jzmnc40cspwrs52y"; + urls = [ "http://download.byuu.org/${sourceName}.7z" ]; + sha256 = "0xsgyijcf4psi3mlahr5iq7vbbw3jby1if5pkhg8c5xqckpi2fj4"; curlOpts = "--user-agent 'Mozilla/5.0'"; # the good old user-agent trick... }; + patches = [ ./0001-change-flags.diff ]; + buildInputs = - [ pkgconfig libX11 libXv udev mesa SDL libao openal libpulseaudio ] - ++ optionals (guiToolkit == "gtk") [ gtk ] - ++ optionals (guiToolkit == "qt4") [ qt4 ]; + [ p7zip pkgconfig libX11 libXv udev mesa SDL libao openal libpulseaudio gtk gtksourceview ]; + + unpackPhase = '' + 7z x $src + sourceRoot=${sourceName} + ''; buildPhase = '' - make phoenix=${guiToolkit} profile=${profile} -C ananke - make phoenix=${guiToolkit} profile=${profile} + make compiler=c++ profile=${profile} -C icarus + make compiler=c++ profile=${profile} ''; installPhase = '' - install -dm 755 $out/share/applications $out/share/pixmaps $out/share/higan/Video\ Shaders $out/bin $out/lib - + install -dm 755 $out/bin $out/share/applications $out/share/higan $out/share/pixmaps + install -m 755 icarus/icarus $out/bin/ + install -m 755 out/tomoko $out/bin/ + (cd $out/bin; ln -Ts tomoko higan) #backwards compatibility install -m 644 data/higan.desktop $out/share/applications/ install -m 644 data/higan.png $out/share/pixmaps/ - cp -dr --no-preserve=ownership profile/* data/cheats.bml $out/share/higan/ - cp -dr --no-preserve=ownership shaders/*.shader $out/share/higan/Video\ Shaders/ - - install -m 755 out/higan $out/bin/higan - install -m 644 ananke/libananke.so $out/lib/libananke.so.1 - (cd $out/lib && ln -s libananke.so.1 libananke.so) + cp -dr --no-preserve='ownership' profile/* data/cheats.bml $out/share/higan/ ''; fixupPhase = '' - oldRPath=$(patchelf --print-rpath $out/bin/higan) - patchelf --set-rpath $oldRPath:$out/lib $out/bin/higan - # A dirty workaround, suggested by @cpages: # we create a first-run script to populate # the local $HOME with all the auxiliary @@ -67,6 +62,7 @@ stdenv.mkDerivation rec { ''; meta = { + version = "095"; description = "An open-source, cycle-accurate Nintendo multi-system emulator"; longDescription = '' Higan (formerly bsnes) is a Nintendo multi-system emulator. diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e109024a199..1176256e63a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15773,8 +15773,8 @@ let snes9x-gtk = callPackage ../misc/emulators/snes9x-gtk { }; higan = callPackage ../misc/emulators/higan { - profile = config.higan.profile or "performance"; - guiToolkit = config.higan.guiToolkit or "gtk"; + inherit (gnome) gtksourceview; + profile = config.higan.profile or "balanced"; }; misc = callPackage ../misc/misc.nix { };