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