Merge pull request #48074 from Lassulus/dwarf-fortress
dwarf-fortress: fix build error
This commit is contained in:
commit
0c7103b131
|
@ -1,4 +1,4 @@
|
||||||
{ stdenv, lib, buildEnv, substituteAll
|
{ stdenv, lib, buildEnv, substituteAll, runCommand
|
||||||
, dwarf-fortress, dwarf-fortress-unfuck
|
, dwarf-fortress, dwarf-fortress-unfuck
|
||||||
, dwarf-therapist
|
, dwarf-therapist
|
||||||
, enableDFHack ? false, dfhack
|
, enableDFHack ? false, dfhack
|
||||||
|
@ -33,44 +33,41 @@ let
|
||||||
++ lib.optional enableTWBT twbt.art
|
++ lib.optional enableTWBT twbt.art
|
||||||
++ [ dwarf-fortress ];
|
++ [ dwarf-fortress ];
|
||||||
|
|
||||||
|
fixup = lib.singleton (runCommand "fixup" {} ''
|
||||||
|
mkdir -p $out/data/init
|
||||||
|
cp ${dwarf-fortress}/data/init/init.txt $out/data/init/init.txt
|
||||||
|
'' + lib.optionalString enableDFHack ''
|
||||||
|
mkdir -p $out/hack
|
||||||
|
|
||||||
|
# Patch the MD5
|
||||||
|
orig_md5=$(cat "${dwarf-fortress}/hash.md5.orig")
|
||||||
|
patched_md5=$(cat "${dwarf-fortress}/hash.md5")
|
||||||
|
input_file="${dfhack_}/hack/symbols.xml"
|
||||||
|
output_file="$out/hack/symbols.xml"
|
||||||
|
|
||||||
|
echo "[DFHack Wrapper] Fixing Dwarf Fortress MD5:"
|
||||||
|
echo " Input: $input_file"
|
||||||
|
echo " Search: $orig_md5"
|
||||||
|
echo " Output: $output_file"
|
||||||
|
echo " Replace: $patched_md5"
|
||||||
|
|
||||||
|
substitute "$input_file" "$output_file" --replace "$orig_md5" "$patched_md5"
|
||||||
|
'' + lib.optionalString enableTWBT ''
|
||||||
|
substituteInPlace $out/data/init/init.txt \
|
||||||
|
--replace '[PRINT_MODE:2D]' '[PRINT_MODE:TWBT]'
|
||||||
|
'' + ''
|
||||||
|
substituteInPlace $out/data/init/init.txt \
|
||||||
|
--replace '[INTRO:YES]' '[INTRO:${unBool enableIntro}]' \
|
||||||
|
--replace '[TRUETYPE:YES]' '[TRUETYPE:${unBool enableTruetype}]' \
|
||||||
|
--replace '[FPS:NO]' '[FPS:${unBool enableFPS}]'
|
||||||
|
'');
|
||||||
|
|
||||||
env = buildEnv {
|
env = buildEnv {
|
||||||
name = "dwarf-fortress-env-${dwarf-fortress.dfVersion}";
|
name = "dwarf-fortress-env-${dwarf-fortress.dfVersion}";
|
||||||
|
|
||||||
paths = themePkg ++ pkgs;
|
paths = fixup ++ themePkg ++ pkgs;
|
||||||
pathsToLink = [ "/" "/hack" "/hack/scripts" ];
|
pathsToLink = [ "/" "/hack" "/hack/scripts" ];
|
||||||
|
|
||||||
postBuild = ''
|
|
||||||
# De-symlink init.txt
|
|
||||||
cp $out/data/init/init.txt init.txt
|
|
||||||
rm -f $out/data/init/init.txt
|
|
||||||
mv init.txt $out/data/init/init.txt
|
|
||||||
'' + lib.optionalString enableDFHack ''
|
|
||||||
# De-symlink symbols.xml
|
|
||||||
rm $out/hack/symbols.xml
|
|
||||||
|
|
||||||
# Patch the MD5
|
|
||||||
orig_md5=$(cat "${dwarf-fortress}/hash.md5.orig")
|
|
||||||
patched_md5=$(cat "${dwarf-fortress}/hash.md5")
|
|
||||||
input_file="${dfhack_}/hack/symbols.xml"
|
|
||||||
output_file="$out/hack/symbols.xml"
|
|
||||||
|
|
||||||
echo "[DFHack Wrapper] Fixing Dwarf Fortress MD5:"
|
|
||||||
echo " Input: $input_file"
|
|
||||||
echo " Search: $orig_md5"
|
|
||||||
echo " Output: $output_file"
|
|
||||||
echo " Replace: $patched_md5"
|
|
||||||
|
|
||||||
substitute "$input_file" "$output_file" --replace "$orig_md5" "$patched_md5"
|
|
||||||
'' + lib.optionalString enableTWBT ''
|
|
||||||
substituteInPlace $out/data/init/init.txt \
|
|
||||||
--replace '[PRINT_MODE:2D]' '[PRINT_MODE:TWBT]'
|
|
||||||
'' + ''
|
|
||||||
substituteInPlace $out/data/init/init.txt \
|
|
||||||
--replace '[INTRO:YES]' '[INTRO:${unBool enableIntro}]' \
|
|
||||||
--replace '[TRUETYPE:YES]' '[TRUETYPE:${unBool enableTruetype}]' \
|
|
||||||
--replace '[FPS:NO]' '[FPS:${unBool enableFPS}]'
|
|
||||||
'';
|
|
||||||
|
|
||||||
ignoreCollisions = true;
|
ignoreCollisions = true;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
Loading…
Reference in New Issue