summary refs log tree commit diff
path: root/pkgs/games
diff options
context:
space:
mode:
authorMoritz Ulrich <moritz@tarn-vedra.de>2013-05-01 14:29:57 +0200
committerMoritz Ulrich <moritz@tarn-vedra.de>2013-10-10 01:21:55 +0200
commitb98ae36d321399d3c0163ee78fa956d5592ac201 (patch)
tree35be34020de7effe49b70aa9dbdf3c29882eee12 /pkgs/games
parent32ebe90fa1deb61be1193bc5ad4b23805d2743e6 (diff)
downloadnixlib-b98ae36d321399d3c0163ee78fa956d5592ac201.tar
nixlib-b98ae36d321399d3c0163ee78fa956d5592ac201.tar.gz
nixlib-b98ae36d321399d3c0163ee78fa956d5592ac201.tar.bz2
nixlib-b98ae36d321399d3c0163ee78fa956d5592ac201.tar.lz
nixlib-b98ae36d321399d3c0163ee78fa956d5592ac201.tar.xz
nixlib-b98ae36d321399d3c0163ee78fa956d5592ac201.tar.zst
nixlib-b98ae36d321399d3c0163ee78fa956d5592ac201.zip
dwarf-fortress: Update to 0.34.11.
Somehow Dwarf Fortress suddenly started failing to use our libpng (or
zlib). I tried all possible combinations (supplying them via
LD_LIBRARY_PATH in the script) but it just won't work.

This solution was found in the Archlinux bug tracker: It just symlinks
all problematic .png files to their .bmp counterparts. It's ugly and
*sadly* breaks tileset support (unless you convert them to bmp) but I
think it's acceptable, as the whole expression is pretty problematic
in terms of purity.

Let's hope the next release of Dwarf Fortress will be easier to
support.

(fixes #710)
Diffstat (limited to 'pkgs/games')
-rw-r--r--pkgs/games/dwarf-fortress/default.nix88
1 files changed, 49 insertions, 39 deletions
diff --git a/pkgs/games/dwarf-fortress/default.nix b/pkgs/games/dwarf-fortress/default.nix
index 24c0b40edb3c..6e53aff65a57 100644
--- a/pkgs/games/dwarf-fortress/default.nix
+++ b/pkgs/games/dwarf-fortress/default.nix
@@ -1,13 +1,14 @@
-{stdenv, fetchurl, SDL, SDL_image, SDL_ttf, gtk, glib, mesa, openal, glibc, libsndfile}:
+{ stdenv, fetchurl, SDL, SDL_image, SDL_ttf, gtk, glib, mesa, openal, glibc, libsndfile
+, copyDataDirectory ? false }:
 
 assert stdenv.system == "i686-linux";
 
 stdenv.mkDerivation rec {
-  name = "dwarf-fortress-0.31.25";
+  name = "dwarf-fortress-0.34.11";
 
   src = fetchurl {
-    url = "http://www.bay12games.com/dwarves/df_31_25_linux.tar.bz2";
-    sha256 = "0d3klvf5n99j38pdhx9mak78px65aw47smck82jb92la97drmcg3";
+    url = "http://www.bay12games.com/dwarves/df_34_11_linux.tar.bz2";
+    sha256 = "1qk9vmdxzs0li81c8bglpj3m7aw9k71x1slf58hv2bz7hdndl3kj";
   };
 
   phases = "unpackPhase patchPhase installPhase";
@@ -22,10 +23,10 @@ stdenv.mkDerivation rec {
     mkdir -p $out/share/df_linux
     cp -r * $out/share/df_linux
     cp $permission $out/share/df_linux/nix_permission
- 
+
     patchelf --set-interpreter ${glibc}/lib/ld-linux.so.2 $out/share/df_linux/libs/Dwarf_Fortress
     ln -s ${libsndfile}/lib/libsndfile.so $out/share/df_linux/libs/
-          
+
     cat > $out/bin/dwarf-fortress << EOF
     #!${stdenv.shell}
     export DF_DIR="\$HOME/.config/df_linux"
@@ -33,39 +34,48 @@ stdenv.mkDerivation rec {
      then export DF_DIR="\$XDG_DATA_HOME/df_linux"
     fi
 
-    # Recreate a directory sturctor reflecting the original distribution in the user directory
-
-    # Link in the static stuff
-    mkdir -p \$DF_DIR
-    ln -sf $out/share/df_linux/libs \$DF_DIR/
-    ln -sf $out/share/df_linux/raw \$DF_DIR/
-    ln -sf $out/share/df_linux/df \$DF_DIR/
-
-    # Delete old data directory
-    rm -rf \$DF_DIR/data
-    
-    # Link in the static data directory
-    mkdir \$DF_DIR/data
-    for i in $out/share/df_linux/data/*
-    do
-     ln -s \$i \$DF_DIR/data/
-    done
-
-    # index initial_movies, announcement, dipscript and help files are as of 0.31.16 opened in read/write mode instead of read-only mode
-    # this is a hack to work around this
-    # Should I just apply this to the whole data directory?
-    for i in index initial_movies announcement dipscript help
-    do
-     rm \$DF_DIR/data/\$i
-     cp -rf $out/share/df_linux/data/\$i \$DF_DIR/data/
-     chmod -R u+w \$DF_DIR/data/\$i
-    done
-
-    # link in persistant data
-    mkdir -p \$DF_DIR/save
-    ln -s \$DF_DIR/save \$DF_DIR/data/
-
-    # now run Dwarf Fortress! 
+    # Recreate a directory structure reflecting the original
+    # distribution in the user directory (for modding support)
+    ${if copyDataDirectory then ''
+      if [ ! -d "\$DF_DIR" ];
+      then
+        mkdir -p \$DF_DIR
+        cp -r $out/share/df_linux/* \$DF_DIR/
+        chmod -R u+rw \$DF_DIR/
+      fi
+    '' else ''
+      # Link in the static stuff
+      mkdir -p \$DF_DIR
+      ln -sf $out/share/df_linux/libs \$DF_DIR/
+      ln -sf $out/share/df_linux/raw \$DF_DIR/
+      ln -sf $out/share/df_linux/df \$DF_DIR/
+
+      # Delete old data directory
+      rm -rf \$DF_DIR/data
+
+      # Link in the static data directory
+      mkdir \$DF_DIR/data
+      for i in $out/share/df_linux/data/*
+      do
+       ln -s \$i \$DF_DIR/data/
+      done
+
+      # index initial_movies, announcement, dipscript and help files are as of 0.31.16 opened in read/write mode instead of read-only mode
+      # this is a hack to work around this
+      # Should I just apply this to the whole data directory?
+      for i in index initial_movies announcement dipscript help
+      do
+       rm \$DF_DIR/data/\$i
+       cp -rf $out/share/df_linux/data/\$i \$DF_DIR/data/
+       chmod -R u+w \$DF_DIR/data/\$i
+      done
+
+      # link in persistant data
+      mkdir -p \$DF_DIR/save
+      ln -s \$DF_DIR/save \$DF_DIR/data/
+    ''}
+
+    # now run Dwarf Fortress!
     export LD_LIBRARY_PATH=\$DF_DIR/df_linux/libs/:${SDL}/lib:${SDL_image}/lib/:${SDL_ttf}/lib/:${gtk}/lib/:${glib}/lib/:${mesa}/lib/:${openal}/lib/
     \$DF_DIR/df "\$@"
     EOF