dosbox-x: Get Darwin icon working

OPNA2608 adbdc602 2d295d75

+32
+32
pkgs/applications/emulators/dosbox-x/default.nix
··· 10 10 , fluidsynth 11 11 , freetype 12 12 , glib 13 + , libicns 13 14 , libpcap 14 15 , libpng 15 16 , libslirp ··· 18 19 , makeWrapper 19 20 , ncurses 20 21 , pkg-config 22 + , python3 21 23 , SDL2 22 24 , SDL2_net 23 25 , testers ··· 35 37 rev = "dosbox-x-v${finalAttrs.version}"; 36 38 hash = "sha256-EcAp7KyqXdBACEbPgkM1INoKeGVo7hMDUx97y2RcX+k="; 37 39 }; 40 + 41 + # sips is unavailable in sandbox, replacing with imagemagick breaks build due to wrong Foundation propagation(?) so don't generate resolution variants 42 + # iconutil is unavailable, replace with png2icns from libicns 43 + # Patch bad hardcoded compiler 44 + # Don't mess with codesign, doesn't seem to work? 45 + postPatch = '' 46 + substituteInPlace Makefile.am \ 47 + --replace-fail 'sips' '## sips' \ 48 + --replace-fail 'iconutil -c icns -o contrib/macos/dosbox.icns src/dosbox.iconset' 'png2icns contrib/macos/dosbox.icns contrib/macos/dosbox-x.png' \ 49 + --replace-fail 'g++' "$CXX" \ 50 + --replace-fail 'codesign' '## codesign' 51 + '' + lib.optionalString stdenv.hostPlatform.isDarwin '' 52 + patchShebangs appbundledeps.py 53 + ''; 38 54 39 55 strictDeps = true; 40 56 ··· 42 58 autoreconfHook 43 59 makeWrapper 44 60 pkg-config 61 + ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ 62 + libicns 63 + python3 45 64 ]; 46 65 47 66 buildInputs = [ ··· 75 94 76 95 hardeningDisable = [ "format" ]; # https://github.com/joncampbell123/dosbox-x/issues/4436 77 96 97 + # Build optional App Bundle target, which needs at least one arch-suffixed binary 98 + postBuild = lib.optionalString stdenv.hostPlatform.isDarwin '' 99 + cp src/dosbox-x src/dosbox-x-$(uname -m) 100 + make dosbox-x.app 101 + ''; 102 + 78 103 postInstall = lib.optionalString stdenv.hostPlatform.isLinux '' 79 104 wrapProgram $out/bin/dosbox-x \ 80 105 --prefix PATH : ${lib.makeBinPath [ yad ]} 106 + '' 107 + # Install App Bundle, wrap regular binary into bundle's binary to get the icon working 108 + + lib.optionalString stdenv.hostPlatform.isDarwin '' 109 + mkdir $out/Applications 110 + mv dosbox-x.app $out/Applications/ 111 + mv $out/bin/dosbox-x $out/Applications/dosbox-x.app/Contents/MacOS/dosbox-x 112 + makeWrapper $out/Applications/dosbox-x.app/Contents/MacOS/dosbox-x $out/bin/dosbox-x 81 113 ''; 82 114 83 115 passthru.tests.version = testers.testVersion {