From 54e9f7dcbea9288fd9cea0dfc37e8deba53a806b Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Thu, 12 Jul 2018 15:01:16 -0500 Subject: [PATCH] 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 --- pkgs/applications/science/logic/z3/default.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkgs/applications/science/logic/z3/default.nix b/pkgs/applications/science/logic/z3/default.nix index 54c9799a01b..10a52619276 100644 --- a/pkgs/applications/science/logic/z3/default.nix +++ b/pkgs/applications/science/logic/z3/default.nix @@ -20,6 +20,20 @@ stdenv.mkDerivation rec { 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";