summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndersonTorres <torres.anderson.85@gmail.com>2014-09-06 22:57:52 -0300
committerMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2014-09-20 23:51:15 +0100
commit4f85f64153f8d9894f8dc8ab22a33e20634b1c8f (patch)
tree18b418208f3a6ca1c42da0b101cff0d474e9345c
parent1e5452865b5eff0dca54552129c13b8e96d095b8 (diff)
downloadnixpkgs-4f85f64153f8d9894f8dc8ab22a33e20634b1c8f.tar
nixpkgs-4f85f64153f8d9894f8dc8ab22a33e20634b1c8f.tar.gz
nixpkgs-4f85f64153f8d9894f8dc8ab22a33e20634b1c8f.tar.bz2
nixpkgs-4f85f64153f8d9894f8dc8ab22a33e20634b1c8f.tar.lz
nixpkgs-4f85f64153f8d9894f8dc8ab22a33e20634b1c8f.tar.xz
nixpkgs-4f85f64153f8d9894f8dc8ab22a33e20634b1c8f.tar.zst
nixpkgs-4f85f64153f8d9894f8dc8ab22a33e20634b1c8f.zip
Higan: adding "profile" and "gui" building options
Also, removing builder.sh and copying everything to Nix expression.

Closes #4048
-rw-r--r--pkgs/misc/emulators/higan/builder.sh35
-rw-r--r--pkgs/misc/emulators/higan/default.nix61
-rw-r--r--pkgs/top-level/all-packages.nix5
3 files changed, 55 insertions, 46 deletions
diff --git a/pkgs/misc/emulators/higan/builder.sh b/pkgs/misc/emulators/higan/builder.sh
deleted file mode 100644
index 0d01f7dc971..00000000000
--- a/pkgs/misc/emulators/higan/builder.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-
-source $stdenv/setup
-
-unpackPhase
-cd $sourceName
-make phoenix=gtk profile=accuracy -C ananke
-make phoenix=gtk profile=accuracy
-
-install -dm 755 $out/share/applications $out/share/pixmaps $out/share/higan/Video\ Shaders $out/bin $out/lib
-
-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)
-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
-# stuff needed by higan at runtime
-
-cat <<EOF > $out/bin/higan-config.sh
-#!${shell}
-
-cp --update --recursive $out/share/higan \$HOME/.config
-chmod --recursive u+w \$HOME/.config/higan
-
-EOF
-
-chmod +x $out/bin/higan-config.sh
diff --git a/pkgs/misc/emulators/higan/default.nix b/pkgs/misc/emulators/higan/default.nix
index 532eeef2280..6ce3ca2356c 100644
--- a/pkgs/misc/emulators/higan/default.nix
+++ b/pkgs/misc/emulators/higan/default.nix
@@ -2,9 +2,14 @@
 , pkgconfig
 , libX11, libXv
 , udev
-, mesa, gtk, SDL
+, mesa, SDL
 , libao, openal, pulseaudio
-}:
+, profile ? "accuracy" # Options: accuracy, balanced, performance
+, gui ? "gtk" # can be gtk or qt4
+, gtk ? null, qt4 ? null }:
+
+assert gui == "gtk" || gui == "qt4";
+assert (gui == "gtk" -> gtk != null) || (gui == "qt4" -> qt4 != null);
 
 stdenv.mkDerivation rec {
 
@@ -19,11 +24,48 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = with stdenv.lib;
-  [ pkgconfig libX11 libXv udev mesa gtk SDL libao openal pulseaudio ];
+  [ pkgconfig libX11 libXv udev mesa SDL libao openal pulseaudio ]
+  ++ optionals (gui == "gtk") [ gtk ]
+  ++ optionals (gui == "qt4") [ qt4 ];
+
+  buildPhase = ''
+    make phoenix=${gui} profile=${profile} -C ananke
+    make phoenix=${gui} profile=${profile}
+  '';
+
+  installPhase = ''
+    install -dm 755 $out/share/applications $out/share/pixmaps $out/share/higan/Video\ Shaders $out/bin $out/lib
+
+    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)
+  '';
+
+  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
+    # stuff needed by higan at runtime
+
+    cat <<EOF > $out/bin/higan-init.sh
+    #!${stdenv.shell}
+
+    cp --update --recursive $out/share/higan \$HOME/.config
+    chmod --recursive u+w \$HOME/.config/higan
+    EOF
 
-  builder = ./builder.sh;
+    chmod +x $out/bin/higan-init.sh
+  '';
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "An open-source, cycle-accurate Nintendo multi-system emulator";
     longDescription = ''
       Higan (formerly bsnes) is a Nintendo multi-system emulator.
@@ -34,16 +76,15 @@ stdenv.mkDerivation rec {
         Super Game Boy; BS-X Satellaview; Sufami Turbo
     '';
     homepage = http://byuu.org/higan/;
-    license = stdenv.lib.licenses.gpl3Plus;
-    maintainers = [ stdenv.lib.maintainers.AndersonTorres ];
-    platforms = stdenv.lib.platforms.linux;
+    license = licenses.gpl3Plus;
+    maintainers = [ maintainers.AndersonTorres ];
+    platforms = platforms.linux;
   };
 }
 
 #
 # TODO:
-#   - options to choose profiles (accuracy, balanced, performance)
-#     and different GUIs (gtk2, qt4)
 #   - fix the BML and BIOS paths - maybe submitting
 #     a custom patch to Higan project would not be a bad idea...
+#   - config.higan.{gui,profile} options
 #
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 7e1097e719e..a2684f67108 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -11951,7 +11951,10 @@ let
 
   snes9x-gtk = callPackage ../misc/emulators/snes9x-gtk { };
 
-  higan = callPackage ../misc/emulators/higan { };
+  higan = callPackage ../misc/emulators/higan {
+    profile = "accuracy";
+    gui = "gtk";
+  };
 
   misc = import ../misc/misc.nix { inherit pkgs stdenv; };