diff options
author | Jörg Thalheim <Mic92@users.noreply.github.com> | 2020-03-29 06:42:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-29 06:42:33 +0100 |
commit | fd708a3fe0405e2b101dc37ddf17cd7bbfab9746 (patch) | |
tree | c6732603a33443b4f5d2f6e8b70c22ac432705fa /pkgs/misc/emulators | |
parent | 30c17b640f1293add7b7ff30c8fbf21a0c01db4d (diff) | |
parent | 4c931a821703b5fbfdbca931dbaa28390efc7070 (diff) | |
download | nixpkgs-fd708a3fe0405e2b101dc37ddf17cd7bbfab9746.tar nixpkgs-fd708a3fe0405e2b101dc37ddf17cd7bbfab9746.tar.gz nixpkgs-fd708a3fe0405e2b101dc37ddf17cd7bbfab9746.tar.bz2 nixpkgs-fd708a3fe0405e2b101dc37ddf17cd7bbfab9746.tar.lz nixpkgs-fd708a3fe0405e2b101dc37ddf17cd7bbfab9746.tar.xz nixpkgs-fd708a3fe0405e2b101dc37ddf17cd7bbfab9746.tar.zst nixpkgs-fd708a3fe0405e2b101dc37ddf17cd7bbfab9746.zip |
Merge pull request #83638 from veprbl/pr/higan_darwin_fix
higan: fix darwin build
Diffstat (limited to 'pkgs/misc/emulators')
-rw-r--r-- | pkgs/misc/emulators/higan/default.nix | 51 |
1 files changed, 37 insertions, 14 deletions
diff --git a/pkgs/misc/emulators/higan/default.nix b/pkgs/misc/emulators/higan/default.nix index c1e64d26b47..63a7e1c43db 100644 --- a/pkgs/misc/emulators/higan/default.nix +++ b/pkgs/misc/emulators/higan/default.nix @@ -1,8 +1,9 @@ { stdenv, fetchurl -, p7zip, pkgconfig +, p7zip, pkgconfig, libicns , libX11, libXv , udev , libGLU, libGL, SDL +, Carbon, Cocoa, OpenGL, OpenAL , libao, openal, libpulseaudio , gtk2, gtksourceview , runtimeShell }: @@ -21,11 +22,24 @@ stdenv.mkDerivation rec { }; patches = [ ./0001-change-flags.diff ]; - postPatch = "sed '1i#include <cmath>' -i higan/fc/ppu/ppu.cpp"; + postPatch = '' + sed '1i#include <cmath>' -i higan/fc/ppu/ppu.cpp + + for file in icarus/GNUmakefile higan/target-tomoko/GNUmakefile; do + 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 + ''; + + nativeBuildInputs = [ p7zip pkgconfig ] + ++ optional stdenv.isDarwin [ libicns ]; buildInputs = - [ p7zip pkgconfig libX11 libXv udev libGLU libGL - SDL libao openal libpulseaudio gtk2 gtksourceview ]; + [ SDL libao ] + ++ optionals stdenv.isLinux [ openal libpulseaudio udev libX11 libXv libGLU libGL gtk2 gtksourceview ] + ++ optionals stdenv.isDarwin [ Carbon Cocoa OpenGL OpenAL ] + ; unpackPhase = '' 7z x $src @@ -38,27 +52,36 @@ stdenv.mkDerivation rec { ''; # Now the cheats file will be distributed separately - installPhase = '' - install -dm 755 $out/bin $out/share/applications $out/share/higan $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 + 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" + mv higan/out/higan.app "$out"/ + mv icarus/out/icarus.app "$out"/ + '') + '' + mkdir -p "$out"/share/higan cp --recursive --no-dereference --preserve='links' --no-preserve='ownership' \ - higan/systems/* $out/share/higan/ + higan/systems/* "$out"/share/higan/ ''; - fixupPhase = '' + fixupPhase = let + dest = if !stdenv.isDarwin then "\\$HOME/.local/share/higan" else "\\$HOME/Library/Application Support/higan"; + in '' # 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 + mkdir -p "$out"/bin cat <<EOF > $out/bin/higan-init.sh #!${runtimeShell} - cp --recursive --update $out/share/higan/*.sys \$HOME/.local/share/higan/ + cp --recursive --update $out/share/higan/*.sys "${dest}"/ EOF |