1{ lib, stdenv, fetchFromGitLab, libvirt, AppKit, Foundation, autoreconfHook, pkg-config, ocaml, findlib, perl }:
2
3lib.throwIfNot (lib.versionAtLeast ocaml.version "4.02")
4 "libvirt is not available for OCaml ${ocaml.version}"
5
6stdenv.mkDerivation rec {
7 pname = "ocaml-libvirt";
8 version = "0.6.1.5";
9
10 src = fetchFromGitLab {
11 owner = "libvirt";
12 repo = "libvirt-ocaml";
13 rev = "v${version}";
14 sha256 = "0xpkdmknk74yqxgw8z2w8b7ss8hpx92xnab5fsqg2byyj55gzf2k";
15 };
16
17 propagatedBuildInputs = [ libvirt ];
18
19 nativeBuildInputs = [ autoreconfHook pkg-config findlib perl ocaml ];
20
21 buildInputs = lib.optionals stdenv.isDarwin [
22 Foundation
23 AppKit
24 ];
25
26 strictDeps = true;
27
28 buildFlags = [ "all" "opt" "CPPFLAGS=-Wno-error" ];
29 installTargets = "install-opt";
30 preInstall = ''
31 # Fix 'dllmllibvirt.so' install failure into non-existent directory.
32 mkdir -p $OCAMLFIND_DESTDIR/stublibs
33 '';
34
35 meta = with lib; {
36 description = "OCaml bindings for libvirt";
37 homepage = "https://libvirt.org/ocaml/";
38 license = licenses.gpl2;
39 maintainers = [ ];
40 inherit (ocaml.meta) platforms;
41 };
42}