mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 12:53:59 +03:00
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.
This commit is contained in:
parent
997531d172
commit
54f3587549
@ -4,17 +4,17 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
baseVersion = "40";
|
baseVersion = "40";
|
||||||
patchVersion = "18";
|
patchVersion = "19";
|
||||||
srcs = {
|
srcs = {
|
||||||
df_unfuck = fetchgit {
|
df_unfuck = fetchgit {
|
||||||
url = "https://github.com/svenstaro/dwarf_fortress_unfuck";
|
url = "https://github.com/svenstaro/dwarf_fortress_unfuck";
|
||||||
rev = "f7ef8d4fa92bcbbf8e4790056c6c3668e3c3b20b";
|
rev = "dadf3d48e93a2800db5d4f98d775ba8453ca55a4";
|
||||||
sha256 = "0kpb3gzjllvi1lahhi74cp2ny1dl7kvnhdlca7i2yxkmyzaaj9qy";
|
sha256 = "011pbcfc3a0mnwqg3pkhngnb1h7z1jbx4qbvj03blpzfjia075sv";
|
||||||
};
|
};
|
||||||
|
|
||||||
df = fetchurl {
|
df = fetchurl {
|
||||||
url = "http://www.bay12games.com/dwarves/df_${baseVersion}_${patchVersion}_linux.tar.bz2";
|
url = "http://www.bay12games.com/dwarves/df_${baseVersion}_${patchVersion}_linux.tar.bz2";
|
||||||
sha256 = "0l29dn24xhkyj8fvmz8318i5sz2wpl420mwy1ccpdd3yfd3hrjmb";
|
sha256 = "16xb6py7l1hf9hc7gn50nwajqgmv01zdhbkh7g6a8gnx7wlhl2p9";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -25,6 +25,7 @@ assert stdenv.system == "i686-linux";
|
|||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "dwarf-fortress-0.${baseVersion}.${patchVersion}";
|
name = "dwarf-fortress-0.${baseVersion}.${patchVersion}";
|
||||||
|
|
||||||
|
inherit baseVersion patchVersion;
|
||||||
|
|
||||||
buildInputs = [ SDL SDL_image SDL_ttf gtk2 glib glew mesa ncurses openal glibc libsndfile pango atk cmake gdk_pixbuf];
|
buildInputs = [ SDL SDL_image SDL_ttf gtk2 glib glew mesa ncurses openal glibc libsndfile pango atk cmake gdk_pixbuf];
|
||||||
src = "${srcs.df_unfuck} ${srcs.df}";
|
src = "${srcs.df_unfuck} ${srcs.df}";
|
||||||
@ -46,6 +47,10 @@ stdenv.mkDerivation rec {
|
|||||||
cd ../../
|
cd ../../
|
||||||
cp -r ./df_linux/* $out/share/df_linux
|
cp -r ./df_linux/* $out/share/df_linux
|
||||||
rm $out/share/df_linux/libs/lib*
|
rm $out/share/df_linux/libs/lib*
|
||||||
|
|
||||||
|
# Store the original hash for dwarf-therapist
|
||||||
|
echo $(md5sum $out/share/df_linux/libs/Dwarf_Fortress | cut -c1-8) > $out/share/df_linux/hash.md5.orig
|
||||||
|
# Fix rpath
|
||||||
patchelf --set-rpath "${stdenv.lib.makeLibraryPath [ stdenv.gcc.gcc stdenv.glibc ]}:$out/share/df_linux/libs" $out/share/df_linux/libs/Dwarf_Fortress
|
patchelf --set-rpath "${stdenv.lib.makeLibraryPath [ stdenv.gcc.gcc stdenv.glibc ]}:$out/share/df_linux/libs" $out/share/df_linux/libs/Dwarf_Fortress
|
||||||
cp -f ./git-export/build/libgraphics.so $out/share/df_linux/libs/libgraphics.so
|
cp -f ./git-export/build/libgraphics.so $out/share/df_linux/libs/libgraphics.so
|
||||||
|
|
||||||
@ -53,6 +58,9 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
patchelf --set-interpreter ${glibc}/lib/ld-linux.so.2 $out/share/df_linux/libs/Dwarf_Fortress
|
patchelf --set-interpreter ${glibc}/lib/ld-linux.so.2 $out/share/df_linux/libs/Dwarf_Fortress
|
||||||
|
|
||||||
|
# Store new hash for dwarf-therapist
|
||||||
|
echo $(md5sum $out/share/df_linux/libs/Dwarf_Fortress | cut -c1-8) > $out/share/df_linux/hash.md5.patched
|
||||||
|
|
||||||
cat > $out/bin/dwarf-fortress << EOF
|
cat > $out/bin/dwarf-fortress << EOF
|
||||||
#!${stdenv.shell}
|
#!${stdenv.shell}
|
||||||
|
|
||||||
|
@ -1,39 +1,30 @@
|
|||||||
{ stdenv, coreutils, fetchhg, qt4, dwarf_fortress, bash, makeWrapper }:
|
{ stdenv, coreutils, fetchurl, qt4, dwarf_fortress, bash, makeWrapper }:
|
||||||
|
|
||||||
|
let
|
||||||
|
version = "30.1.0";
|
||||||
|
df = dwarf_fortress;
|
||||||
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "dwarf-therapist-${rev}";
|
name = "dwarf-therapist-${version}";
|
||||||
rev = "eeeac8544d94";
|
|
||||||
|
|
||||||
src = fetchhg {
|
src = fetchurl {
|
||||||
url = "https://code.google.com/r/splintermind-attributes/";
|
url = "https://github.com/splintermind/Dwarf-Therapist/archive/v${version}.tar.gz";
|
||||||
inherit rev;
|
sha256 = "1x9dkis6b3f8iqcfrc2cj9mcgkwf0rzhxhq2lgy4xdr2n0yjkyv7";
|
||||||
sha256 = "0a9m967q6p2q3plrl6qysg1xrdmg65jzil6awjh2wr3g10x2x15z";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Needed for hashing
|
# Needed for hashing
|
||||||
dwarfBinary = "${dwarf_fortress}/share/df_linux/libs/Dwarf_Fortress";
|
dfHashFile = "${df}/share/df_linux/hash.md5";
|
||||||
|
|
||||||
buildInputs = [ coreutils qt4 dwarf_fortress makeWrapper ];
|
buildInputs = [ coreutils qt4 df makeWrapper ];
|
||||||
enableParallelBuilding = false;
|
enableParallelBuilding = false;
|
||||||
|
|
||||||
preConfigure = ''
|
configurePhase = ''
|
||||||
substituteInPlace dwarftherapist.pro \
|
substituteInPlace dwarftherapist.pro \
|
||||||
--replace /usr/bin $out/bin \
|
--replace /usr/bin $out/bin \
|
||||||
--replace /usr/share $out/share \
|
--replace /usr/share $out/share \
|
||||||
--replace "INSTALLS += doc" ""
|
--replace "INSTALLS += doc" ""
|
||||||
'';
|
|
||||||
|
|
||||||
preBuild = ''
|
qmake INSTALL_PREFIX=$out
|
||||||
# Log to current directory, otherwise it crashes if log/ doesn't
|
|
||||||
# exist Note: Whis is broken because we cd to the nix store in the
|
|
||||||
# wrapper-script
|
|
||||||
substituteInPlace src/dwarftherapist.cpp \
|
|
||||||
--replace "log/run.log" "dwarf-therapist.log"
|
|
||||||
'';
|
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
qmake INSTALL_PREFIX=$out;
|
|
||||||
make;
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
@ -46,8 +37,8 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
postFixup = ''
|
postFixup = ''
|
||||||
# Fix checksum of memory access directives
|
# Fix checksum of memory access directives
|
||||||
substituteInPlace $out/share/dwarftherapist/etc/memory_layouts/linux/v034.11.ini \
|
substituteInPlace $out/share/dwarftherapist/memory_layouts/linux/v0${df.baseVersion}.${df.patchVersion}.ini \
|
||||||
--replace "e966ee88" $(md5sum ${dwarfBinary} | cut -c1-8)
|
--replace $(cat "${dfHashFile}.orig") $(cat "${dfHashFile}.patched")
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
Loading…
Reference in New Issue
Block a user