mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 05:31:22 +00:00
* VirtualBox updated to 4.1.10. Drop the wrapper script since it no
longer seems needed. Optionally build the Python bindings. Disable the Java bindings by default to prevent a gratuitous dependency on the JDK. svn path=/nixpkgs/trunk/; revision=33295
This commit is contained in:
parent
995a44a897
commit
bd8d003d69
|
@ -1,66 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
INSTALL_PATH="@INSTALL_PATH@"
|
||||
export LD_LIBRARY_PATH="@INSTALL_PATH@:@QT4_PATH@"
|
||||
|
||||
export USER=$(whoami)
|
||||
|
||||
if [ ! -c /dev/vboxdrv ]; then
|
||||
echo "/dev/vboxdrv does not exist. Load the kernel module then try again."
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -r /dev/vboxdrv -o ! -w /dev/vboxdrv ]; then
|
||||
echo "User $USER can not read and/or write to /dev/vboxdrv."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "/dev/vboxdrv exists and $USER can access it."
|
||||
|
||||
SERVER_PID=$(ps -U $USER | grep VBoxSVC | awk '{ print $1 }')
|
||||
if [ "$1" = "shutdown" ]; then
|
||||
if [ -n "$SERVER_PID" ]; then
|
||||
echo "Terminating VBoxSVC with PID $SERVER_PID."
|
||||
kill -TERM $SERVER_PID
|
||||
else
|
||||
echo "VBoxSVC Not Currently Running."
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -x "$INSTALL_PATH/VBoxSVC" ]; then
|
||||
echo "$INSTALL_PATH/VBoxSVC does not exist! Can not continue."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
APP=$(which $0)
|
||||
APP=${APP##/*/}
|
||||
|
||||
if [ ! -x "$INSTALL_PATH/$APP" ]; then
|
||||
echo "$INSTALL_PATH/$APP does not exist!"
|
||||
exit 1
|
||||
fi
|
||||
case "$APP" in
|
||||
VirtualBox|VBoxManage|VBoxSDL|VBoxVRDP)
|
||||
EXEC_APP="$INSTALL_PATH/$APP"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown application - $APP."
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$SERVER_PID" ]; then
|
||||
rm -rf /tmp/.vbox-$USER-ipc
|
||||
echo "Starting VBoxSVC for $USER."
|
||||
"$INSTALL_PATH/VBoxSVC" --daemonize
|
||||
fi
|
||||
|
||||
SERVER_PID=$(ps -U $USER | grep VBoxSVC | awk '{ print $1 }')
|
||||
if [ -z "$SERVER_PID" ]; then
|
||||
echo "VBoxSVC failed to start! Can not continue"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "VBoxSVC is running for user $USER with PID $SERVER_PID."
|
||||
|
||||
echo "Starting $EXEC_APP."
|
||||
exec "$EXEC_APP" "$@"
|
|
@ -1,30 +1,36 @@
|
|||
{ stdenv, fetchurl, lib, iasl, dev86, pam, libxslt, libxml2, libX11, xproto, libXext
|
||||
, libXcursor, libXmu, qt4, libIDL, SDL, libcap, zlib, libpng, glib, kernel
|
||||
, python, which, alsaLib, curl, gawk
|
||||
, xorriso, makeself, perl, jdk, pkgconfig
|
||||
, which, alsaLib, curl, gawk
|
||||
, xorriso, makeself, perl, pkgconfig
|
||||
, javaBindings ? false, jdk ? null
|
||||
, pythonBindings ? false, python ? null
|
||||
}:
|
||||
|
||||
let version = "4.1.8"; in
|
||||
with stdenv.lib;
|
||||
|
||||
let version = "4.1.10"; in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "virtualbox-${version}-${kernel.version}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://download.virtualbox.org/virtualbox/${version}/VirtualBox-${version}.tar.bz2";
|
||||
sha256 = "1q04825ayynzgh8zl6y038lzxp3jk1a3dxpg6f52kk4vkirdc5pg";
|
||||
sha256 = "1gsp3arp79x6gmh403sayh4lzr3l8fc3anp664fyl1dl0ykgmqs7";
|
||||
};
|
||||
|
||||
buildInputs =
|
||||
[ iasl dev86 libxslt libxml2 xproto libX11 libXext libXcursor qt4 libIDL SDL
|
||||
libcap glib kernel python alsaLib curl pam xorriso makeself perl jdk
|
||||
pkgconfig which libXmu
|
||||
];
|
||||
pkgconfig which libXmu ]
|
||||
++ optional javaBindings jdk
|
||||
++ optional pythonBindings python;
|
||||
|
||||
patchPhase = ''
|
||||
set -x
|
||||
MODULES_BUILD_DIR=`echo ${kernel}/lib/modules/*/build`
|
||||
sed -e 's@/lib/modules/`uname -r`/build@'$MODULES_BUILD_DIR@ \
|
||||
-e 's@MKISOFS --version@MKISOFS -version@' \
|
||||
-e 's@PYTHONDIR=.*@PYTHONDIR=${if pythonBindings then python else ""}@' \
|
||||
-i configure
|
||||
ls kBuild/bin/linux.x86/k* tools/linux.x86/bin/* | xargs -n 1 patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux.so.2
|
||||
ls kBuild/bin/linux.amd64/k* tools/linux.amd64/bin/* | xargs -n 1 patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2
|
||||
|
@ -34,7 +40,11 @@ stdenv.mkDerivation {
|
|||
'';
|
||||
|
||||
configurePhase = ''
|
||||
./configure --with-qt4-dir=${qt4} --disable-python --disable-pulse --disable-hardening --with-mkisofs=${xorriso}/bin/xorrisofs
|
||||
./configure --with-qt4-dir=${qt4} \
|
||||
${optionalString (!javaBindings) "--disable-java"} \
|
||||
${optionalString (!pythonBindings) "--disable-python"} \
|
||||
--disable-pulse --disable-hardening \
|
||||
--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
|
||||
sed -e 's@arch/x86/@@' \
|
||||
|
@ -63,10 +73,12 @@ stdenv.mkDerivation {
|
|||
'';
|
||||
|
||||
installPhase = ''
|
||||
libexec=$out/libexec/virtualbox
|
||||
|
||||
# Install VirtualBox files
|
||||
cd out/linux.*/release/bin
|
||||
mkdir -p $out/virtualbox
|
||||
cp -av * $out/virtualbox
|
||||
mkdir -p $libexec
|
||||
cp -av * $libexec
|
||||
|
||||
# Install kernel module
|
||||
cd src
|
||||
|
@ -74,8 +86,7 @@ stdenv.mkDerivation {
|
|||
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
|
||||
for i in `find . -name Makefile`; do
|
||||
sed -i -e "s|-o root||g" \
|
||||
-e "s|-g root||g" $i
|
||||
done
|
||||
|
@ -85,22 +96,14 @@ stdenv.mkDerivation {
|
|||
|
||||
# Create wrapper script
|
||||
mkdir -p $out/bin
|
||||
cp -v ${./VBox.sh} $out/bin/VBox.sh
|
||||
sed -i -e "s|@INSTALL_PATH@|$out/virtualbox|" \
|
||||
-e "s|@QT4_PATH@|${qt4}/lib|" \
|
||||
-e "s|which|${which}/bin/which|" \
|
||||
-e "s|awk|${gawk}/bin/awk|" \
|
||||
$out/bin/VBox.sh
|
||||
chmod 755 $out/bin/VBox.sh
|
||||
for file in VirtualBox VBoxManage VBoxSDL
|
||||
do
|
||||
[ -f "$out/virtualbox/$file" ] && ln -sfv $out/bin/VBox.sh $out/bin/$file
|
||||
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=$out/virtualbox/VBox.png|" $out/virtualbox/virtualbox.desktop
|
||||
ln -sfv $out/virtualbox/virtualbox.desktop $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 = {
|
||||
|
|
Loading…
Reference in a new issue