nixpkgs/pkgs/applications/science/logic/z3/default.nix

67 lines
2.0 KiB
Nix
Raw Normal View History

{ stdenv, fetchFromGitHub, python, fixDarwinDylibNames
, javaBindings ? false
2020-09-27 16:30:34 +01:00
, ocamlBindings ? false
, pythonBindings ? true
, jdk ? null
2020-09-27 16:30:34 +01:00
, ocaml ? null, findlib ? null, zarith ? null
}:
assert javaBindings -> jdk != null;
2020-09-27 16:30:34 +01:00
assert ocamlBindings -> ocaml != null && findlib != null && zarith != null;
with stdenv.lib;
2018-02-14 10:00:41 +00:00
stdenv.mkDerivation rec {
pname = "z3";
2020-09-11 20:38:43 +01:00
version = "4.8.9";
src = fetchFromGitHub {
owner = "Z3Prover";
repo = pname;
rev = "z3-${version}";
2020-09-11 20:38:43 +01:00
sha256 = "1hnbzq10d23drd7ksm3c1n2611c3kd0q0yxgz8y78zaafwczvwxx";
};
nativeBuildInputs = optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
buildInputs = [ python ]
2020-09-27 16:30:34 +01:00
++ optional javaBindings jdk
++ optionals ocamlBindings [ ocaml findlib zarith ]
;
2018-02-14 10:00:41 +00:00
propagatedBuildInputs = [ python.pkgs.setuptools ];
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
'';
configurePhase = concatStringsSep " " (
[ "${python.interpreter} scripts/mk_make.py --prefix=$out" ]
++ optional javaBindings "--java"
2020-09-27 16:30:34 +01:00
++ 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/
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-09-27 16:30:34 +01:00
outputs = [ "out" "lib" "dev" "python" ]
++ optional ocamlBindings "ocaml"
;
meta = {
description = "A high-performance theorem prover and SMT solver";
homepage = "https://github.com/Z3Prover/z3";
license = stdenv.lib.licenses.mit;
platforms = stdenv.lib.platforms.unix;
2020-08-21 17:29:26 +01:00
maintainers = with stdenv.lib.maintainers; [ thoughtpolice ttuegel ];
};
}