summary refs log tree commit diff
path: root/pkgs/games
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2021-09-12 15:58:08 +0200
committerGitHub <noreply@github.com>2021-09-12 15:58:08 +0200
commit4a56ed7a78f7332756d82c47fe4d06652b8a0436 (patch)
tree6649286e6ac053de90619507e9fa84b82e554ad3 /pkgs/games
parentac63fe7c33a5ad503f4febf2f2011829102e6bbf (diff)
parentacdec49e965b9556bcb89e0ce3fec844a2cff469 (diff)
downloadnixpkgs-4a56ed7a78f7332756d82c47fe4d06652b8a0436.tar
nixpkgs-4a56ed7a78f7332756d82c47fe4d06652b8a0436.tar.gz
nixpkgs-4a56ed7a78f7332756d82c47fe4d06652b8a0436.tar.bz2
nixpkgs-4a56ed7a78f7332756d82c47fe4d06652b8a0436.tar.lz
nixpkgs-4a56ed7a78f7332756d82c47fe4d06652b8a0436.tar.xz
nixpkgs-4a56ed7a78f7332756d82c47fe4d06652b8a0436.tar.zst
nixpkgs-4a56ed7a78f7332756d82c47fe4d06652b8a0436.zip
Merge pull request #137447 from mikroskeem/eduke32-macos
Diffstat (limited to 'pkgs/games')
-rw-r--r--pkgs/games/eduke32/default.nix51
1 files changed, 40 insertions, 11 deletions
diff --git a/pkgs/games/eduke32/default.nix b/pkgs/games/eduke32/default.nix
index 8c7a79ff982..c3492234961 100644
--- a/pkgs/games/eduke32/default.nix
+++ b/pkgs/games/eduke32/default.nix
@@ -1,6 +1,8 @@
 { lib, stdenv, fetchurl, makeWrapper, pkg-config, nasm, makeDesktopItem
 , alsa-lib, flac, gtk2, libvorbis, libvpx, libGLU, libGL
-, SDL2, SDL2_mixer }:
+, SDL2, SDL2_mixer
+, AGL, Cocoa, GLUT, OpenGL
+}:
 
 let
   desktopItem = makeDesktopItem {
@@ -16,21 +18,37 @@ let
 
 in stdenv.mkDerivation rec {
   pname = "eduke32";
-  version = "20210722";
-  rev = "9484";
-  revExtra = "f3fea8c15";
+  version = "20210910";
+  rev = "9603";
+  revExtra = "6c289cce4";
 
   src = fetchurl {
-    url = "http://dukeworld.duke4.net/eduke32/synthesis/${version}-${rev}-${revExtra}/eduke32_src_${version}-${rev}-${revExtra}.tar.xz";
-    sha256 = "0fdl2i465cl5x7129772ksx97lvim98m9009q5cfmf6scagj9pvz";
+    url = "https://dukeworld.com/eduke32/synthesis/${version}-${rev}-${revExtra}/eduke32_src_${version}-${rev}-${revExtra}.tar.xz";
+    sha256 = "sha256-/NQMsmT9z2N3KWBrP8hlGngQKJUgSP+vrNoFqJscRCk=";
   };
 
-  buildInputs = [ alsa-lib flac gtk2 libvorbis libvpx libGL libGLU SDL2 SDL2_mixer ];
+  buildInputs = [
+    flac
+    libvorbis
+    libvpx
+    SDL2
+    SDL2_mixer
+  ] ++ lib.optionals stdenv.isLinux [
+    alsa-lib
+    gtk2
+    libGL
+    libGLU
+  ] ++ lib.optionals stdenv.isDarwin [
+    AGL
+    Cocoa
+    GLUT
+    OpenGL
+  ];
 
   nativeBuildInputs = [ makeWrapper pkg-config ]
     ++ lib.optional (stdenv.hostPlatform.system == "i686-linux") nasm;
 
-  postPatch = ''
+  postPatch = lib.optionalString stdenv.isLinux ''
     substituteInPlace source/build/src/glbuild.cpp \
       --replace libGLU.so ${libGLU}/lib/libGLU.so
 
@@ -44,6 +62,9 @@ in stdenv.mkDerivation rec {
 
   makeFlags = [
     "SDLCONFIG=${SDL2}/bin/sdl2-config"
+  ] ++ lib.optionals stdenv.isDarwin [
+    # broken, see: https://github.com/NixOS/nixpkgs/issues/19098
+    "LTO=0"
   ];
 
   enableParallelBuilding = true;
@@ -52,7 +73,7 @@ in stdenv.mkDerivation rec {
     runHook preInstall
 
     install -Dm755 -t $out/bin eduke32 mapster32
-
+  '' + lib.optionalString stdenv.isLinux ''
     makeWrapper $out/bin/eduke32 $out/bin/${wrapper} \
       --set-default EDUKE32_DATA_DIR /var/lib/games/eduke32 \
       --add-flags '-g "$EDUKE32_DATA_DIR/DUKE3D.GRP"'
@@ -60,7 +81,16 @@ in stdenv.mkDerivation rec {
     cp -rv ${desktopItem}/share $out
     substituteInPlace $out/share/applications/eduke32.desktop \
       --subst-var out
+  '' + lib.optionalString stdenv.isDarwin ''
+    mkdir -p $out/Applications/EDuke32.app/Contents/MacOS
+    mkdir -p $out/Applications/Mapster32.app/Contents/MacOS
+
+    cp -r platform/Apple/bundles/EDuke32.app/* $out/Applications/EDuke32.app/
+    cp -r platform/Apple/bundles/Mapster32.app/* $out/Applications/Mapster32.app/
 
+    ln -sf $out/bin/eduke32 $out/Applications/EDuke32.app/Contents/MacOS/eduke32
+    ln -sf $out/bin/mapster32 $out/Applications/Mapster32.app/Contents/MacOS/mapster32
+  '' + ''
     runHook postInstall
   '';
 
@@ -68,8 +98,7 @@ in stdenv.mkDerivation rec {
     description = "Enhanched port of Duke Nukem 3D for various platforms";
     homepage = "http://eduke32.com";
     license = licenses.gpl2Plus;
-    maintainers = with maintainers; [ sander ];
-    # Darwin is untested (supported by upstream)
+    maintainers = with maintainers; [ mikroskeem sander ];
     platforms = platforms.all;
   };
 }