git.iko.soy/typeable/nixpkgs
on master help sign in
dwarf-{fortress,therapist}: Update

DwarfTherapist does some ugly stuff by matching the first 8 characters of the md5sum of the game binary to match its binary content. This patch adds support to automatically patch the ini files.

commit54f3587549182141bb2067871702c71258d12098 authorMoritz Ulrich <moritz@tarn-vedra.de> dateMon 15 Dec 2014, 22:13 (12 years ago) parent997531d
2 files changed+28−29
pkgs/games/dwarf-fortress/default.nix+12−4 pkgs/games/dwarf-therapist/default.nix+16−25
pkgs/games/dwarf-fortress/default.nix+12−4
@@ -4,17 +4,17 @@
44
55let
66 baseVersion = "40";
7− patchVersion = "18";
7+ patchVersion = "19";
88 srcs = {
99 df_unfuck = fetchgit {
1010 url = "https://github.com/svenstaro/dwarf_fortress_unfuck";
11− rev = "f7ef8d4fa92bcbbf8e4790056c6c3668e3c3b20b";
12− sha256 = "0kpb3gzjllvi1lahhi74cp2ny1dl7kvnhdlca7i2yxkmyzaaj9qy";
11+ rev = "dadf3d48e93a2800db5d4f98d775ba8453ca55a4";
12+ sha256 = "011pbcfc3a0mnwqg3pkhngnb1h7z1jbx4qbvj03blpzfjia075sv";
1313 };
1414
1515 df = fetchurl {
1616 url = "http://www.bay12games.com/dwarves/df_${baseVersion}_${patchVersion}_linux.tar.bz2";
17− sha256 = "0l29dn24xhkyj8fvmz8318i5sz2wpl420mwy1ccpdd3yfd3hrjmb";
17+ sha256 = "16xb6py7l1hf9hc7gn50nwajqgmv01zdhbkh7g6a8gnx7wlhl2p9";
1818 };
1919 };
2020
@@ -25,6 +25,7 @@ assert stdenv.system == "i686-linux";
2525stdenv.mkDerivation rec {
2626 name = "dwarf-fortress-0.${baseVersion}.${patchVersion}";
2727
28+ inherit baseVersion patchVersion;
2829
2930 buildInputs = [ SDL SDL_image SDL_ttf gtk2 glib glew mesa ncurses openal glibc libsndfile pango atk cmake gdk_pixbuf];
3031 src = "${srcs.df_unfuck} ${srcs.df}";
@@ -46,6 +47,10 @@ stdenv.mkDerivation rec {
4647 cd ../../
4748 cp -r ./df_linux/* $out/share/df_linux
4849 rm $out/share/df_linux/libs/lib*
50+
51+ # Store the original hash for dwarf-therapist
52+ echo $(md5sum $out/share/df_linux/libs/Dwarf_Fortress | cut -c1-8) > $out/share/df_linux/hash.md5.orig
53+ # Fix rpath
4954 patchelf --set-rpath "${stdenv.lib.makeLibraryPath [ stdenv.gcc.gcc stdenv.glibc ]}:$out/share/df_linux/libs" $out/share/df_linux/libs/Dwarf_Fortress
5055 cp -f ./git-export/build/libgraphics.so $out/share/df_linux/libs/libgraphics.so
5156
@@ -53,6 +58,9 @@ stdenv.mkDerivation rec {
5358
5459 patchelf --set-interpreter ${glibc}/lib/ld-linux.so.2 $out/share/df_linux/libs/Dwarf_Fortress
5560
61+ # Store new hash for dwarf-therapist
62+ echo $(md5sum $out/share/df_linux/libs/Dwarf_Fortress | cut -c1-8) > $out/share/df_linux/hash.md5.patched
63+
5664 cat > $out/bin/dwarf-fortress << EOF
5765 #!${stdenv.shell}
5866
pkgs/games/dwarf-therapist/default.nix+16−25
@@ -1,39 +1,30 @@
1−{ stdenv, coreutils, fetchhg, qt4, dwarf_fortress, bash, makeWrapper }:
1+{ stdenv, coreutils, fetchurl, qt4, dwarf_fortress, bash, makeWrapper }:
22
3+let
4+ version = "30.1.0";
5+ df = dwarf_fortress;
6+in
37stdenv.mkDerivation rec {
4− name = "dwarf-therapist-${rev}";
5− rev = "eeeac8544d94";
8+ name = "dwarf-therapist-${version}";
69
7− src = fetchhg {
8− url = "https://code.google.com/r/splintermind-attributes/";
9− inherit rev;
10− sha256 = "0a9m967q6p2q3plrl6qysg1xrdmg65jzil6awjh2wr3g10x2x15z";
10+ src = fetchurl {
11+ url = "https://github.com/splintermind/Dwarf-Therapist/archive/v${version}.tar.gz";
12+ sha256 = "1x9dkis6b3f8iqcfrc2cj9mcgkwf0rzhxhq2lgy4xdr2n0yjkyv7";
1113 };
1214
1315 # Needed for hashing
14− dwarfBinary = "${dwarf_fortress}/share/df_linux/libs/Dwarf_Fortress";
16+ dfHashFile = "${df}/share/df_linux/hash.md5";
1517
16− buildInputs = [ coreutils qt4 dwarf_fortress makeWrapper ];
18+ buildInputs = [ coreutils qt4 df makeWrapper ];
1719 enableParallelBuilding = false;
1820
19− preConfigure = ''
21+ configurePhase = ''
2022 substituteInPlace dwarftherapist.pro \
2123 --replace /usr/bin $out/bin \
2224 --replace /usr/share $out/share \
2325 --replace "INSTALLS += doc" ""
24− '';
25−
26− preBuild = ''
27− # Log to current directory, otherwise it crashes if log/ doesn't
28− # exist Note: Whis is broken because we cd to the nix store in the
29− # wrapper-script
30− substituteInPlace src/dwarftherapist.cpp \
31− --replace "log/run.log" "dwarf-therapist.log"
32− '';
3326
34− buildPhase = ''
35− qmake INSTALL_PREFIX=$out;
36− make;
27+ qmake INSTALL_PREFIX=$out
3728 '';
3829
3930 postInstall = ''
@@ -46,8 +37,8 @@ stdenv.mkDerivation rec {
4637
4738 postFixup = ''
4839 # Fix checksum of memory access directives
49− substituteInPlace $out/share/dwarftherapist/etc/memory_layouts/linux/v034.11.ini \
50− --replace "e966ee88" $(md5sum ${dwarfBinary} | cut -c1-8)
40+ substituteInPlace $out/share/dwarftherapist/memory_layouts/linux/v0${df.baseVersion}.${df.patchVersion}.ini \
41+ --replace $(cat "${dfHashFile}.orig") $(cat "${dfHashFile}.patched")
5142 '';
5243
5344 meta = {
@@ -58,4 +49,4 @@ stdenv.mkDerivation rec {
5849 hydraPlatforms = [];
5950 homepage = https://code.google.com/r/splintermind-attributes/;
6051 };
61−}
52+}