1{
2 lib,
3 stdenv,
4 kernel,
5 fetchFromGitHub,
6 autoreconfHook,
7 bison,
8 flex,
9 p7zip,
10 rsync,
11}:
12
13stdenv.mkDerivation rec {
14 pname = "ply";
15 version = "2.1.1-${lib.substring 0 7 src.rev}";
16
17 nativeBuildInputs = [
18 autoreconfHook
19 flex
20 bison
21 p7zip
22 rsync
23 ];
24
25 src = fetchFromGitHub {
26 owner = "iovisor";
27 repo = "ply";
28 rev = "e25c9134b856cc7ffe9f562ff95caf9487d16b59";
29 sha256 = "1178z7vvnjwnlxc98g2962v16878dy7bd0b2njsgn4vqgrnia7i5";
30 };
31
32 preAutoreconf = ''
33 # If kernel sources are a folder (i.e. fetched from git), we just copy them in
34 # Since they are owned by uid 0 and read-only, we need to fix permissions
35 if [ -d ${kernel.src} ]; then
36 cp -r ${kernel.src} linux-${kernel.version}
37 chown -R $(whoami): linux-${kernel.version}
38 chmod -R a+w linux-${kernel.version}
39 else
40 # ply wants to install header files to its build directory
41 # use 7z to handle multiple archive formats transparently
42 7z x ${kernel.src} -so | 7z x -aoa -si -ttar
43 fi
44
45 configureFlagsArray+=(--with-kerneldir=$(echo $(pwd)/linux-*))
46 ./autogen.sh --prefix=$out
47 '';
48
49 meta = with lib; {
50 description = "Dynamic tracing in Linux";
51 mainProgram = "ply";
52 homepage = "https://wkz.github.io/ply/";
53 license = [ licenses.gpl2Only ];
54 maintainers = with maintainers; [
55 mic92
56 mbbx6spp
57 ];
58 platforms = lib.platforms.linux;
59 };
60}