virtualbox: Explicitly state Qt 5 dependencies

In 2942815968, the dependencies for Qt 5
were passed using buildEnv with all the development binaries, headers
and libs. Unfortunately, the build output references that environment
which also increases the size of the runtime closure.

The upstream makefile assumes a common Qt 5 library path, but that's not
the case within Nix, because we have separate paths for the Qt 5
modules.

We now patch the makefile to recognize PATH_QT5_X11_EXTRAS_{LIB,INC} so
that we can pass in the relevant paths from Qt5X11Extras.

In summary, the closure size goes down to 525559600 bytes (501 MB)
instead of 863035544 bytes (823 MB) with vbox-qt5-env.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
aszlig 2016-09-13 06:01:27 +02:00
parent 8bd89c922d
commit d2af4c6722
No known key found for this signature in database
GPG Key ID: 1DE8E48E57DB5436
2 changed files with 42 additions and 10 deletions

View File

@ -1,4 +1,4 @@
{ stdenv, buildEnv, fetchurl, lib, iasl, dev86, pam, libxslt, libxml2, libX11, xproto, libXext
{ stdenv, fetchurl, lib, iasl, dev86, pam, libxslt, libxml2, libX11, xproto, libXext
, libXcursor, libXmu, qt5, libIDL, SDL, libcap, zlib, libpng, glib, lvm2
, libXrandr, libXinerama
, which, alsaLib, curl, libvpx, gawk, nettools, dbus
@ -35,11 +35,6 @@ let
'';
};
vbox-qt5-env = buildEnv {
name = "vbox-qt5-env-${version}";
paths = [ qt5.qtbase.dev qt5.qtbase.out qt5.qtx11extras.dev qt5.qtx11extras.out qt5.qttools.dev ];
};
in stdenv.mkDerivation {
name = "virtualbox-${version}";
@ -58,7 +53,7 @@ in stdenv.mkDerivation {
++ optional pythonBindings python
++ optional pulseSupport libpulseaudio
++ optionals (headless) [ libXrandr ]
++ optionals (!headless) [ vbox-qt5-env libXinerama SDL ];
++ optionals (!headless) [ qt5.qtbase qt5.qtx11extras libXinerama SDL ];
hardeningDisable = [ "fortify" "pic" "stackprotector" ];
@ -66,7 +61,9 @@ in stdenv.mkDerivation {
set -x
sed -e 's@MKISOFS --version@MKISOFS -version@' \
-e 's@PYTHONDIR=.*@PYTHONDIR=${if pythonBindings then python else ""}@' \
-i configure
${optionalString (!headless) ''
-e 's@TOOLQT5BIN=.*@TOOLQT5BIN="${getDev qt5.qtbase}/bin"@' \
''} -i configure
ls kBuild/bin/linux.x86/k* tools/linux.x86/bin/* | xargs -n 1 patchelf --set-interpreter ${stdenv.glibc.out}/lib/ld-linux.so.2
ls kBuild/bin/linux.amd64/k* tools/linux.amd64/bin/* | xargs -n 1 patchelf --set-interpreter ${stdenv.glibc.out}/lib/ld-linux-x86-64.so.2
sed -i -e '
@ -83,7 +80,7 @@ in stdenv.mkDerivation {
'';
patches = optional enableHardening ./hardened.patch
++ [ ./libressl.patch ];
++ [ ./libressl.patch ./qtx11extras.patch ];
postPatch = ''
sed -i -e 's|/sbin/ifconfig|${nettools}/bin/ifconfig|' \
@ -111,11 +108,15 @@ in stdenv.mkDerivation {
${optionalString javaBindings ''
VBOX_JAVA_HOME := ${jdk}
''}
${optionalString (!headless) ''
PATH_QT5_X11_EXTRAS_LIB := ${getLib qt5.qtx11extras}/lib
PATH_QT5_X11_EXTRAS_INC := ${getDev qt5.qtx11extras}/include
TOOL_QT5_LRC := ${getDev qt5.qttools}/bin/lrelease
''}
LOCAL_CONFIG
./configure \
${optionalString headless "--build-headless"} \
${optionalString (!headless) "--with-qt-dir=${vbox-qt5-env}"} \
${optionalString (!javaBindings) "--disable-java"} \
${optionalString (!pythonBindings) "--disable-python"} \
${optionalString (!pulseSupport) "--disable-pulse"} \

View File

@ -0,0 +1,31 @@
diff --git a/kBuild/units/qt5.kmk b/kBuild/units/qt5.kmk
index 71b96a3..73391f0 100644
--- a/kBuild/units/qt5.kmk
+++ b/kBuild/units/qt5.kmk
@@ -994,9 +994,10 @@ else
$(eval $(target)_LIBS += $(PATH_SDK_QT5_LIB)/$(qt_prefix)qtmain$(qt_infix)$(SUFF_LIB) )
endif
else
- $(eval $(target)_LIBS += $(foreach module,$(qt_modules), $(PATH_SDK_QT5_LIB)/lib$(qt_prefix)Qt5$(module)$(qt_infix)$(SUFF_DLL)) )
+ $(eval $(target)_LIBS += $(foreach module,$(qt_modules), $(PATH_SDK_QT5_LIB)/lib$(qt_prefix)Qt5$(module)$(qt_infix)$(SUFF_DLL)) \
+ $(PATH_QT5_X11_EXTRAS_LIB)/lib$(qt_prefix)Qt5X11Extras$(qt_infix)$(SUFF_DLL))
endif
- $(eval $(target)_INCS += $(addprefix $(PATH_SDK_QT5_INC)/Qt,$(qt_modules)) $(PATH_SDK_QT5_INC) )
+ $(eval $(target)_INCS += $(addprefix $(PATH_SDK_QT5_INC)/Qt,$(qt_modules)) $(PATH_SDK_QT5_INC) $(PATH_QT5_X11_EXTRAS_INC)/QtX11Extras )
endif
$(eval $(target)_DEFS += $(foreach module,$(toupper $(qt_modules)), QT_$(module)_LIB) )
diff --git a/src/VBox/Frontends/VirtualBox/Makefile.kmk b/src/VBox/Frontends/VirtualBox/Makefile.kmk
index 38db6b0..7dd446b 100644
--- a/src/VBox/Frontends/VirtualBox/Makefile.kmk
+++ b/src/VBox/Frontends/VirtualBox/Makefile.kmk
@@ -912,9 +912,6 @@ VirtualBox_QT_MODULES = Core Gui
ifdef VBOX_WITH_QTGUI_V5
# Qt5 requires additional modules:
VirtualBox_QT_MODULES += Widgets PrintSupport
- VirtualBox_QT_MODULES.linux += X11Extras
- VirtualBox_QT_MODULES.solaris += X11Extras
- VirtualBox_QT_MODULES.freebsd += X11Extras
VirtualBox_QT_MODULES.darwin += MacExtras
VirtualBox_QT_MODULES.win += WinExtras
endif # VBOX_WITH_QTGUI_V5