2016-04-26 13:27:48 +01:00
|
|
|
{ symlinkJoin, lib, dwarf-therapist-original, dwarf-fortress-original, makeWrapper }:
|
2016-01-12 18:17:46 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
df = dwarf-fortress-original;
|
|
|
|
dt = dwarf-therapist-original;
|
2017-07-28 11:08:32 +01:00
|
|
|
inifile = "linux/v0.${df.baseVersion}.${df.patchVersion}.ini";
|
2016-01-12 18:17:46 +00:00
|
|
|
dfHashFile = "${df}/hash.md5";
|
|
|
|
|
2016-04-26 13:27:48 +01:00
|
|
|
in symlinkJoin {
|
|
|
|
name = "dwarf-therapist-${dt.version}";
|
2016-01-12 18:17:46 +00:00
|
|
|
|
|
|
|
paths = [ dt ];
|
|
|
|
|
|
|
|
buildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
postBuild = ''
|
|
|
|
# DwarfTherapist assumes it's run in $out/share/dwarftherapist and
|
|
|
|
# therefore uses many relative paths.
|
2016-04-26 13:27:48 +01:00
|
|
|
wrapProgram $out/bin/DwarfTherapist \
|
2016-01-12 18:17:46 +00:00
|
|
|
--run "cd $out/share/dwarftherapist"
|
|
|
|
|
2016-04-26 13:27:48 +01: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
|
2016-01-23 20:57:58 +00:00
|
|
|
origmd5=$(cat "${dfHashFile}.orig" | cut -c1-8)
|
|
|
|
patchedmd5=$(cat "${dfHashFile}" | cut -c1-8)
|
2016-01-12 18:17:46 +00:00
|
|
|
substitute \
|
|
|
|
${dt.layouts}/${inifile} \
|
|
|
|
$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
|
|
|
'';
|
|
|
|
}
|