2020-08-15 07:37:38 +02:00
|
|
|
{ stdenv, fetchFromGitHub, python, fixDarwinDylibNames
|
|
|
|
, javaBindings ? false
|
2020-09-27 17:30:34 +02:00
|
|
|
, ocamlBindings ? false
|
2020-08-15 07:37:38 +02:00
|
|
|
, pythonBindings ? true
|
|
|
|
, jdk ? null
|
2020-09-27 17:30:34 +02:00
|
|
|
, ocaml ? null, findlib ? null, zarith ? null
|
2020-08-15 07:37:38 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert javaBindings -> jdk != null;
|
2020-09-27 17:30:34 +02:00
|
|
|
assert ocamlBindings -> ocaml != null && findlib != null && zarith != null;
|
2020-08-15 07:37:38 +02:00
|
|
|
|
|
|
|
with stdenv.lib;
|
2014-03-08 05:45:15 +01:00
|
|
|
|
2018-02-14 11:00:41 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2019-06-01 04:59:36 +02:00
|
|
|
pname = "z3";
|
2020-09-11 21:38:43 +02:00
|
|
|
version = "4.8.9";
|
2015-03-27 23:46:35 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Z3Prover";
|
2019-06-01 04:59:36 +02:00
|
|
|
repo = pname;
|
2019-12-15 03:30:27 +01:00
|
|
|
rev = "z3-${version}";
|
2020-09-11 21:38:43 +02:00
|
|
|
sha256 = "1hnbzq10d23drd7ksm3c1n2611c3kd0q0yxgz8y78zaafwczvwxx";
|
2014-03-08 05:45:15 +01:00
|
|
|
};
|
|
|
|
|
2020-10-26 08:17:14 +01:00
|
|
|
nativeBuildInputs = optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
|
|
|
|
buildInputs = [ python ]
|
2020-09-27 17:30:34 +02:00
|
|
|
++ optional javaBindings jdk
|
|
|
|
++ optionals ocamlBindings [ ocaml findlib zarith ]
|
|
|
|
;
|
2018-02-14 11:00:41 +01:00
|
|
|
propagatedBuildInputs = [ python.pkgs.setuptools ];
|
2014-03-08 05:45:15 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2020-09-27 17:30:34 +02:00
|
|
|
postPatch = optionalString ocamlBindings ''
|
|
|
|
export OCAMLFIND_DESTDIR=$ocaml/lib/ocaml/${ocaml.version}/site-lib
|
|
|
|
mkdir -p $OCAMLFIND_DESTDIR/stublibs
|
|
|
|
'';
|
|
|
|
|
2020-08-15 07:37:38 +02:00
|
|
|
configurePhase = concatStringsSep " " (
|
|
|
|
[ "${python.interpreter} scripts/mk_make.py --prefix=$out" ]
|
|
|
|
++ optional javaBindings "--java"
|
2020-09-27 17:30:34 +02:00
|
|
|
++ optional ocamlBindings "--ml"
|
2020-08-15 07:37:38 +02:00
|
|
|
++ optional pythonBindings "--python --pypkgdir=$out/${python.sitePackages}"
|
|
|
|
) + "\n" + "cd build";
|
2014-03-08 05:45:15 +01:00
|
|
|
|
2018-07-12 22:01:16 +02:00
|
|
|
postInstall = ''
|
2020-08-15 07:37:38 +02:00
|
|
|
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/
|
2018-07-14 21:49:47 +02:00
|
|
|
ln -sf $lib/lib/libz3${stdenv.hostPlatform.extensions.sharedLibrary} $python/${python.sitePackages}/z3/lib/libz3${stdenv.hostPlatform.extensions.sharedLibrary}
|
2018-07-12 22:01:16 +02:00
|
|
|
'';
|
|
|
|
|
2020-09-27 17:30:34 +02:00
|
|
|
outputs = [ "out" "lib" "dev" "python" ]
|
|
|
|
++ optional ocamlBindings "ocaml"
|
|
|
|
;
|
2018-07-12 22:01:16 +02:00
|
|
|
|
2014-03-08 05:45:15 +01:00
|
|
|
meta = {
|
2015-01-23 17:41:55 +01:00
|
|
|
description = "A high-performance theorem prover and SMT solver";
|
2017-08-17 23:53:40 +02:00
|
|
|
homepage = "https://github.com/Z3Prover/z3";
|
2015-03-27 23:46:35 +01:00
|
|
|
license = stdenv.lib.licenses.mit;
|
2018-11-15 22:24:56 +01:00
|
|
|
platforms = stdenv.lib.platforms.x86_64;
|
2020-08-21 18:29:26 +02:00
|
|
|
maintainers = with stdenv.lib.maintainers; [ thoughtpolice ttuegel ];
|
2014-03-08 05:45:15 +01:00
|
|
|
};
|
|
|
|
}
|