uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,40 @@
{ lib
, stdenv
, fetchFromGitHub
, qtbase
, qtdeclarative
, cmake
, texlive
, ninja
}:
stdenv.mkDerivation rec {
pname = "dwarf-therapist";
version = "41.2.2";
src = fetchFromGitHub {
owner = "Dwarf-Therapist";
repo = "Dwarf-Therapist";
rev = "v${version}";
sha256 = "sha256-zsEG68ioSw64UfmqlTLO1i5sObg8C4zxvdPxdQGMhhU=";
};
nativeBuildInputs = [ texlive cmake ninja ];
buildInputs = [ qtbase qtdeclarative ];
installPhase =
if stdenv.isDarwin then ''
mkdir -p $out/Applications
cp -r DwarfTherapist.app $out/Applications
'' else null;
dontWrapQtApps = true;
meta = with lib; {
description = "Tool to manage dwarves in a running game of Dwarf Fortress";
maintainers = with maintainers; [ abbradar bendlas numinit jonringer ];
license = licenses.mit;
platforms = platforms.unix;
homepage = "https://github.com/Dwarf-Therapist/Dwarf-Therapist";
};
}

View file

@ -0,0 +1,25 @@
#!@stdenv_shell@ -e
[ -z "$DT_DIR" ] && DT_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/dwarftherapist"
install_dir="@install@"
therapist_dir="@therapist@"
@cat@ <<EOF >&2
Using $DT_DIR as Dwarf Therapist overlay directory.
EOF
update_path() {
local path="$1"
@mkdir@ -p "$DT_DIR/$(@dirname@ "$path")"
if [ ! -e "$DT_DIR/$path" ] || [ -L "$DT_DIR/$path" ]; then
@rm@ -f "$DT_DIR/$path"
@ln@ -s "$install_dir/share/dwarftherapist/$path" "$DT_DIR/$path"
fi
}
cd "$install_dir/share/dwarftherapist"
update_path memory_layouts
exec "$therapist_dir/bin/dwarftherapist" "$@"

View file

@ -0,0 +1,60 @@
{ stdenv, dwarf-therapist, dwarf-fortress, substituteAll, coreutils, wrapQtAppsHook }:
let
platformSlug =
if stdenv.targetPlatform.is32bit then
"linux32" else "linux64";
inifile = "linux/v0.${dwarf-fortress.baseVersion}.${dwarf-fortress.patchVersion}_${platformSlug}.ini";
in
stdenv.mkDerivation {
pname = "dwarf-therapist";
version = dwarf-therapist.version;
wrapper = substituteAll {
src = ./dwarf-therapist.in;
stdenv_shell = "${stdenv.shell}";
rm = "${coreutils}/bin/rm";
ln = "${coreutils}/bin/ln";
cat = "${coreutils}/bin/cat";
mkdir = "${coreutils}/bin/mkdir";
dirname = "${coreutils}/bin/dirname";
therapist = "${dwarf-therapist}";
};
paths = [ dwarf-therapist ];
nativeBuildInputs = [ wrapQtAppsHook ];
passthru = { inherit dwarf-fortress dwarf-therapist; };
buildCommand = ''
mkdir -p $out/bin
install -Dm755 $wrapper $out/bin/dwarftherapist
ln -s $out/bin/dwarftherapist $out/bin/DwarfTherapist
substituteInPlace $out/bin/dwarftherapist \
--subst-var-by install $out
wrapQtApp $out/bin/dwarftherapist
# Fix up memory layouts
rm -rf $out/share/dwarftherapist/memory_layouts/linux
mkdir -p $out/share/dwarftherapist/memory_layouts/linux
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"
'';
preferLocalBuild = true;
}