3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/applications/science/logic/z3/default.nix

78 lines
2.2 KiB
Nix
Raw Normal View History

2021-02-09 11:07:38 +00:00
{ lib
, stdenv
, fetchFromGitHub
, python
, fixDarwinDylibNames
, javaBindings ? false
2020-09-27 16:30:34 +01:00
, ocamlBindings ? false
, pythonBindings ? true
, jdk ? null
2021-02-09 11:07:38 +00: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;
2021-01-15 13:21:58 +00:00
with lib;
2018-02-14 10:00:41 +00:00
stdenv.mkDerivation rec {
pname = "z3";
2021-02-09 11:07:38 +00:00
version = "4.8.10";
src = fetchFromGitHub {
2021-02-09 11:07:38 +00:00
owner = "Z3Prover";
repo = pname;
rev = "z3-${version}";
sha256 = "1w1ym2l0gipvjx322npw7lhclv8rslq58gnj0d9i96masi3gbycf";
};
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 ];
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";
postInstall = ''
mkdir -p $dev $lib
2021-02-09 11:07:38 +00:00
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}
'' + optionalString javaBindings ''
mkdir -p $java/share/java
mv com.microsoft.z3.jar $java/share/java
moveToOutput "lib/libz3java.${stdenv.hostPlatform.extensions.sharedLibrary}" "$java"
'';
2020-09-27 16:30:34 +01:00
outputs = [ "out" "lib" "dev" "python" ]
++ optional javaBindings "java"
2021-02-09 11:07:38 +00:00
++ optional ocamlBindings "ocaml";
2021-02-09 11:07:38 +00:00
meta = with lib; {
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 ];
};
}