From 3e62a02b17096cf44050e1e5d197234c7abe0f9b Mon Sep 17 00:00:00 2001 From: aszlig Date: Sat, 18 Aug 2012 16:47:13 +0200 Subject: [PATCH] virtualbox: Separate modules build and install. First of all, modules won't install when there is no "make modules" prior to it, so we're doing this now with a new function called forEachModule, so we can avoid duplication as much as possible. In addition this sets $sourcedir to the current directory of the configurePhase, so we're able to find the source tree later on, after several chdir()s. --- .../virtualization/virtualbox/default.nix | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/pkgs/applications/virtualization/virtualbox/default.nix b/pkgs/applications/virtualization/virtualbox/default.nix index 16ff38b4bcb..07f0aae746e 100644 --- a/pkgs/applications/virtualization/virtualbox/default.nix +++ b/pkgs/applications/virtualization/virtualbox/default.nix @@ -8,9 +8,19 @@ with stdenv.lib; -let version = "4.1.18"; in - -stdenv.mkDerivation { +let + version = "4.1.18"; + forEachModule = action: '' + for makefile in $sourcedir/out/linux.*/release/bin/src/*/Makefile \ + $sourcedir/out/linux.*/release/bin/additions/src/*/Makefile + do + mod="$(dirname "$makefile")" + export INSTALL_MOD_PATH="$out" + export INSTALL_MOD_DIR=misc + make -C "$MODULES_BUILD_DIR" "M=$mod" DEPMOD=/do_not_use_depmod ${action} + done + ''; +in stdenv.mkDerivation { name = "virtualbox-${version}-${kernel.version}"; NIX_CFLAGS_COMPILE="-I${kernel}/lib/modules/${kernel.modDirVersion}/build/include/generated"; @@ -42,6 +52,7 @@ stdenv.mkDerivation { ''; configurePhase = '' + sourcedir="$(pwd)" ./configure --with-qt4-dir=${qt4} \ ${optionalString (!javaBindings) "--disable-java"} \ ${optionalString (!pythonBindings) "--disable-python"} \ @@ -66,6 +77,7 @@ stdenv.mkDerivation { buildPhase = '' source env.sh kmk + ${forEachModule "modules"} ''; installPhase = '' @@ -78,15 +90,7 @@ stdenv.mkDerivation { cp -av * $libexec # Install kernel modules - for makefile in $srcroot/out/linux.*/release/bin/src/*/Makefile \ - $srcroot/out/linux.*/release/bin/additions/src/*/Makefile - do - mod="$(dirname "$makefile")" - name="$(basename "$mod")" - export INSTALL_MOD_PATH="$out" - export INSTALL_MOD_DIR=misc - make -C "$MODULES_BUILD_DIR" "M=$mod" DEPMOD=/do_not_use_depmod modules_install - done + ${forEachModule "modules_install"} # Create wrapper script mkdir -p $out/bin