about summary refs log tree commit diff
path: root/nixpkgs/pkgs/games/crawl/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/games/crawl/default.nix')
-rw-r--r--nixpkgs/pkgs/games/crawl/default.nix18
1 files changed, 14 insertions, 4 deletions
diff --git a/nixpkgs/pkgs/games/crawl/default.nix b/nixpkgs/pkgs/games/crawl/default.nix
index ac58a43aecb0..2179c2bff76d 100644
--- a/nixpkgs/pkgs/games/crawl/default.nix
+++ b/nixpkgs/pkgs/games/crawl/default.nix
@@ -1,6 +1,9 @@
 { stdenv, lib, fetchFromGitHub, fetchpatch, which, sqlite, lua5_1, perl, python3, zlib, pkgconfig, ncurses
 , dejavu_fonts, libpng, SDL2, SDL2_image, SDL2_mixer, libGLU_combined, freetype, pngcrush, advancecomp
 , tileMode ? false, enableSound ? tileMode
+
+# MacOS / Darwin builds
+, darwin ? null
 }:
 
 stdenv.mkDerivation rec {
@@ -15,7 +18,7 @@ stdenv.mkDerivation rec {
   };
 
   patches = [
-    ./crawl_purify.patch  # Patch hard-coded paths
+    ./crawl_purify.patch  # Patch hard-coded paths and remove force library builds
     (fetchpatch {         # Use a nice high-res app icon
       url = "https://github.com/crawl/crawl/commit/2aa1166087e44e6585b26cedf1fe81b3f3ba547f.patch";
       sha256 = "1jqrdv4wy18shg1fdabdb421232hg5micphkixcyzxd1lrmvadg0";
@@ -28,7 +31,13 @@ stdenv.mkDerivation rec {
   buildInputs = [ lua5_1 zlib sqlite ncurses ]
                 ++ (with python3.pkgs; [ pyyaml ])
                 ++ lib.optionals tileMode [ libpng SDL2 SDL2_image freetype libGLU_combined ]
-                ++ lib.optional enableSound SDL2_mixer;
+                ++ lib.optional enableSound SDL2_mixer
+                ++ (lib.optionals stdenv.isDarwin (
+                  assert (lib.assertMsg (darwin != null) "Must have darwin frameworks available for darwin builds");
+                  with darwin.apple_sdk.frameworks; [
+                    AppKit AudioUnit CoreAudio ForceFeedback Carbon IOKit OpenGL
+                   ]
+                ));
 
   preBuild = ''
     cd crawl-ref/source
@@ -40,8 +49,9 @@ stdenv.mkDerivation rec {
 
   fontsPath = lib.optionalString tileMode dejavu_fonts;
 
-  makeFlags = [ "prefix=$(out)" "FORCE_CC=cc" "FORCE_CXX=c++" "HOSTCXX=c++"
+  makeFlags = [ "prefix=${placeholder "out"}" "FORCE_CC=cc" "FORCE_CXX=c++" "HOSTCXX=c++"
                 "SAVEDIR=~/.crawl" "sqlite=${sqlite.dev}"
+                "DATADIR=${placeholder "out"}"
               ] ++ lib.optional tileMode "TILES=y"
                 ++ lib.optional enableSound "SOUND=y";
 
@@ -64,7 +74,7 @@ stdenv.mkDerivation rec {
       with dangerous and unfriendly monsters in a quest to rescue the
       mystifyingly fabulous Orb of Zot.
     '';
-    platforms = platforms.linux;
+    platforms = platforms.linux ++ platforms.darwin;
     license = with licenses; [ gpl2Plus bsd2 bsd3 mit licenses.zlib cc0 ];
     maintainers = [ maintainers.abbradar ];
   };