about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/ocaml-modules/ocaml-libvirt/default.nix
blob: 67741516af19e681e376868bb356d6bca6d07e8b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{ lib, stdenv, fetchFromGitLab, libvirt, AppKit, Foundation, autoreconfHook, pkg-config, ocaml, findlib, perl }:

lib.throwIfNot (lib.versionAtLeast ocaml.version "4.02")
  "libvirt is not available for OCaml ${ocaml.version}"

stdenv.mkDerivation rec {
  pname = "ocaml-libvirt";
  version = "0.6.1.5";

  src = fetchFromGitLab {
    owner = "libvirt";
    repo = "libvirt-ocaml";
    rev = "v${version}";
    sha256 = "0xpkdmknk74yqxgw8z2w8b7ss8hpx92xnab5fsqg2byyj55gzf2k";
  };

  propagatedBuildInputs = [ libvirt ];

  nativeBuildInputs = [ autoreconfHook pkg-config findlib perl ocaml ];

  buildInputs = lib.optionals stdenv.isDarwin [
    Foundation
    AppKit
  ];

  strictDeps = true;

  buildFlags = [ "all" "opt" "CPPFLAGS=-Wno-error" ];
  installTargets = "install-opt";
  preInstall = ''
    # Fix 'dllmllibvirt.so' install failure into non-existent directory.
    mkdir -p $OCAMLFIND_DESTDIR/stublibs
  '';

  meta = with lib; {
    description = "OCaml bindings for libvirt";
    homepage = "https://libvirt.org/ocaml/";
    license = licenses.gpl2;
    maintainers = [ ];
    inherit (ocaml.meta) platforms;
  };
}