diff options
author | OPNA2608 <opna2608@protonmail.com> | 2024-04-09 16:41:10 +0200 |
---|---|---|
committer | OPNA2608 <opna2608@protonmail.com> | 2024-04-09 16:41:10 +0200 |
commit | adbdc6020070af3846e7365d00a1ee5e4b8659e7 (patch) | |
tree | 84b98166b43b940a785e57de554e825344afb95b /pkgs/applications/emulators/dosbox-x | |
parent | 2d295d752ee3cb9704681b1c912f56baa2b1ba0f (diff) |
dosbox-x: Get Darwin icon working
Diffstat (limited to 'pkgs/applications/emulators/dosbox-x')
-rw-r--r-- | pkgs/applications/emulators/dosbox-x/default.nix | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/pkgs/applications/emulators/dosbox-x/default.nix b/pkgs/applications/emulators/dosbox-x/default.nix index c499c69e54421..7ec2b8df3b715 100644 --- a/pkgs/applications/emulators/dosbox-x/default.nix +++ b/pkgs/applications/emulators/dosbox-x/default.nix @@ -10,6 +10,7 @@ , fluidsynth , freetype , glib +, libicns , libpcap , libpng , libslirp @@ -18,6 +19,7 @@ , makeWrapper , ncurses , pkg-config +, python3 , SDL2 , SDL2_net , testers @@ -36,12 +38,29 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-EcAp7KyqXdBACEbPgkM1INoKeGVo7hMDUx97y2RcX+k="; }; + # sips is unavailable in sandbox, replacing with imagemagick breaks build due to wrong Foundation propagation(?) so don't generate resolution variants + # iconutil is unavailable, replace with png2icns from libicns + # Patch bad hardcoded compiler + # Don't mess with codesign, doesn't seem to work? + postPatch = '' + substituteInPlace Makefile.am \ + --replace-fail 'sips' '## sips' \ + --replace-fail 'iconutil -c icns -o contrib/macos/dosbox.icns src/dosbox.iconset' 'png2icns contrib/macos/dosbox.icns contrib/macos/dosbox-x.png' \ + --replace-fail 'g++' "$CXX" \ + --replace-fail 'codesign' '## codesign' + '' + lib.optionalString stdenv.hostPlatform.isDarwin '' + patchShebangs appbundledeps.py + ''; + strictDeps = true; nativeBuildInputs = [ autoreconfHook makeWrapper pkg-config + ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ + libicns + python3 ]; buildInputs = [ @@ -75,9 +94,22 @@ stdenv.mkDerivation (finalAttrs: { hardeningDisable = [ "format" ]; # https://github.com/joncampbell123/dosbox-x/issues/4436 + # Build optional App Bundle target, which needs at least one arch-suffixed binary + postBuild = lib.optionalString stdenv.hostPlatform.isDarwin '' + cp src/dosbox-x src/dosbox-x-$(uname -m) + make dosbox-x.app + ''; + postInstall = lib.optionalString stdenv.hostPlatform.isLinux '' wrapProgram $out/bin/dosbox-x \ --prefix PATH : ${lib.makeBinPath [ yad ]} + '' + # Install App Bundle, wrap regular binary into bundle's binary to get the icon working + + lib.optionalString stdenv.hostPlatform.isDarwin '' + mkdir $out/Applications + mv dosbox-x.app $out/Applications/ + mv $out/bin/dosbox-x $out/Applications/dosbox-x.app/Contents/MacOS/dosbox-x + makeWrapper $out/Applications/dosbox-x.app/Contents/MacOS/dosbox-x $out/bin/dosbox-x ''; passthru.tests.version = testers.testVersion { |