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