about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/ocaml-modules/z3/default.nix
blob: b17f29b43531588855ac9e86dc81daba7f80e939 (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
{ stdenv, lib, ocaml, findlib, zarith, z3 }:

if !lib.versionAtLeast ocaml.version "4.07"
then throw "z3 is not available for OCaml ${ocaml.version}"
else

let z3-with-ocaml = (z3.override {
  ocamlBindings = true;
  inherit ocaml findlib zarith;
}).overrideAttrs (o: {
  patches = (o.patches or []) ++ [
    # Fix build; see: https://github.com/Z3Prover/z3/issues/5776
    ./ocamlfind.patch
  ];
}); in

stdenv.mkDerivation {

  pname = "ocaml${ocaml.version}-z3";
  inherit (z3-with-ocaml) version;

  dontUnpack = true;

  installPhase = ''
    runHook preInstall
    mkdir -p $OCAMLFIND_DESTDIR
    cp -r ${z3-with-ocaml.ocaml}/lib/ocaml/${ocaml.version}/site-lib/stublibs $OCAMLFIND_DESTDIR
    cp -r ${z3-with-ocaml.ocaml}/lib/ocaml/${ocaml.version}/site-lib/Z3 $OCAMLFIND_DESTDIR/z3
    runHook postInstall
  '';

  nativeBuildInputs = [ findlib ];
  propagatedBuildInputs = [ zarith ];

  strictDeps = true;

  meta = z3.meta // {
    description = "Z3 Theorem Prover (OCaml API)";
  };
}