#!/bin/bash # # virtualbox-guest-utils.SlackBuild is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or any later version. # # virtualbox-guest-utils.SlackBuild is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 59 Temple # Place - Suite 330, Boston, MA 02111-1307, USA # # Copyright 2008-2010 Heinz Wiesinger, Amsterdam, The Netherlands # Copyright 2008 Mauro Giachero # default settings PACKAGE="virtualbox-guest-utils" PACKAGE_EXT="bz2" VERSION=${VERSION:=5.0.40} BUILD=${BUILD:=1} if [ -f ~/.slackbuildrc ]; then . ~/.slackbuildrc elif [ -f ../../runtime/slackbuildrc ]; then . ../../runtime/slackbuildrc fi # kmk doesn't support MAKEFLAGS, so we use JOBS here JOBS=${JOBS:-3} check_required # set xorg-server version XSERVER=$(X -version 2>&1 | grep Server | cut -d " " -f 4 | sed "s/\.//" | cut -d "." -f 1) if [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" LIBDIRSUFFIX="" TARGET="x86" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" LIBDIRSUFFIX="" TARGET="x86" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" LIBDIRSUFFIX="64" TARGET="amd64" fi SRC="VirtualBox-${VERSION}.tar.$PACKAGE_EXT" URL="http://download.virtualbox.org/virtualbox/${VERSION}/$SRC" # Download the source if needed. get_source $SRC $URL unpack_source $SRC VirtualBox-${VERSION} # We set the environment variables manually to avoid dependency on acpica export BUILD_PLATFORM="linux" export BUILD_PLATFORM_ARCH="$TARGET" export BUILD_TARGET="linux" export BUILD_TARGET_ARCH="$TARGET" export BUILD_TARGET_CPU="$ARCH" export BUILD_TYPE="release" export PATH_KBUILD="$TMP/VirtualBox-${VERSION}/kBuild" export PATH_DEVTOOLS="$TMP/VirtualBox-${VERSION}/tools" path_kbuild_bin="$PATH_KBUILD/bin/$BUILD_TARGET.$BUILD_PLATFORM_ARCH" export PATH_KBUILD_BIN="$path_kbuild_bin" path_dev_bin="$PATH_DEVTOOLS/$BUILD_TARGET.$BUILD_PLATFORM_ARCH"/bin echo "$PATH" | grep -q "$path_kbuild_bin" || PATH="$path_kbuild_bin:$PATH" echo "$PATH" | grep -q "$path_dev_bin" || PATH="$path_dev_bin:$PATH" export PATH unset path_kbuild_bin path_dev_bin kmk -j ${JOBS} LOCALCFG=$CWD/LocalConfig.kmk || exit 2 # Create directories mkdir -p $PKG/sbin \ $PKG/etc/{xdg/autostart,rc.d,X11} \ $PKG/etc/rc.d/{init.d,rc4.d} \ $PKG/usr/{src,bin,sbin,share/autostart} \ $PKG/usr/lib$LIBDIRSUFFIX/xorg/modules/drivers # SysV init, only runlevel 4 install -m 755 $CWD/virtualbox.init $PKG/etc/rc.d/init.d/vbox-utils cd $PKG/etc/rc.d/rc4.d ln -s ../init.d/vbox-utils S65vbox-utils ln -s ../init.d/vbox-utils K45vbox-utils cd - cp $CWD/xorg.conf-vbox $PKG/etc/X11 cp -f src/VBox/Additions/x11/Installer/vboxclient.desktop $PKG/etc/xdg/autostart/ cp -f src/VBox/Additions/x11/Installer/vboxclient.desktop $PKG/usr/share/autostart/ install -m 755 src/VBox/Additions/x11/Installer/98vboxadd-xclient $PKG/usr/bin/VBoxClient-all cd out/linux.$TARGET/release/bin/additions cp -rf src/vboxguest $PKG/usr/src/vboxguest-$VERSION cp -rf src/vboxsf $PKG/usr/src/vboxsf-$VERSION cp -rf src/vboxvideo $PKG/usr/src/vboxvideo-$VERSION ( cd $PKG/usr tar cvfz $CWD/virtualbox-kernel-$VERSION.tar.gz src/ rm -rf src ) install -m 755 VBoxControl $PKG/usr/bin/ install -m 755 VBoxClient $PKG/usr/bin/ install -m 755 VBoxService $PKG/usr/sbin/ install -m 4755 mount.vboxsf $PKG/sbin/mount.vboxsf install -m 644 vboxvideo_drv_$XSERVER.so $PKG/usr/lib$LIBDIRSUFFIX/xorg/modules/drivers/vboxvideo_drv.so # Recently no more mouse drivers. #install -m 644 vboxmouse_drv_$XSERVER.so $PKG/usr/lib$LIBDIRSUFFIX/xorg/modules/input/vboxmouse_drv.so install -m 644 VBoxOGLcrutil.so $PKG/usr/lib$LIBDIRSUFFIX install -m 644 VBoxOGLerrorspu.so $PKG/usr/lib$LIBDIRSUFFIX install -m 644 VBoxOGLarrayspu.so $PKG/usr/lib$LIBDIRSUFFIX install -m 644 VBoxOGLfeedbackspu.so $PKG/usr/lib$LIBDIRSUFFIX install -m 644 VBoxOGLpackspu.so $PKG/usr/lib$LIBDIRSUFFIX install -m 644 VBoxOGLpassthroughspu.so $PKG/usr/lib$LIBDIRSUFFIX install -m 644 VBoxOGL.so $PKG/usr/lib$LIBDIRSUFFIX mkdir -p $PKG/usr/lib$LIBDIRSUFFIX/xorg/modules/dri ln -s /usr/lib$LIBDIRSUFFIX/VBoxOGL.so $PKG/usr/lib$LIBDIRSUFFIX/xorg/modules/dri/vboxvideo_dri.so cd $TMP/VirtualBox-${VERSION} mkdir -p $DOCS cp -f COPYING COPYING.CDDL $DOCS cat $CWD/README.Slackware > $DOCS/README.Slackware fixup_package $PKG # Clean up the extra stuff: set +u if [ "$1" = "--cleanup" ]; then rm -rf $TMP/$PACKAGE-$VERSION rm -rf $PKG fi