-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathz3.nix
91 lines (79 loc) · 2.58 KB
/
z3.nix
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{ lib
, stdenv
, fetchFromGitHub
, python
, fixDarwinDylibNames
, cmake
, javaBindings ? false
, ocamlBindings ? false
, pythonBindings ? false
, jdk ? null
, ocaml ? null
, findlib ? null
, zarith ? null
}:
assert javaBindings -> jdk != null;
assert ocamlBindings -> ocaml != null && findlib != null && zarith != null;
with lib;
stdenv.mkDerivation rec {
pname = "z3";
version = "4.8.10";
src = fetchFromGitHub {
owner = "Z3Prover";
repo = pname;
rev = "z3-${version}";
sha256 = "1w1ym2l0gipvjx322npw7lhclv8rslq58gnj0d9i96masi3gbycf";
};
nativeBuildInputs =
(optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames)
++ [ cmake ];
buildInputs = [ python ]
++ optional javaBindings jdk
++ optionals ocamlBindings [ ocaml findlib zarith ]
;
propagatedBuildInputs = [ python.pkgs.setuptools ];
enableParallelBuilding = true;
postPatch = optionalString ocamlBindings ''
export OCAMLFIND_DESTDIR=$ocaml/lib/ocaml/${ocaml.version}/site-lib
mkdir -p $OCAMLFIND_DESTDIR/stublibs
'';
cmakeFlags =
optional pythonBindings [
"-DZ3_BUILD_PYTHON_BINDINGS=TRUE"
"-DPYTHON_EXECUTABLE=${python.interpreter}"
"-DCMAKE_INSTALL_PYTHON_PKG_DIR=${python.sitePackages}"
]
++ optional javaBindings [
"-DZ3_BUILD_JAVA_BINDINGS=TRUE"
];
# configurePhase = concatStringsSep " "
# (
# [ "${python.interpreter} scripts/mk_make.py --prefix=$out" ]
# ++ optional javaBindings "--java"
# ++ optional ocamlBindings "--ml"
# ++ optional pythonBindings "--python --pypkgdir=$out/${python.sitePackages}"
# ) + "\n" + "cd build";
# postInstall = ''
# mkdir -p $dev $lib
# mv $out/lib $lib/lib
# mv $out/include $dev/include
# '' + optionalString pythonBindings ''
# mkdir -p $python/lib
# mv $lib/lib/python* $python/lib/
# ln -sf $lib/lib/libz3${stdenv.hostPlatform.extensions.sharedLibrary} $python/${python.sitePackages}/z3/lib/libz3${stdenv.hostPlatform.extensions.sharedLibrary}
# '' + optionalString javaBindings ''
# mkdir -p $java/share/java
# mv com.microsoft.z3.jar $java/share/java
# moveToOutput "lib/libz3java.${stdenv.hostPlatform.extensions.sharedLibrary}" "$java"
# '';
# outputs = [ "out" "lib" "dev" "python" ]
# ++ optional javaBindings "java"
# ++ optional ocamlBindings "ocaml";
meta = with lib; {
description = "A high-performance theorem prover and SMT solver";
homepage = "https://github.com/Z3Prover/z3";
license = licenses.mit;
platforms = platforms.unix;
maintainers = with maintainers; [ thoughtpolice ttuegel ];
};
}