nixpkgs/pkgs/development/libraries/qt-5/mkDerivation.nix
Thomas Tuegel 75d2a7dc4d
qt5: reduce closure size
First, closure size is reduced by including the static libraries in $out instead
of trying to move them to $dev. The Qt build system cannot handle libraries
being split between different prefixes. Previously, the static libraries were
moved into $dev and the shared libraries were symlinked from $out to $dev to
fool the build system. However, this causes $dev to be retained at
runtime. Instead, we now keep the static libraries in $out. Fortunately, the
static libraries are not very large anyway.

Second, we build with QT_NO_DEBUG defined unless debugging is enabled. This
causes some assertions to be removed; when assertions are included, they pull
paths from $dev into the runtime closure by using the __FILE__ macro. We also
now patch qtbase to remove even more assertions when QT_NO_DEBUG is defined.
2018-01-15 18:48:37 -06:00

32 lines
639 B
Nix

{ stdenv, lib }:
let inherit (lib) optional; in
{ debug }:
args:
let
args_ = {
qmakeFlags =
(args.qmakeFlags or [])
++ optional (debug != null)
(if debug then "CONFIG+=debug" else "CONFIG+=release");
NIX_CFLAGS_COMPILE = optional (debug != null) "-DQT_NO_DEBUG";
cmakeFlags =
(args.cmakeFlags or [])
++ [ "-DBUILD_TESTING=OFF" ]
++ optional (debug != null)
(if debug then "-DCMAKE_BUILD_TYPE=Debug"
else "-DCMAKE_BUILD_TYPE=Release");
enableParallelBuilding = args.enableParallelBuilding or true;
};
in
stdenv.mkDerivation (args // args_)