forked from mirrors/nixpkgs
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.
This commit is contained in:
parent
e32d7843da
commit
3e62a02b17
|
@ -8,9 +8,19 @@
|
||||||
|
|
||||||
with stdenv.lib;
|
with stdenv.lib;
|
||||||
|
|
||||||
let version = "4.1.18"; in
|
let
|
||||||
|
version = "4.1.18";
|
||||||
stdenv.mkDerivation {
|
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}";
|
name = "virtualbox-${version}-${kernel.version}";
|
||||||
|
|
||||||
NIX_CFLAGS_COMPILE="-I${kernel}/lib/modules/${kernel.modDirVersion}/build/include/generated";
|
NIX_CFLAGS_COMPILE="-I${kernel}/lib/modules/${kernel.modDirVersion}/build/include/generated";
|
||||||
|
@ -42,6 +52,7 @@ stdenv.mkDerivation {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
|
sourcedir="$(pwd)"
|
||||||
./configure --with-qt4-dir=${qt4} \
|
./configure --with-qt4-dir=${qt4} \
|
||||||
${optionalString (!javaBindings) "--disable-java"} \
|
${optionalString (!javaBindings) "--disable-java"} \
|
||||||
${optionalString (!pythonBindings) "--disable-python"} \
|
${optionalString (!pythonBindings) "--disable-python"} \
|
||||||
|
@ -66,6 +77,7 @@ stdenv.mkDerivation {
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
source env.sh
|
source env.sh
|
||||||
kmk
|
kmk
|
||||||
|
${forEachModule "modules"}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
@ -78,15 +90,7 @@ stdenv.mkDerivation {
|
||||||
cp -av * $libexec
|
cp -av * $libexec
|
||||||
|
|
||||||
# Install kernel modules
|
# Install kernel modules
|
||||||
for makefile in $srcroot/out/linux.*/release/bin/src/*/Makefile \
|
${forEachModule "modules_install"}
|
||||||
$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
|
|
||||||
|
|
||||||
# Create wrapper script
|
# Create wrapper script
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
|
|
Loading…
Reference in a new issue