1{ lib
2, stdenv
3, fetchurl
4, meson
5, ninja
6, pkg-config
7, gettext
8, vala
9, libcap_ng
10, libvirt
11, libxml2
12, buildPackages
13, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages
14, gobject-introspection
15, withDocs ? stdenv.hostPlatform == stdenv.buildPlatform
16, gtk-doc
17, docbook-xsl-nons
18}:
19
20stdenv.mkDerivation rec {
21 pname = "libvirt-glib";
22 version = "5.0.0";
23
24 outputs = [ "out" "dev" ] ++ lib.optional withDocs "devdoc";
25
26 src = fetchurl {
27 url = "https://libvirt.org/sources/glib/${pname}-${version}.tar.xz";
28 sha256 = "m/7DRjgkFqNXXYcpm8ZBsqRkqlGf2bEofjGKpDovO4s=";
29 };
30
31 nativeBuildInputs = [
32 meson
33 ninja
34 pkg-config
35 gettext
36 vala
37 gobject-introspection
38 ] ++ lib.optionals withIntrospection [
39 gobject-introspection
40 ] ++ lib.optionals withDocs [
41 gtk-doc
42 docbook-xsl-nons
43 ];
44
45 buildInputs = [
46 libvirt
47 libxml2
48 ] ++ lib.optionals stdenv.isLinux [
49 libcap_ng
50 ];
51
52 strictDeps = true;
53
54 # The build system won't let us build with docs or introspection
55 # unless we're building natively, but will still do a mandatory
56 # check for the dependencies for those things unless we explicitly
57 # disable the options.
58 mesonFlags = [
59 (lib.mesonEnable "docs" withDocs)
60 (lib.mesonEnable "introspection" withIntrospection)
61 ];
62
63 meta = with lib; {
64 description = "Library for working with virtual machines";
65 longDescription = ''
66 libvirt-glib wraps libvirt to provide a high-level object-oriented API better
67 suited for glib-based applications, via three libraries:
68
69 - libvirt-glib - GLib main loop integration & misc helper APIs
70 - libvirt-gconfig - GObjects for manipulating libvirt XML documents
71 - libvirt-gobject - GObjects for managing libvirt objects
72 '';
73 homepage = "https://libvirt.org/";
74 license = licenses.lgpl2Plus;
75 platforms = platforms.unix;
76 };
77}