2021-02-09 11:07:38 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, python
|
|
|
|
, fixDarwinDylibNames
|
2020-08-15 06:37:38 +01:00
|
|
|
, javaBindings ? false
|
2020-09-27 16:30:34 +01:00
|
|
|
, ocamlBindings ? false
|
2020-08-15 06:37:38 +01:00
|
|
|
, pythonBindings ? true
|
|
|
|
, jdk ? null
|
2021-02-09 11:07:38 +00:00
|
|
|
, ocaml ? null
|
|
|
|
, findlib ? null
|
|
|
|
, zarith ? null
|
2020-08-15 06:37:38 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert javaBindings -> jdk != null;
|
2020-09-27 16:30:34 +01:00
|
|
|
assert ocamlBindings -> ocaml != null && findlib != null && zarith != null;
|
2020-08-15 06:37:38 +01:00
|
|
|
|
2021-01-15 13:21:58 +00:00
|
|
|
with lib;
|
2014-03-08 04:45:15 +00:00
|
|
|
|
2018-02-14 10:00:41 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-06-01 03:59:36 +01:00
|
|
|
pname = "z3";
|
2021-02-09 11:07:38 +00:00
|
|
|
version = "4.8.10";
|
2015-03-27 22:46:35 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2021-02-09 11:07:38 +00:00
|
|
|
owner = "Z3Prover";
|
|
|
|
repo = pname;
|
|
|
|
rev = "z3-${version}";
|
|
|
|
sha256 = "1w1ym2l0gipvjx322npw7lhclv8rslq58gnj0d9i96masi3gbycf";
|
2014-03-08 04:45:15 +00:00
|
|
|
};
|
|
|
|
|
2020-10-26 07:17:14 +00:00
|
|
|
nativeBuildInputs = optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
|
|
|
|
buildInputs = [ python ]
|
2021-02-09 11:07:38 +00:00
|
|
|
++ optional javaBindings jdk
|
|
|
|
++ optionals ocamlBindings [ ocaml findlib zarith ]
|
2020-09-27 16:30:34 +01:00
|
|
|
;
|
2018-02-14 10:00:41 +00:00
|
|
|
propagatedBuildInputs = [ python.pkgs.setuptools ];
|
2014-03-08 04:45:15 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2020-09-27 16:30:34 +01:00
|
|
|
postPatch = optionalString ocamlBindings ''
|
|
|
|
export OCAMLFIND_DESTDIR=$ocaml/lib/ocaml/${ocaml.version}/site-lib
|
|
|
|
mkdir -p $OCAMLFIND_DESTDIR/stublibs
|
|
|
|
'';
|
|
|
|
|
2021-02-09 11:07:38 +00:00
|
|
|
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";
|
2014-03-08 04:45:15 +00:00
|
|
|
|
2018-07-12 21:01:16 +01:00
|
|
|
postInstall = ''
|
2020-08-15 06:37:38 +01:00
|
|
|
mkdir -p $dev $lib
|
2021-02-09 11:07:38 +00:00
|
|
|
mv $out/lib $lib/lib
|
2020-08-15 06:37:38 +01:00
|
|
|
mv $out/include $dev/include
|
|
|
|
'' + optionalString pythonBindings ''
|
|
|
|
mkdir -p $python/lib
|
|
|
|
mv $lib/lib/python* $python/lib/
|
2018-07-14 20:49:47 +01:00
|
|
|
ln -sf $lib/lib/libz3${stdenv.hostPlatform.extensions.sharedLibrary} $python/${python.sitePackages}/z3/lib/libz3${stdenv.hostPlatform.extensions.sharedLibrary}
|
2020-10-29 18:03:13 +00:00
|
|
|
'' + optionalString javaBindings ''
|
|
|
|
mkdir -p $java/share/java
|
|
|
|
mv com.microsoft.z3.jar $java/share/java
|
|
|
|
moveToOutput "lib/libz3java.${stdenv.hostPlatform.extensions.sharedLibrary}" "$java"
|
2018-07-12 21:01:16 +01:00
|
|
|
'';
|
|
|
|
|
2020-09-27 16:30:34 +01:00
|
|
|
outputs = [ "out" "lib" "dev" "python" ]
|
2020-10-29 18:03:13 +00:00
|
|
|
++ optional javaBindings "java"
|
2021-02-09 11:07:38 +00:00
|
|
|
++ optional ocamlBindings "ocaml";
|
2018-07-12 21:01:16 +01:00
|
|
|
|
2021-02-09 11:07:38 +00:00
|
|
|
meta = with lib; {
|
2015-01-23 16:41:55 +00:00
|
|
|
description = "A high-performance theorem prover and SMT solver";
|
2021-02-09 11:07:38 +00:00
|
|
|
homepage = "https://github.com/Z3Prover/z3";
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ thoughtpolice ttuegel ];
|
2014-03-08 04:45:15 +00:00
|
|
|
};
|
|
|
|
}
|