1{ stdenv,
2 fetchFromGitHub,
3 autoreconfHook,
4 bison,
5 flex,
6 glib,
7 pkgconfig,
8 json_c,
9 xen,
10 libvirt,
11 xenSupport ? true }:
12
13with stdenv.lib;
14
15stdenv.mkDerivation rec {
16 pname = "libvmi";
17 version = "0.12.0";
18 libVersion = "0.0.12";
19
20 src = fetchFromGitHub {
21 owner = "libvmi";
22 repo = "libvmi";
23 rev = "v${version}";
24 sha256 = "0wbi2nasb1gbci6cq23g6kq7i10rwi1y7r44rl03icr5prqjpdyv";
25 };
26
27 buildInputs = [ glib libvirt json_c ] ++ (optional xenSupport xen);
28 nativeBuildInputs = [ autoreconfHook bison flex pkgconfig ];
29
30 configureFlags = optional (!xenSupport) "--disable-xen";
31
32 # libvmi uses dlopen() for the xen libraries, however autoPatchelfHook doesn't work here
33 postFixup = optionalString xenSupport ''
34 libvmi="$out/lib/libvmi.so.${libVersion}"
35 oldrpath=$(patchelf --print-rpath "$libvmi")
36 patchelf --set-rpath "$oldrpath:${makeLibraryPath [ xen ]}" "$libvmi"
37 '';
38
39 meta = with stdenv.lib; {
40 homepage = "http://libvmi.com/";
41 description = "A C library for virtual machine introspection";
42 longDescription = ''
43 LibVMI is a C library with Python bindings that makes it easy to monitor the low-level
44 details of a running virtual machine by viewing its memory, trapping on hardware events,
45 and accessing the vCPU registers.
46 '';
47 license = with licenses; [ gpl3 lgpl3 ];
48 platforms = platforms.linux;
49 maintainers = with maintainers; [ lschuermann ];
50 };
51}