1{ stdenv, lib, fetchgit, bash, coreutils, dtc, file, gawk, gnugrep, gnused, pandoc, which }:
2
3stdenv.mkDerivation rec {
4 pname = "restool";
5 version = "2.4";
6
7 src = fetchgit {
8 url = "https://source.codeaurora.org/external/qoriq/qoriq-components/restool";
9 rev = "abd2f5b7181db9d03db9e6ccda0194923b73e9a2";
10 sha256 = "sha256-ryTDyqSy39e8Omf7l8lK4mLWr8jccDhMVPldkVGSQVo=";
11 };
12
13 nativeBuildInputs = [ file pandoc ];
14 buildInputs = [ bash coreutils dtc gawk gnugrep gnused which ];
15
16 enableParallelBuilding = true;
17 makeFlags = [
18 "prefix="
19 "bindir_completion=/share/bash-completion/completions"
20 "DESTDIR=$(out)"
21 "VERSION=${version}"
22 ];
23
24 postPatch = ''
25 # -Werror makes this derivation fragile on compiler version upgrades, patch
26 # it out.
27 sed -i /-Werror/d Makefile
28 '';
29
30 preFixup = ''
31 # wrapProgram interacts badly with the ls-main tool, which relies on the
32 # shell's $0 argument to figure out which operation to run (busybox-style
33 # symlinks). Instead, inject the environment directly into the shell
34 # scripts we need to wrap.
35 for tool in ls-append-dpl ls-debug ls-main; do
36 sed -i "1 a export PATH=\"$out/bin:${lib.makeBinPath buildInputs}:\$PATH\"" $out/bin/$tool
37 done
38 '';
39
40 meta = with lib; {
41 description = "DPAA2 Resource Management Tool";
42 longDescription = ''
43 restool is a user space application providing the ability to dynamically
44 create and manage DPAA2 containers and objects from Linux.
45 '';
46 homepage = "https://source.codeaurora.org/external/qoriq/qoriq-components/restool/about/";
47 license = licenses.bsd3;
48 platforms = platforms.linux;
49 maintainers = with maintainers; [ delroth ];
50 };
51}