1{ stdenv, lib, ocaml, findlib, zarith, z3 }:
2
3if lib.versionOlder ocaml.version "4.07"
4then throw "z3 is not available for OCaml ${ocaml.version}"
5else
6
7let z3-with-ocaml = (z3.override {
8 ocamlBindings = true;
9 inherit ocaml findlib zarith;
10}); in
11
12stdenv.mkDerivation {
13
14 pname = "ocaml${ocaml.version}-z3";
15 inherit (z3-with-ocaml) version;
16
17 dontUnpack = true;
18
19 installPhase = ''
20 runHook preInstall
21 mkdir -p $OCAMLFIND_DESTDIR
22 cp -r ${z3-with-ocaml.ocaml}/lib/ocaml/${ocaml.version}/site-lib/stublibs $OCAMLFIND_DESTDIR
23 cp -r ${z3-with-ocaml.ocaml}/lib/ocaml/${ocaml.version}/site-lib/Z3 $OCAMLFIND_DESTDIR/z3
24 runHook postInstall
25 '';
26
27 nativeBuildInputs = [ findlib ];
28 propagatedBuildInputs = [ zarith ];
29
30 strictDeps = true;
31
32 meta = z3.meta // {
33 description = "Z3 Theorem Prover (OCaml API)";
34 };
35}