nixpkgs/pkgs/applications/science/logic/z3/default.nix
Austin Seipp 54e9f7dcbe z3: move to multiple output packages
The Z3 source code is effectively compiled into two completely separate
objects: the z3 binary file, and the libz3.so library -- but the binary is not
linked against the shared library, it simply incorporates all of the object
files. The Z3 code base results in an ~25MB object on x86_64-linux. As a
result, splitting bin/ and lib/ results in a 50% reduction in closure size.

(The include/ directory is also surprisingly large at .5MB...)

This also splits the python API into a completely separate .python attribute,
as well.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2018-07-12 15:48:48 -05:00

45 lines
1.3 KiB
Nix

{ stdenv, fetchFromGitHub, python, fixDarwinDylibNames }:
stdenv.mkDerivation rec {
name = "z3-${version}";
version = "4.7.1";
src = fetchFromGitHub {
owner = "Z3Prover";
repo = "z3";
rev = "3b1b82bef05a1b5fd69ece79c80a95fb6d72a990";
sha256 = "1s850r6qifwl83zzgvrb5l0jigvmymzpv18ph71hg2bcpk7kjw3d";
};
buildInputs = [ python fixDarwinDylibNames ];
propagatedBuildInputs = [ python.pkgs.setuptools ];
enableParallelBuilding = true;
configurePhase = ''
${python.interpreter} scripts/mk_make.py --prefix=$out --python --pypkgdir=$out/${python.sitePackages}
cd build
'';
postInstall = ''
mkdir -p $dev $lib $python/lib
mv $out/lib/python* $python/lib/
mv $out/lib $lib/lib
mv $out/include $dev/include
# clean up a copy of libz3.so and symlink it instead
rm $python/${python.sitePackages}/z3/lib/libz3.so
ln -s $lib/lib/libz3.so $python/${python.sitePackages}/z3/lib/libz3.so
'';
outputs = [ "out" "lib" "dev" "python" ];
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;
maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
};
}