Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

higan: fix darwin build

(cherry picked from commit 4c931a821703b5fbfdbca931dbaa28390efc7070)

authored by

Dmitry Kalinkin and committed by
Daiderd Jordan
feacec6a 8876e5ed

+38 -14
+37 -14
pkgs/misc/emulators/higan/default.nix
··· 1 1 { stdenv, fetchurl 2 - , p7zip, pkgconfig 2 + , p7zip, pkgconfig, libicns 3 3 , libX11, libXv 4 4 , udev 5 5 , libGLU, libGL, SDL 6 + , Carbon, Cocoa, OpenGL, OpenAL 6 7 , libao, openal, libpulseaudio 7 8 , gtk2, gtksourceview 8 9 , runtimeShell }: ··· 21 22 }; 22 23 23 24 patches = [ ./0001-change-flags.diff ]; 24 - postPatch = "sed '1i#include <cmath>' -i higan/fc/ppu/ppu.cpp"; 25 + postPatch = '' 26 + sed '1i#include <cmath>' -i higan/fc/ppu/ppu.cpp 27 + 28 + for file in icarus/GNUmakefile higan/target-tomoko/GNUmakefile; do 29 + substituteInPlace "$file" \ 30 + --replace 'sips -s format icns data/$(name).png --out out/$(name).app/Contents/Resources/$(name).icns' \ 31 + 'png2icns out/$(name).app/Contents/Resources/$(name).icns data/$(name).png' 32 + done 33 + ''; 34 + 35 + nativeBuildInputs = [ p7zip pkgconfig ] 36 + ++ optional stdenv.isDarwin [ libicns ]; 25 37 26 38 buildInputs = 27 - [ p7zip pkgconfig libX11 libXv udev libGLU libGL 28 - SDL libao openal libpulseaudio gtk2 gtksourceview ]; 39 + [ SDL libao ] 40 + ++ optionals stdenv.isLinux [ openal libpulseaudio udev libX11 libXv libGLU libGL gtk2 gtksourceview ] 41 + ++ optionals stdenv.isDarwin [ Carbon Cocoa OpenGL OpenAL ] 42 + ; 29 43 30 44 unpackPhase = '' 31 45 7z x $src ··· 38 52 ''; 39 53 40 54 # Now the cheats file will be distributed separately 41 - installPhase = '' 42 - install -dm 755 $out/bin $out/share/applications $out/share/higan $out/share/pixmaps 43 - install -m 755 icarus/out/icarus $out/bin/ 44 - install -m 755 higan/out/higan $out/bin/ 45 - install -m 644 higan/data/higan.desktop $out/share/applications/ 46 - install -m 644 higan/data/higan.png $out/share/pixmaps/higan-icon.png 47 - install -m 644 higan/resource/logo/higan.png $out/share/pixmaps/higan-logo.png 55 + installPhase = (if !stdenv.isDarwin then '' 56 + mkdir -p "$out"/bin "$out"/share/applications "$out"/share/pixmaps 57 + install -m 755 icarus/out/icarus "$out"/bin/ 58 + install -m 755 higan/out/higan "$out"/bin/ 59 + install -m 644 higan/data/higan.desktop "$out"/share/applications/ 60 + install -m 644 higan/data/higan.png "$out"/share/pixmaps/higan-icon.png 61 + install -m 644 higan/resource/logo/higan.png "$out"/share/pixmaps/higan-logo.png 62 + '' else '' 63 + mkdir "$out" 64 + mv higan/out/higan.app "$out"/ 65 + mv icarus/out/icarus.app "$out"/ 66 + '') + '' 67 + mkdir -p "$out"/share/higan 48 68 cp --recursive --no-dereference --preserve='links' --no-preserve='ownership' \ 49 - higan/systems/* $out/share/higan/ 69 + higan/systems/* "$out"/share/higan/ 50 70 ''; 51 71 52 - fixupPhase = '' 72 + fixupPhase = let 73 + dest = if !stdenv.isDarwin then "\\$HOME/.local/share/higan" else "\\$HOME/Library/Application Support/higan"; 74 + in '' 53 75 # A dirty workaround, suggested by @cpages: 54 76 # we create a first-run script to populate 55 77 # the local $HOME with all the auxiliary 56 78 # stuff needed by higan at runtime 57 79 80 + mkdir -p "$out"/bin 58 81 cat <<EOF > $out/bin/higan-init.sh 59 82 #!${runtimeShell} 60 83 61 - cp --recursive --update $out/share/higan/*.sys \$HOME/.local/share/higan/ 84 + cp --recursive --update $out/share/higan/*.sys "${dest}"/ 62 85 63 86 EOF 64 87
+1
pkgs/top-level/all-packages.nix
··· 25742 25742 25743 25743 higan = callPackage ../misc/emulators/higan { 25744 25744 inherit (gnome2) gtksourceview; 25745 + inherit (darwin.apple_sdk.frameworks) Carbon Cocoa OpenGL OpenAL; 25745 25746 }; 25746 25747 25747 25748 bullet = callPackage ../development/libraries/bullet {