diff options
author | Morgan Jones <me@numin.it> | 2018-07-15 03:58:37 +0000 |
---|---|---|
committer | Morgan Jones <me@numin.it> | 2018-09-09 06:59:41 +0000 |
commit | f14d3b4795c173f5ff353031b8d32afab7090ab9 (patch) | |
tree | 0f10c1a662c9e738b0b3e540d48402224b03e5be /pkgs/games/dwarf-fortress | |
parent | 4ada74e293212434114ac87a679c1432650f4b40 (diff) | |
download | nixlib-f14d3b4795c173f5ff353031b8d32afab7090ab9.tar nixlib-f14d3b4795c173f5ff353031b8d32afab7090ab9.tar.gz nixlib-f14d3b4795c173f5ff353031b8d32afab7090ab9.tar.bz2 nixlib-f14d3b4795c173f5ff353031b8d32afab7090ab9.tar.lz nixlib-f14d3b4795c173f5ff353031b8d32afab7090ab9.tar.xz nixlib-f14d3b4795c173f5ff353031b8d32afab7090ab9.tar.zst nixlib-f14d3b4795c173f5ff353031b8d32afab7090ab9.zip |
Fix dfhack's Dwarf Fortress MD5 in the correct environment
Diffstat (limited to 'pkgs/games/dwarf-fortress')
-rw-r--r-- | pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix | 18 | ||||
-rw-r--r-- | pkgs/games/dwarf-fortress/wrapper/default.nix | 54 |
2 files changed, 45 insertions, 27 deletions
diff --git a/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix b/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix index f86ef4bea7ab..6e3a13692a72 100644 --- a/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix +++ b/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix @@ -30,11 +30,17 @@ in symlinkJoin { # Fix up memory layouts rm -rf $out/share/dwarftherapist/memory_layouts/linux mkdir -p $out/share/dwarftherapist/memory_layouts/linux - origmd5=$(cat "${dwarf-fortress}/hash.md5.orig" | cut -c1-8) - patchedmd5=$(cat "${dwarf-fortress}/hash.md5" | cut -c1-8) - substitute \ - ${dwarf-therapist}/share/dwarftherapist/memory_layouts/${inifile} \ - $out/share/dwarftherapist/memory_layouts/${inifile} \ - --replace "$origmd5" "$patchedmd5" + orig_md5=$(cat "${dwarf-fortress}/hash.md5.orig" | cut -c1-8) + patched_md5=$(cat "${dwarf-fortress}/hash.md5" | cut -c1-8) + input_file="${dwarf-therapist}/share/dwarftherapist/memory_layouts/${inifile}" + output_file="$out/share/dwarftherapist/memory_layouts/${inifile}" + + echo "[Dwarf Therapist Wrapper] Fixing Dwarf Fortress MD5 prefix:" + 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" ''; } diff --git a/pkgs/games/dwarf-fortress/wrapper/default.nix b/pkgs/games/dwarf-fortress/wrapper/default.nix index 105143916d10..33523270b19d 100644 --- a/pkgs/games/dwarf-fortress/wrapper/default.nix +++ b/pkgs/games/dwarf-fortress/wrapper/default.nix @@ -37,6 +37,39 @@ let paths = themePkg ++ pkgs; 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; }; in @@ -78,26 +111,5 @@ stdenv.mkDerivation rec { chmod 755 $out/bin/soundsense ''; - postBuild = '' - # De-symlink init.txt - cp $out/data/init/init.txt init.txt - rm $out/data/init/init.txt - mv init.txt $out/data/init/init.txt - '' + lib.optionalString enableDFHack '' - rm $out/hack/symbols.xml - echo "[$out/hack/symbols.xml] $(cat ${dwarf-fortress}/hash.md5.orig) => $(cat ${dwarf-fortress}/hash.md5)" - substitute ${dfhack_}/hack/symbols.xml $out/hack/symbols.xml \ - --replace $(cat ${dwarf-fortress}/hash.md5.orig) \ - $(cat ${dwarf-fortress}/hash.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}]' - ''; - preferLocalBuild = true; } |