about summary refs log tree commit diff
path: root/pkgs/games/dwarf-fortress
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/games/dwarf-fortress')
-rw-r--r--pkgs/games/dwarf-fortress/default.nix12
-rw-r--r--pkgs/games/dwarf-fortress/dfhack/default.nix5
-rw-r--r--pkgs/games/dwarf-fortress/dwarf-therapist/default.nix11
-rw-r--r--pkgs/games/dwarf-fortress/game.json3
-rw-r--r--pkgs/games/dwarf-fortress/game.nix23
-rw-r--r--pkgs/games/dwarf-fortress/lazy-pack.nix4
-rw-r--r--pkgs/games/dwarf-fortress/legends-browser/default.nix2
-rw-r--r--pkgs/games/dwarf-fortress/themes/default.nix2
-rw-r--r--pkgs/games/dwarf-fortress/twbt/default.nix2
-rw-r--r--pkgs/games/dwarf-fortress/wrapper/default.nix4
-rw-r--r--pkgs/games/dwarf-fortress/wrapper/dwarf-fortress-init.in49
11 files changed, 72 insertions, 45 deletions
diff --git a/pkgs/games/dwarf-fortress/default.nix b/pkgs/games/dwarf-fortress/default.nix
index ee02364a40a4a..72ca14578baed 100644
--- a/pkgs/games/dwarf-fortress/default.nix
+++ b/pkgs/games/dwarf-fortress/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, stdenvNoCC, gccStdenv, lib, recurseIntoAttrs, libsForQt5, newScope, texliveBasic, perlPackages, jdk8, jre8 }:
+{ stdenv, stdenvNoCC, gccStdenv, lib, recurseIntoAttrs, libsForQt5, newScope, perlPackages, jdk8, jre8 }:
 
 # To whomever it may concern:
 #
@@ -49,7 +49,9 @@ let
   # The latest Dwarf Fortress version. Maintainers: when a new version comes
   # out, ensure that (unfuck|dfhack|twbt) are all up to date before changing
   # this. Note that unfuck and twbt are not required for 50.
-  latestVersion = "50.12";
+  latestVersion = if stdenv.hostPlatform.isLinux then "50.13"
+                  else if stdenv.hostPlatform.isDarwin then "0.47.05"
+                  else throw "Unsupported system";
 
   # Converts a version to a package name.
   versionToName = version: "dwarf-fortress_${replaceStrings ["."] ["_"] version}";
@@ -62,7 +64,7 @@ let
         let
           isAtLeast50 = versionAtLeast dfVersion "50.0";
 
-          dwarf-fortress-unfuck = optionalAttrs (!isAtLeast50) (callPackage ./unfuck.nix { inherit dfVersion; });
+          dwarf-fortress-unfuck = optionalAttrs (!isAtLeast50 && stdenv.hostPlatform.isLinux) (callPackage ./unfuck.nix { inherit dfVersion; });
 
           dwarf-fortress = callPackage ./game.nix {
             inherit dfVersion;
@@ -79,9 +81,7 @@ let
 
           dwarf-therapist = libsForQt5.callPackage ./dwarf-therapist/wrapper.nix {
             inherit dwarf-fortress;
-            dwarf-therapist = (libsForQt5.callPackage ./dwarf-therapist {
-              texlive = texliveBasic.withPackages (ps: with ps; [ float caption wrapfig adjmulticol sidecap preprint enumitem ]);
-            }).override (optionalAttrs (!isAtLeast50) {
+            dwarf-therapist = (libsForQt5.callPackage ./dwarf-therapist {}).override (optionalAttrs (!isAtLeast50) {
               # 41.2.5 is the last version to support Dwarf Fortress 0.47.
               version = "41.2.5";
               hash = "sha256-xfYBtnO1n6OcliVt07GsQ9alDJIfWdVhtuyWwuvXSZs=";
diff --git a/pkgs/games/dwarf-fortress/dfhack/default.nix b/pkgs/games/dwarf-fortress/dfhack/default.nix
index 156dac32c472b..cb0e1e529637a 100644
--- a/pkgs/games/dwarf-fortress/dfhack/default.nix
+++ b/pkgs/games/dwarf-fortress/dfhack/default.nix
@@ -89,6 +89,11 @@ let
       hash = "sha256-2mO8DpNmZRCV7IRY0arf3SMvlO4Pxs61Kxfh3q3k3HU=";
       xmlRev = "980b1af13acc31660dce632f913c968f52e2b275";
     };
+    "50.13" = {
+      dfHackRelease = "50.13-r3";
+      hash = "sha256-WbkJ8HmLT5GdZgDmcuFh+1uzhloKM9um0b9YO//uR7Y=";
+      xmlRev = "f0530a22149606596e97e3e17d941df3aafe29b9";
+    };
   };
 
   release =
diff --git a/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix b/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix
index d51c8274bb066..1c3e05e92368d 100644
--- a/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix
+++ b/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix
@@ -4,10 +4,9 @@
 , qtbase
 , qtdeclarative
 , cmake
-, texlive
 , ninja
-, version ? "42.1.5"
-, hash ? "sha256-aUakfUjnIZWNDhCkG3A6u7BaaCG8kPMV/Fu2S73CoDg="
+, version ? "42.1.6"
+, hash ? "sha256-VjCXT4sl3HsFILrqTc3JJSeRedZaOXUbf4KvSzTo0uc="
 }:
 
 stdenv.mkDerivation rec {
@@ -22,7 +21,7 @@ stdenv.mkDerivation rec {
     inherit hash;
   };
 
-  nativeBuildInputs = [ texlive cmake ninja ];
+  nativeBuildInputs = [ cmake ninja ];
   buildInputs = [ qtbase qtdeclarative ];
 
   enableParallelBuilding = true;
@@ -30,7 +29,7 @@ stdenv.mkDerivation rec {
   cmakeFlags = [ "-GNinja" ];
 
   installPhase =
-    if stdenv.isDarwin then ''
+    if stdenv.hostPlatform.isDarwin then ''
       mkdir -p $out/Applications
       cp -r DwarfTherapist.app $out/Applications
     '' else null;
@@ -40,7 +39,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     mainProgram = "dwarftherapist";
     description = "Tool to manage dwarves in a running game of Dwarf Fortress";
-    maintainers = with maintainers; [ abbradar bendlas numinit jonringer ];
+    maintainers = with maintainers; [ abbradar bendlas numinit ];
     license = licenses.mit;
     platforms = platforms.x86;
     homepage = "https://github.com/Dwarf-Therapist/Dwarf-Therapist";
diff --git a/pkgs/games/dwarf-fortress/game.json b/pkgs/games/dwarf-fortress/game.json
index c287a4dd84490..4fb341c350e99 100644
--- a/pkgs/games/dwarf-fortress/game.json
+++ b/pkgs/games/dwarf-fortress/game.json
@@ -144,5 +144,8 @@
   },
   "50.12": {
     "linux": "070014fzwszfgjyxjyij0k0hadah6s62lpi91ykp3vs220azya1m"
+  },
+  "50.13": {
+    "linux": "19wzgsdgv0vq7v2dxhypr9hayky3nm3lbra1kk9vn8ri96jdkfkw"
   }
 }
diff --git a/pkgs/games/dwarf-fortress/game.nix b/pkgs/games/dwarf-fortress/game.nix
index 9cf7847d14893..02dfd89f636d1 100644
--- a/pkgs/games/dwarf-fortress/game.nix
+++ b/pkgs/games/dwarf-fortress/game.nix
@@ -53,7 +53,7 @@ let
   patchVersion = elemAt dfVersionTuple (dfVersionBaseIndex + 1);
 
   isAtLeast50 = baseVersion >= 50;
-  enableUnfuck = !isAtLeast50 && dwarf-fortress-unfuck != null;
+  enableUnfuck = !isAtLeast50 && dwarf-fortress-unfuck != null && (dwarf-fortress-unfuck.dfVersion or null) == dfVersion;
 
   game =
     if hasAttr dfVersion df-hashes
@@ -67,7 +67,7 @@ let
     if hasAttr dfPlatform game
     then getAttr dfPlatform game
     else throw "Unsupported dfPlatform: ${dfPlatform}";
-  exe = if stdenv.isLinux then
+  exe = if stdenv.hostPlatform.isLinux then
     if baseVersion >= 50 then "dwarfort" else "libs/Dwarf_Fortress"
   else
     "dwarfort.exe";
@@ -84,10 +84,10 @@ stdenv.mkDerivation {
 
   sourceRoot = ".";
 
-  postUnpack = optionalString stdenv.isLinux ''
+  postUnpack = ''
     directory=${
-      if stdenv.isLinux then "df_linux"
-      else if stdenv.isDarwin then "df_osx"
+      if stdenv.hostPlatform.isLinux then "df_linux"
+      else if stdenv.hostPlatform.isDarwin then "df_osx"
       else throw "Unsupported system"
     }
     if [ -d "$directory" ]; then
@@ -95,7 +95,7 @@ stdenv.mkDerivation {
     fi
   '';
 
-  nativeBuildInputs = [ autoPatchelfHook ];
+  nativeBuildInputs = optional stdenv.hostPlatform.isLinux autoPatchelfHook;
   buildInputs = optionals isAtLeast50 [ SDL2 SDL2_image SDL2_mixer ]
     ++ optional (!isAtLeast50) SDL
     ++ optional enableUnfuck dwarf-fortress-unfuck
@@ -108,6 +108,9 @@ stdenv.mkDerivation {
     mkdir -p $out
     cp -r * $out
 
+    # Clean up OS X detritus in the tarball.
+    find $out -type f -name '._*' -exec rm -rf {} \;
+
     # Lots of files are +x in the newer releases...
     find $out -type d -exec chmod 0755 {} \;
     find $out -type f -exec chmod 0644 {} \;
@@ -116,12 +119,12 @@ stdenv.mkDerivation {
     [ -f $out/run_df ] && chmod +x $out/run_df
 
     # We don't need any of these since they will just break autoPatchelf on <version 50.
-    [ -d $out/libs ] && rm -f $out/libs/*.so $out/libs/*.so.*
+    [ -d $out/libs ] && rm -rf $out/libs/*.so $out/libs/*.so.* $out/libs/*.dylib
 
     # Store the original hash
     md5sum $exe | awk '{ print $1 }' > $out/hash.md5.orig
     echo "Original MD5: $(<$out/hash.md5.orig)" >&2
-  '' + optionalString stdenv.isDarwin ''
+  '' + optionalString stdenv.hostPlatform.isDarwin ''
     # My custom unfucked dwarfort.exe for macOS. Can't use
     # absolute paths because original doesn't have enough
     # header space. Someone plz break into Tarn's house & put
@@ -129,6 +132,7 @@ stdenv.mkDerivation {
 
     ln -s ${getLib ncurses}/lib/libncurses.dylib $out/libs
     ln -s ${getLib gcc.cc}/lib/libstdc++.6.dylib $out/libs
+    ln -s ${getLib gcc.cc}/lib/libgcc_s.1.dylib $out/libs
     ln -s ${getLib fmodex}/lib/libfmodex.dylib $out/libs
 
     install_name_tool \
@@ -138,7 +142,6 @@ stdenv.mkDerivation {
               @executable_path/libs/libstdc++.6.dylib \
       $exe
   '' + ''
-    ls -al $out
     runHook postInstall
   '';
 
@@ -160,7 +163,7 @@ stdenv.mkDerivation {
   };
 
   meta = {
-    description = "A single-player fantasy game with a randomly generated adventure world";
+    description = "Single-player fantasy game with a randomly generated adventure world";
     homepage = "https://www.bay12games.com/dwarves/";
     license = licenses.unfreeRedistributable;
     platforms = attrNames platforms;
diff --git a/pkgs/games/dwarf-fortress/lazy-pack.nix b/pkgs/games/dwarf-fortress/lazy-pack.nix
index d472924845618..eef830965eb4e 100644
--- a/pkgs/games/dwarf-fortress/lazy-pack.nix
+++ b/pkgs/games/dwarf-fortress/lazy-pack.nix
@@ -9,7 +9,7 @@
   # This package should, at any given time, provide an opinionated "optimal"
   # DF experience. It's the equivalent of the Lazy Newbie Pack, that is, and
   # should contain every utility available unless you disable them.
-, enableDFHack ? stdenvNoCC.isLinux
+, enableDFHack ? stdenvNoCC.hostPlatform.isLinux
 , enableTWBT ? enableDFHack
 , enableSoundSense ? true
 , enableStoneSense ? true
@@ -57,7 +57,7 @@ buildEnv {
 
   meta = {
     inherit mainProgram;
-    description = "An opinionated wrapper for Dwarf Fortress";
+    description = "Opinionated wrapper for Dwarf Fortress";
     maintainers = with maintainers; [ Baughn numinit ];
     license = licenses.mit;
     platforms = platforms.all;
diff --git a/pkgs/games/dwarf-fortress/legends-browser/default.nix b/pkgs/games/dwarf-fortress/legends-browser/default.nix
index 3484db0cc8ff5..3920c1f4693e9 100644
--- a/pkgs/games/dwarf-fortress/legends-browser/default.nix
+++ b/pkgs/games/dwarf-fortress/legends-browser/default.nix
@@ -27,7 +27,7 @@ buildEnv {
   paths = [ script ];
 
   meta = with lib; {
-    description = "A multi-platform, open source, java-based legends viewer for dwarf fortress";
+    description = "Multi-platform, open source, java-based legends viewer for dwarf fortress";
     maintainers = with maintainers; [ Baughn ];
     sourceProvenance = with sourceTypes; [ binaryBytecode ];
     license = licenses.mit;
diff --git a/pkgs/games/dwarf-fortress/themes/default.nix b/pkgs/games/dwarf-fortress/themes/default.nix
index ad033b043a46b..279c816211ee1 100644
--- a/pkgs/games/dwarf-fortress/themes/default.nix
+++ b/pkgs/games/dwarf-fortress/themes/default.nix
@@ -23,7 +23,7 @@ listToAttrs (map
       meta = {
         platforms = platforms.all;
         maintainers = [ maintainers.matthewbauer maintainers.shazow ];
-        license = licenses.free;
+        license = licenses.unfree;
       };
     };
   })
diff --git a/pkgs/games/dwarf-fortress/twbt/default.nix b/pkgs/games/dwarf-fortress/twbt/default.nix
index 0ccb859b5be32..82b03dd1e0d72 100644
--- a/pkgs/games/dwarf-fortress/twbt/default.nix
+++ b/pkgs/games/dwarf-fortress/twbt/default.nix
@@ -86,7 +86,7 @@ stdenvNoCC.mkDerivation rec {
   };
 
   meta = {
-    description = "A plugin for Dwarf Fortress / DFHack that improves various aspects of the game interface";
+    description = "Plugin for Dwarf Fortress / DFHack that improves various aspects of the game interface";
     maintainers = with maintainers; [ Baughn numinit ];
     license = licenses.mit;
     platforms = platforms.linux;
diff --git a/pkgs/games/dwarf-fortress/wrapper/default.nix b/pkgs/games/dwarf-fortress/wrapper/default.nix
index 2dd771ee922db..268a5c1f5da53 100644
--- a/pkgs/games/dwarf-fortress/wrapper/default.nix
+++ b/pkgs/games/dwarf-fortress/wrapper/default.nix
@@ -197,8 +197,8 @@ stdenv.mkDerivation rec {
     chmod 755 $out/bin/soundsense
   '';
 
-  doInstallCheck = true;
-  nativeInstallCheckInputs = [ expect xvfb-run ];
+  doInstallCheck = stdenv.hostPlatform.isLinux;
+  nativeInstallCheckInputs = lib.optionals stdenv.hostPlatform.isLinux [ expect xvfb-run ];
 
   installCheckPhase = let
     commonExpectStatements = fmod: lib.optionalString isAtLeast50 ''
diff --git a/pkgs/games/dwarf-fortress/wrapper/dwarf-fortress-init.in b/pkgs/games/dwarf-fortress/wrapper/dwarf-fortress-init.in
index 61b1b4da61682..1c739a1afbbf0 100644
--- a/pkgs/games/dwarf-fortress/wrapper/dwarf-fortress-init.in
+++ b/pkgs/games/dwarf-fortress/wrapper/dwarf-fortress-init.in
@@ -4,18 +4,6 @@ shopt -s extglob
 
 export NIXPKGS_DF_ENV="@env@"
 
-if [[ -v DF_DIR ]] && [ -n "$DF_DIR" ] && { [[ ! -v NIXPKGS_DF_HOME ]] || [ -z "$NIXPKGS_DF_HOME" ]; }; then
-  # Compatibility for users that were using DF_DIR, since the dfhack script clobbers this variable.
-  export NIXPKGS_DF_HOME="$DF_DIR"
-fi
-
-if [[ ! -v NIXPKGS_DF_HOME ]] || [ -z "$NIXPKGS_DF_HOME" ]; then
-  export NIXPKGS_DF_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/df_linux"
-fi
-
-# Compatibility.
-export DF_DIR="$NIXPKGS_DF_HOME"
-
 ### BEGIN: Default DF options
 declare -A _NIXPKGS_DF_OPTS
 _NIXPKGS_DF_OPTS[fmod]=0    # Don't use fmod by default.
@@ -131,6 +119,30 @@ go() {
   exit 1
 }
 
+os_name="$(@uname@)"
+os_rev="$(@uname@ -r)"
+
+if [ "$os_name" == Linux ]; then
+  df_dir="df_linux"
+elif [ "$os_name" == Darwin ]; then
+  df_dir="df_osx"
+else
+  log "Unknown platform: $os_name"
+  exit 1
+fi
+
+if [[ -v DF_DIR ]] && [ -n "$DF_DIR" ] && { [[ ! -v NIXPKGS_DF_HOME ]] || [ -z "$NIXPKGS_DF_HOME" ]; }; then
+  # Compatibility for users that were using DF_DIR, since the dfhack script clobbers this variable.
+  export NIXPKGS_DF_HOME="$DF_DIR"
+fi
+
+if [[ ! -v NIXPKGS_DF_HOME ]] || [ -z "$NIXPKGS_DF_HOME" ]; then
+  export NIXPKGS_DF_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/$df_dir"
+fi
+
+# Compatibility.
+export DF_DIR="$NIXPKGS_DF_HOME"
+
 @mkdir@ -p "$NIXPKGS_DF_HOME"
 
 @cat@ <<EOF >&2
@@ -156,7 +168,7 @@ EOF
 cd "$NIXPKGS_DF_ENV"
 
 # All potential important files in DF 50 and below.
-for path in dwarfort *.so libs raw data/init/* data/!(init|index|announcement); do
+for path in dwarfort dwarfort.exe df *.so libs raw data/init/* data/!(init|index|announcement); do
   force_delete=0
   if [[ "$path" == libfmod*.so* ]] && [ "${_NIXPKGS_DF_OPTS[fmod]}" -eq 0 ]; then
     force_delete=1
@@ -175,7 +187,12 @@ for path in index announcement help dipscript; do
 done
 
 # Handle library paths on Darwin.
-if [ "$(@uname@)" == Darwin ]; then
-  export DYLD_LIBRARY_PATH="$NIXPKGS_DF_ENV/libs"
-  export DYLD_FRAMEWORK_PATH="$NIXPKGS_DF_ENV/libs"
+if [ "$os_name" == Darwin ]; then
+  if [ "${os_rev%%.*}" -ge 11 ]; then
+    export DYLD_LIBRARY_PATH="$NIXPKGS_DF_ENV/libs"
+    export DYLD_FRAMEWORK_PATH="$NIXPKGS_DF_ENV/libs"
+  else
+    export DYLD_FALLBACK_LIBRARY_PATH="$NIXPKGS_DF_ENV/libs"
+    export DYLD_FALLBACK_FRAMEWORK_PATH="$NIXPKGS_DF_ENV/libs"
+  fi
 fi