From fdae86fb4e3234441987d9164f6f5b7e2d15d0c3 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Tue, 12 Jan 2016 21:17:46 +0300 Subject: [PATCH] dwarf-therapist: 31.0.0 -> 36.0.0 --- pkgs/games/dwarf-fortress/default.nix | 8 ++++ .../dwarf-therapist/default.nix | 40 ++++++++++++++++ .../dwarf-therapist/wrapper.nix | 41 ++++++++++++++++ pkgs/games/dwarf-therapist/default.nix | 48 ------------------- pkgs/top-level/all-packages.nix | 2 +- 5 files changed, 90 insertions(+), 49 deletions(-) create mode 100644 pkgs/games/dwarf-fortress/dwarf-therapist/default.nix create mode 100644 pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix delete mode 100644 pkgs/games/dwarf-therapist/default.nix diff --git a/pkgs/games/dwarf-fortress/default.nix b/pkgs/games/dwarf-fortress/default.nix index d73f932ac032..84b5f2b0f4b6 100644 --- a/pkgs/games/dwarf-fortress/default.nix +++ b/pkgs/games/dwarf-fortress/default.nix @@ -14,6 +14,14 @@ let dwarf-fortress-unfuck = callPackage_i686 ./unfuck.nix { }; dwarf-fortress = callPackage ./wrapper { }; + + dwarf-therapist-original = callPackage ./dwarf-therapist { + texlive = pkgs.texlive.combine { + inherit (pkgs.texlive) scheme-basic float caption wrapfig adjmulticol sidecap preprint enumitem; + }; + }; + + dwarf-therapist = callPackage ./dwarf-therapist/wrapper.nix { }; }; in self diff --git a/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix b/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix new file mode 100644 index 000000000000..07714168e0e8 --- /dev/null +++ b/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix @@ -0,0 +1,40 @@ +{ stdenv, fetchFromGitHub, coreutils, qt4, texlive }: + +let + version = "36.0.0"; +in +stdenv.mkDerivation { + name = "dwarf-therapist-original-${version}"; + + src = fetchFromGitHub { + owner = "splintermind"; + repo = "Dwarf-Therapist"; + rev = "v${version}"; + sha256 = "08xjawb25sibkkfqwd4mlq73dgmgc6lxbbd673rx7yhrsjh4z4h3"; + }; + + outputs = [ "out" "layouts" ]; + buildInputs = [ qt4 ]; + nativeBuildInputs = [ texlive ]; + + enableParallelBuilding = false; + + configurePhase = '' + qmake PREFIX=$out + ''; + + # Move layout files so they cannot be found by Therapist + postInstall = '' + mkdir -p $layouts + mv $out/share/dwarftherapist/memory_layouts/* $layouts + rmdir $out/share/dwarftherapist/memory_layouts + ''; + + meta = { + description = "Tool to manage dwarves in in a running game of Dwarf Fortress"; + maintainers = with stdenv.lib.maintainers; [ the-kenny abbradar ]; + license = stdenv.lib.licenses.mit; + platforms = stdenv.lib.platforms.linux; + homepage = https://code.google.com/r/splintermind-attributes/; + }; +} diff --git a/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix b/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix new file mode 100644 index 000000000000..6b138ac51029 --- /dev/null +++ b/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix @@ -0,0 +1,41 @@ +{ buildEnv, lib, dwarf-therapist-original, dwarf-fortress-original, makeWrapper }: + +let + df = dwarf-fortress-original; + dt = dwarf-therapist-original; + inifile = "linux/v0${df.baseVersion}.${df.patchVersion}.ini"; + dfHashFile = "${df}/hash.md5"; + +in buildEnv { + name = "dwarf-therapist-${lib.getVersion dt}"; + + paths = [ dt ]; + + buildInputs = [ makeWrapper ]; + + postBuild = '' + # DwarfTherapist assumes it's run in $out/share/dwarftherapist and + # therefore uses many relative paths. + rm $out/bin + mkdir $out/bin + makeWrapper ${dt}/bin/DwarfTherapist $out/bin/DwarfTherapist \ + --run "cd $out/share/dwarftherapist" + + # Fix checksum of memory access directives. We really need #4621 fixed! + recreate_dir() { + rm "$out/$1" + mkdir -p "$out/$1" + for i in "${dt}/$1/"*; do + ln -s "$i" "$out/$1" + done + } + + recreate_dir share + recreate_dir share/dwarftherapist + mkdir -p $out/share/dwarftherapist/memory_layouts/linux + substitute \ + ${dt.layouts}/${inifile} \ + $out/share/dwarftherapist/memory_layouts/${inifile} \ + --replace $(cat "${dfHashFile}.orig") $(cat "${dfHashFile}.patched") + ''; +} diff --git a/pkgs/games/dwarf-therapist/default.nix b/pkgs/games/dwarf-therapist/default.nix deleted file mode 100644 index 4e676bf5f9df..000000000000 --- a/pkgs/games/dwarf-therapist/default.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ stdenv, coreutils, fetchgit, qt4, dwarf_fortress, bash, makeWrapper }: - -let - version = "31.0.0"; - df = dwarf_fortress; -in -stdenv.mkDerivation rec { - name = "dwarf-therapist-${version}"; - - src = fetchgit { - url = "https://github.com/splintermind/Dwarf-Therapist.git"; - rev = "refs/tags/v${version}"; - sha256 = "02d6k8c3vm401v04ln9q405njarx869jpfyf42lwskijrzjygk9x"; - }; - - # Needed for hashing - dfHashFile = "${df}/share/df_linux/hash.md5"; - - buildInputs = [ coreutils qt4 df makeWrapper ]; - enableParallelBuilding = false; - - configurePhase = '' - qmake PREFIX=$out - ''; - - postInstall = '' - # DwarfTherapist assumes it's run in $out/share/dwarftherapist and - # therefore uses many relative paths. - rm $out/bin/dwarftherapist - wrapProgram $out/bin/DwarfTherapist \ - --run "cd $out/share/dwarftherapist" - ''; - - postFixup = '' - # Fix checksum of memory access directives - substituteInPlace $out/share/dwarftherapist/memory_layouts/linux/v0${df.baseVersion}.${df.patchVersion}.ini \ - --replace $(cat "${dfHashFile}.orig") $(cat "${dfHashFile}.patched") - ''; - - meta = { - description = "Tool to manage dwarves in in a running game of Dwarf Fortress"; - maintainers = with stdenv.lib.maintainers; [ the-kenny ]; - license = stdenv.lib.licenses.mit; - platforms = stdenv.lib.platforms.linux; - hydraPlatforms = []; - homepage = https://code.google.com/r/splintermind-attributes/; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 41c8dadeffb0..c7aa0c8cc0b7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14112,7 +14112,7 @@ let dwarf-fortress = dwarf-fortress-packages.dwarf-fortress.override { }; - dwarf-therapist = callPackage ../games/dwarf-therapist { }; + dwarf-therapist = dwarf-fortress-packages.dwarf-therapist; d1x_rebirth = callPackage ../games/d1x-rebirth { };