2018-07-21 00:44:44 +00:00
|
|
|
{ stdenv, symlinkJoin, dwarf-therapist, dwarf-fortress, makeWrapper }:
|
2016-01-12 18:17:46 +00:00
|
|
|
|
|
|
|
let
|
2017-12-06 23:53:24 +00:00
|
|
|
platformSlug = if stdenv.targetPlatform.is32bit then
|
|
|
|
"linux32" else "linux64";
|
2018-07-08 19:44:29 +00:00
|
|
|
inifile = "linux/v0.${dwarf-fortress.baseVersion}.${dwarf-fortress.patchVersion}_${platformSlug}.ini";
|
2016-01-12 18:17:46 +00:00
|
|
|
|
2016-04-26 12:27:48 +00:00
|
|
|
in symlinkJoin {
|
2018-07-08 19:44:29 +00:00
|
|
|
name = "dwarf-therapist-${dwarf-therapist.version}";
|
2016-01-12 18:17:46 +00:00
|
|
|
|
2018-07-08 19:44:29 +00:00
|
|
|
paths = [ dwarf-therapist ];
|
2016-01-12 18:17:46 +00:00
|
|
|
|
|
|
|
buildInputs = [ makeWrapper ];
|
|
|
|
|
2018-07-08 19:44:29 +00:00
|
|
|
passthru = { inherit dwarf-fortress dwarf-therapist; };
|
|
|
|
|
2016-01-12 18:17:46 +00:00
|
|
|
postBuild = ''
|
|
|
|
# DwarfTherapist assumes it's run in $out/share/dwarftherapist and
|
|
|
|
# therefore uses many relative paths.
|
2018-06-07 09:04:45 +00:00
|
|
|
wrapProgram $out/bin/dwarftherapist \
|
2016-01-12 18:17:46 +00:00
|
|
|
--run "cd $out/share/dwarftherapist"
|
2018-06-15 19:26:33 +00:00
|
|
|
ln -s $out/bin/dwarftherapist $out/bin/DwarfTherapist
|
2016-01-12 18:17:46 +00:00
|
|
|
|
2016-04-26 12:27:48 +00:00
|
|
|
rm -rf $out/share/dwarftherapist/memory_layouts/linux
|
2016-01-12 18:17:46 +00:00
|
|
|
mkdir -p $out/share/dwarftherapist/memory_layouts/linux
|
2018-07-08 19:44:29 +00:00
|
|
|
origmd5=$(cat "${dwarf-fortress}/hash.md5.orig" | cut -c1-8)
|
|
|
|
patchedmd5=$(cat "${dwarf-fortress}/hash.md5" | cut -c1-8)
|
2016-01-12 18:17:46 +00:00
|
|
|
substitute \
|
2018-07-08 19:44:29 +00:00
|
|
|
${dwarf-therapist}/share/dwarftherapist/memory_layouts/${inifile} \
|
2016-01-12 18:17:46 +00:00
|
|
|
$out/share/dwarftherapist/memory_layouts/${inifile} \
|
2016-01-23 20:57:58 +00:00
|
|
|
--replace "$origmd5" "$patchedmd5"
|
2016-01-12 18:17:46 +00:00
|
|
|
'';
|
|
|
|
}
|