VirtualBox-GuestAdditions: Add to the channel

This commit is contained in:
Eelco Dolstra 2012-08-14 13:43:37 -04:00
parent 9d516f16fc
commit c67c397c11
1 changed files with 32 additions and 31 deletions

View File

@ -17,16 +17,16 @@ stdenv.mkDerivation {
cp -r install/* $out cp -r install/* $out
''; '';
buildCommand = '' buildCommand = ''
${if stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux" then '' ${if stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux" then ''
isoinfo -J -i $src -x /VBoxLinuxAdditions.run > ./VBoxLinuxAdditions.run isoinfo -J -i $src -x /VBoxLinuxAdditions.run > ./VBoxLinuxAdditions.run
chmod 755 ./VBoxLinuxAdditions.run chmod 755 ./VBoxLinuxAdditions.run
./VBoxLinuxAdditions.run --noexec --keep ./VBoxLinuxAdditions.run --noexec --keep
'' ''
else throw ("Architecture: "+stdenv.system+" not supported for VirtualBox guest additions") else throw ("Architecture: "+stdenv.system+" not supported for VirtualBox guest additions")
} }
# Unpack files # Unpack files
cd install cd install
${if stdenv.system == "i686-linux" then '' ${if stdenv.system == "i686-linux" then ''
@ -38,31 +38,31 @@ stdenv.mkDerivation {
else throw ("Architecture: "+stdenv.system+" not supported for VirtualBox guest additions") else throw ("Architecture: "+stdenv.system+" not supported for VirtualBox guest additions")
} }
# Build kernel modules # Build kernel modules
cd src cd src
for i in * for i in *
do do
cd $i cd $i
find . -type f | xargs sed 's/depmod -a/true/' -i find . -type f | xargs sed 's/depmod -a/true/' -i
make make
cd .. cd ..
done done
cd .. cd ..
# Change the interpreter for various binaries # Change the interpreter for various binaries
for i in sbin/VBoxService bin/{VBoxClient,VBoxControl} for i in sbin/VBoxService bin/{VBoxClient,VBoxControl}
do do
${if stdenv.system == "i686-linux" then '' ${if stdenv.system == "i686-linux" then ''
patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux.so.2 $i patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux.so.2 $i
'' ''
else if stdenv.system == "x86_64-linux" then '' else if stdenv.system == "x86_64-linux" then ''
patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 $i patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 $i
'' ''
else throw ("Architecture: "+stdenv.system+" not supported for VirtualBox guest additions") else throw ("Architecture: "+stdenv.system+" not supported for VirtualBox guest additions")
} }
done done
# Change rpath for various binaries and libraries # Change rpath for various binaries and libraries
@ -72,11 +72,11 @@ stdenv.mkDerivation {
do do
patchelf --set-rpath $out/lib $i patchelf --set-rpath $out/lib $i
done done
# Remove references to /usr from various scripts and files # Remove references to /usr from various scripts and files
sed -i -e "s|/usr/bin|$out/bin|" share/VBoxGuestAdditions/vboxclient.desktop sed -i -e "s|/usr/bin|$out/bin|" share/VBoxGuestAdditions/vboxclient.desktop
sed -i -e "s|/usr/bin|$out/bin|" bin/VBoxClient-all sed -i -e "s|/usr/bin|$out/bin|" bin/VBoxClient-all
# Install binaries # Install binaries
mkdir -p $out/sbin mkdir -p $out/sbin
install -m 755 sbin/VBoxService $out/sbin install -m 755 sbin/VBoxService $out/sbin
@ -94,7 +94,7 @@ stdenv.mkDerivation {
cp -v lib/VBoxOGL*.so $out/lib cp -v lib/VBoxOGL*.so $out/lib
mkdir -p $out/lib/dri mkdir -p $out/lib/dri
ln -s $out/lib/VBoxOGL.so $out/lib/dri/vboxvideo_dri.so ln -s $out/lib/VBoxOGL.so $out/lib/dri/vboxvideo_dri.so
# Install desktop file # Install desktop file
mkdir -p $out/share/autostart mkdir -p $out/share/autostart
cp -v share/VBoxGuestAdditions/vboxclient.desktop $out/share/autostart cp -v share/VBoxGuestAdditions/vboxclient.desktop $out/share/autostart
@ -103,23 +103,23 @@ stdenv.mkDerivation {
mkdir -p $out/lib/xorg/modules/{drivers,input} mkdir -p $out/lib/xorg/modules/{drivers,input}
install -m 644 lib/VBoxGuestAdditions/vboxvideo_drv_19.so $out/lib/xorg/modules/drivers/vboxvideo_drv.so install -m 644 lib/VBoxGuestAdditions/vboxvideo_drv_19.so $out/lib/xorg/modules/drivers/vboxvideo_drv.so
# There doesn't appear to be a vboxmouse driver for Xorg 1.9. Was there ever? # There doesn't appear to be a vboxmouse driver for Xorg 1.9. Was there ever?
# install -m 644 lib/VBoxGuestAdditions/vboxmouse_drv_19.so $out/lib/xorg/modules/input/vboxmouse_drv.so #install -m 644 lib/VBoxGuestAdditions/vboxmouse_drv_19.so $out/lib/xorg/modules/input/vboxmouse_drv.so
# Install kernel modules # Install kernel modules
cd src cd src
for i in * for i in *
do do
cd $i cd $i
kernelVersion=$(cd ${kernel}/lib/modules; ls) kernelVersion=$(cd ${kernel}/lib/modules; ls)
export MODULE_DIR=$out/lib/modules/$kernelVersion/misc export MODULE_DIR=$out/lib/modules/$kernelVersion/misc
find . -type f | xargs sed -i -e "s|-o root||g" \ find . -type f | xargs sed -i -e "s|-o root||g" \
-e "s|-g root||g" -e "s|-g root||g"
make install make install
cd .. cd ..
done done
''; ''; # */
meta = { meta = {
description = "Guest additions for VirtualBox"; description = "Guest additions for VirtualBox";
longDescriptions = '' longDescriptions = ''
@ -129,5 +129,6 @@ stdenv.mkDerivation {
''; '';
license = "GPL"; license = "GPL";
maintainers = [ lib.maintainers.sander ]; maintainers = [ lib.maintainers.sander ];
platforms = lib.platforms.linux;
}; };
} }