Merge branch 'virtualbox-manual-kernel' of github.com:aszlig/nixpkgs

virtualbox: Fix build for manual kernel.

This should fix building VirtualBox against kernels made using the new
manual kernel configuration system.

This has been tested with the standard nixpkgs kernel as well.
This commit is contained in:
Shea Levy 2012-08-19 10:03:45 -04:00
commit 18bbb2fa5c

View File

@ -8,13 +8,27 @@
with stdenv.lib;
let version = "4.1.18"; in
stdenv.mkDerivation {
let
version = "4.1.18";
forEachModule = action: ''
for mod in \
$sourcedir/out/linux.*/release/bin/src/vboxdrv \
$sourcedir/out/linux.*/release/bin/src/vboxpci \
$sourcedir/out/linux.*/release/bin/src/vboxnetadp \
$sourcedir/out/linux.*/release/bin/src/vboxnetflt
do
if [ "x$(basename "$mod")" != xvboxdrv -a ! -e "$mod/Module.symvers" ]
then
cp -v $sourcedir/out/linux.*/release/bin/src/vboxdrv/Module.symvers \
"$mod/Module.symvers"
fi
INSTALL_MOD_PATH="$out" 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";
src = fetchurl {
url = "http://download.virtualbox.org/virtualbox/${version}/VirtualBox-${version}.tar.bz2";
sha256 = "e650e4fdc23581b9edc0e5d5705cc596c76796851ebf65ccda0edb8e413fa3b7";
@ -42,10 +56,11 @@ stdenv.mkDerivation {
'';
configurePhase = ''
sourcedir="$(pwd)"
./configure --with-qt4-dir=${qt4} \
${optionalString (!javaBindings) "--disable-java"} \
${optionalString (!pythonBindings) "--disable-python"} \
--disable-pulse --disable-hardening \
--disable-pulse --disable-hardening --disable-kmods \
--with-mkisofs=${xorriso}/bin/xorrisofs
sed -e 's@PKG_CONFIG_PATH=.*@PKG_CONFIG_PATH=${libIDL}/lib/pkgconfig:${glib}/lib/pkgconfig ${libIDL}/bin/libIDL-config-2@' \
-i AutoConfig.kmk
@ -63,51 +78,35 @@ stdenv.mkDerivation {
enableParallelBuilding = true;
preBuild = ''
buildPhase = ''
source env.sh
kmk
cd out/linux.*/release/bin/src
export KERN_DIR=${kernel}/lib/modules/*/build
${forEachModule "modules"}
'';
postBuild = ''
cd ../../../../..
'';
installPhase = ''
libexec=$out/libexec/virtualbox
# Install VirtualBox files
cd out/linux.*/release/bin
mkdir -p $libexec
cp -av * $libexec
# Install kernel module
cd src
kernelVersion=$(cd ${kernel}/lib/modules; ls)
export MODULE_DIR=$out/lib/modules/$kernelVersion/misc
# Remove root ownership stuff, since this does not work in a chroot environment
for i in `find . -name Makefile`; do
sed -i -e "s|-o root||g" \
-e "s|-g root||g" $i
done
# Install kernel modules
make install
${forEachModule "modules_install"}
# Create wrapper script
mkdir -p $out/bin
for file in VirtualBox VBoxManage VBoxSDL VBoxBalloonCtrl VBoxBFE VBoxHeadless; do
ln -s "$libexec/$file" $out/bin/$file
done
# Create and fix desktop item
mkdir -p $out/share/applications
sed -i -e "s|Icon=VBox|Icon=$libexec/VBox.png|" $libexec/virtualbox.desktop
ln -sfv $libexec/virtualbox.desktop $out/share/applications
'';
meta = {
description = "PC emulator";
homepage = http://www.virtualbox.org/;