summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app-emulation/virtualbox-bin/Manifest4
-rw-r--r--app-emulation/virtualbox-bin/files/10-virtualbox.rules7
-rw-r--r--app-emulation/virtualbox-bin/files/vboxwebsrv-confd20
-rw-r--r--app-emulation/virtualbox-bin/files/vboxwebsrv-initd24
-rw-r--r--app-emulation/virtualbox-bin/files/virtualbox-bin-3-wrapper104
-rw-r--r--app-emulation/virtualbox-bin/files/virtualbox-bin-config1
-rw-r--r--app-emulation/virtualbox-bin/files/virtualbox-bin.desktop-28
-rw-r--r--app-emulation/virtualbox-bin/metadata.xml19
-rw-r--r--app-emulation/virtualbox-bin/virtualbox-bin-5.1.8.111374.ebuild288
-rw-r--r--app-emulation/virtualbox-guest-additions/Manifest1
-rw-r--r--app-emulation/virtualbox-guest-additions/files/vboxclient.desktop7
-rw-r--r--app-emulation/virtualbox-guest-additions/files/vboxguest-4.1.0-log-use-c99.patch13
-rw-r--r--app-emulation/virtualbox-guest-additions/files/virtualbox-guest-additions-5-localconfig30
-rw-r--r--app-emulation/virtualbox-guest-additions/files/virtualbox-guest-additions-8.initd26
-rw-r--r--app-emulation/virtualbox-guest-additions/files/virtualbox-guest-additions.service16
-rw-r--r--app-emulation/virtualbox-guest-additions/files/xorg.conf.vbox13
-rw-r--r--app-emulation/virtualbox-guest-additions/virtualbox-guest-additions-5.1.8.ebuild218
-rw-r--r--app-emulation/virtualbox-modules/Manifest1
-rwxr-xr-xapp-emulation/virtualbox-modules/files/create_vbox_modules_tarball.sh29
-rw-r--r--app-emulation/virtualbox-modules/files/virtualbox-modules-4.1.4-pax-const.patch48
-rw-r--r--app-emulation/virtualbox-modules/files/virtualbox.conf4
-rw-r--r--app-emulation/virtualbox-modules/virtualbox-modules-5.1.8.ebuild65
-rw-r--r--x11-drivers/xf86-video-virtualbox/Manifest1
-rw-r--r--x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-2.2.0-enable-opengl.patch13
-rw-r--r--x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-5-localconfig30
-rw-r--r--x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-5.0.0_beta3-configure_checks.patch52
-rw-r--r--x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-5.1.4-Makefile.module.kms.patch11
-rw-r--r--x11-drivers/xf86-video-virtualbox/xf86-video-virtualbox-5.1.8.ebuild220
28 files changed, 1273 insertions, 0 deletions
diff --git a/app-emulation/virtualbox-bin/Manifest b/app-emulation/virtualbox-bin/Manifest
new file mode 100644
index 00000000..82466ac2
--- /dev/null
+++ b/app-emulation/virtualbox-bin/Manifest
@@ -0,0 +1,4 @@
+DIST Oracle_VM_VirtualBox_Extension_Pack-5.1.8-111374.tar.gz 19457682 SHA256 d28bcd01c14eb07eedd2b964d1abe4876f0a7e0e89530e7ba285a5d6267bf322 SHA512 8539c4cb60b672a06b0f87763686af7f8b8a125ad02b7d30c76da17399aa95455bf9d7c5105072ff5b973fac89d09b7c21698dcf46779bfc1a306d524c1be5ef WHIRLPOOL 61b9f4a69629e8c75dcb86fccd2168d312a0a2e31ea5e51fd80dc0f7601508bc40510422bbaeb30a82fa76e19d87f6221eaafdeedcf1a20f0e902571749a70a0
+DIST VirtualBox-5.1.8-111374-Linux_amd64.run 87315922 SHA256 8913839928fb219a537618a839a0ae3b1aeae04a7888f6d52bfb6f2959c43ca5 SHA512 789ef674b45509ce35ba4ade54e02022ecb7d7869c7164a1011b45ced325e11575e3200cf1f8c36835541cca3278d574a8f428a967b2c8e3cbe1c9b8ea77d355 WHIRLPOOL 9c6174e7519dd9c4cf6f3698aeaf03a17140bd75e0be3c473603b199254bc7e35da4a72060ae67fb26bc63af0035942fe4485a1f23a3227c2c4020a9ec8985b5
+DIST VirtualBox-5.1.8-111374-Linux_x86.run 86414797 SHA256 04a54028abff7c24369a04c5fa0e7e02fe35fe7670a2252ee1f24f97636c7265 SHA512 2483e833fa7548d29f25bfdfdbb72497b8164f59c0de3add55b3bcfa76d716763984d0b8d27dac41e5a9f3f345366cbc87cc156143eccd8c9d0b5359671bf91d WHIRLPOOL 3bd0334249b08038052925b46cce4f9a32bcd25d7f6740ff659a9c1155a3a9f3f04588fd67ea2a2757009591d5b4a2e598668deceaf3253daca42f66a494b06b
+DIST VirtualBoxSDK-5.1.8-111374.zip 9860397 SHA256 62848668bf749e991edc21bd310e18684c13466b3322fe0921fe5ced4000bf84 SHA512 5b36922ec020487e8e16d97f1b3ff2fc40586224b779c600607136eb4eccdd2992618edc35bb9b12495d8ee894315c8ba08f3747b2a6d5b6edb0915629d3f005 WHIRLPOOL 4e22f955768b12ddc0b577b062e1cadbd50c9b2f34bb680c9c75d7acd3407b5f63d52f8ee3c0411aa5f34fd490d07cfeb0d5cb4063352fed4c643de1bdb8924f
diff --git a/app-emulation/virtualbox-bin/files/10-virtualbox.rules b/app-emulation/virtualbox-bin/files/10-virtualbox.rules
new file mode 100644
index 00000000..014c164a
--- /dev/null
+++ b/app-emulation/virtualbox-bin/files/10-virtualbox.rules
@@ -0,0 +1,7 @@
+# create second tree of USB devices according to
+# http://www.virtualbox.org/ticket/7759#comment:5
+
+SUBSYSTEM=="usb_device", ACTION!="remove", RUN="%UDEVDIR%/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}"
+SUBSYSTEM=="usb", ACTION!="remove", ENV{DEVTYPE}=="usb_device", RUN="%UDEVDIR%/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}"
+SUBSYSTEM=="usb_device", ACTION=="remove", RUN="%UDEVDIR%/VBoxCreateUSBNode.sh --remove $major $minor"
+SUBSYSTEM=="usb", ACTION=="remove", ENV{DEVTYPE}=="usb_device", RUN="%UDEVDIR%/VBoxCreateUSBNode.sh --remove $major $minor"
diff --git a/app-emulation/virtualbox-bin/files/vboxwebsrv-confd b/app-emulation/virtualbox-bin/files/vboxwebsrv-confd
new file mode 100644
index 00000000..14ce08c7
--- /dev/null
+++ b/app-emulation/virtualbox-bin/files/vboxwebsrv-confd
@@ -0,0 +1,20 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# The host to bind to (defaults to "localhost").
+VBOXWEBSRV_HOST="localhost"
+
+# Which port to on the host (defaults to 18083).
+VBOXWEBSRV_PORT="18083"
+
+# Session timeout, in seconds. (defaults to 20).
+VBOXWEBSRV_TIMEOUT=20
+
+# The interval in which the webservice checks for
+# timed-out clients, in seconds. Normally does not
+# need to be changed (defaults to 5).
+VBOXWEBSRV_INTERVAL=5
+
+# User under which vboxwebsrv is running
+VBOXWEBSRV_USER="root"
diff --git a/app-emulation/virtualbox-bin/files/vboxwebsrv-initd b/app-emulation/virtualbox-bin/files/vboxwebsrv-initd
new file mode 100644
index 00000000..28d1ec07
--- /dev/null
+++ b/app-emulation/virtualbox-bin/files/vboxwebsrv-initd
@@ -0,0 +1,24 @@
+#!/sbin/openrc-run
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+depend() {
+ need net
+}
+
+start() {
+ #checkconfig || return $?
+
+ ebegin "Starting VirtualBox WebService"
+ start-stop-daemon --start --quiet --user ${VBOXWEBSRV_USER} --pidfile /var/run/vboxwebsrv.pid \
+ --background --make-pidfile --exec /opt/bin/vboxwebsrv \
+ -- -H ${VBOXWEBSRV_HOST} -p ${VBOXWEBSRV_PORT} -t ${VBOXWEBSRV_TIMEOUT} -i ${VBOXWEBSRV_INTERVAL}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping VirtualBox WebService"
+ start-stop-daemon --stop --user ${VBOXWEBSRV_USER} --quiet --pidfile /var/run/vboxwebsrv.pid
+ eend $?
+}
diff --git a/app-emulation/virtualbox-bin/files/virtualbox-bin-3-wrapper b/app-emulation/virtualbox-bin/files/virtualbox-bin-3-wrapper
new file mode 100644
index 00000000..6f2da490
--- /dev/null
+++ b/app-emulation/virtualbox-bin/files/virtualbox-bin-3-wrapper
@@ -0,0 +1,104 @@
+#!/bin/sh
+#
+# Sun VirtualBox
+#
+# Copyright (C) 2006-2009 Sun Microsystems, Inc.
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
+# Clara, CA 95054 USA or visit http://www.sun.com if you need
+# additional information or have any questions.
+#
+
+PATH="/usr/bin:/bin:/usr/sbin:/sbin"
+CONFIG="/etc/vbox/vbox.cfg"
+
+if [ ! -r "$CONFIG" ]; then
+ echo "Could not find VirtualBox installation. Please reinstall."
+ exit 1
+fi
+
+. "$CONFIG"
+
+# Note: This script must not fail if the module was not successfully installed
+# because the user might not want to run a VM but only change VM params!
+
+if [ "$1" = "shutdown" ]; then
+ SHUTDOWN="true"
+elif ! lsmod|grep -q vboxdrv; then
+ cat << EOF
+WARNING: The VirtualBox kernel modules are not loaded.
+ Please load all the needed kernel modules by:
+
+ for m in vbox{drv,netadp,netflt}; do modprobe \$m; done
+
+ You will not be able to start VMs until this problem is fixed.
+EOF
+elif [ ! -c /dev/vboxdrv ]; then
+ cat << EOF
+WARNING: The character device /dev/vboxdrv does not exist.
+ Please try to reload all the needed kernel modules by:
+
+ for m in vbox{netflt,netadp,drv}; do rmmod \$m; done
+ for m in vbox{drv,netadp,netflt}; do modprobe \$m; done
+
+ and if that is not successful, try to re-install the package by:
+
+ emerge -1av app-emulation/virtualbox-modules
+
+ You will not be able to start VMs until this problem is fixed.
+EOF
+fi
+
+SERVER_PID=`ps -U \`whoami\` | grep VBoxSVC | awk '{ print $1 }'`
+if [ -z "$SERVER_PID" ]; then
+ # Server not running yet/anymore, cleanup socket path.
+ # See IPC_GetDefaultSocketPath()!
+ if [ -n "$LOGNAME" ]; then
+ rm -rf /tmp/.vbox-$LOGNAME-ipc > /dev/null 2>&1
+ else
+ rm -rf /tmp/.vbox-$USER-ipc > /dev/null 2>&1
+ fi
+fi
+
+if [ "$SHUTDOWN" = "true" ]; then
+ if [ -n "$SERVER_PID" ]; then
+ kill -TERM $SERVER_PID
+ sleep 2
+ fi
+ exit 0
+fi
+
+APP=`which $0`
+APP=`basename $APP`
+APP=${APP##/*/}
+case "$APP" in
+ VirtualBox)
+ exec "$INSTALL_DIR/VirtualBox" "$@"
+ ;;
+ VBoxManage)
+ exec "$INSTALL_DIR/VBoxManage" "$@"
+ ;;
+ VBoxSDL)
+ exec "$INSTALL_DIR/VBoxSDL" "$@"
+ ;;
+ VBoxVRDP)
+ exec "$INSTALL_DIR/VBoxHeadless" "$@"
+ ;;
+ VBoxHeadless)
+ exec "$INSTALL_DIR/VBoxHeadless" "$@"
+ ;;
+ vboxwebsrv)
+ exec "$INSTALL_DIR/vboxwebsrv" "$@"
+ ;;
+ *)
+ echo "Unknown application - $APP"
+ ;;
+esac
diff --git a/app-emulation/virtualbox-bin/files/virtualbox-bin-config b/app-emulation/virtualbox-bin/files/virtualbox-bin-config
new file mode 100644
index 00000000..f69e73e2
--- /dev/null
+++ b/app-emulation/virtualbox-bin/files/virtualbox-bin-config
@@ -0,0 +1 @@
+INSTALL_DIR=/opt/VirtualBox
diff --git a/app-emulation/virtualbox-bin/files/virtualbox-bin.desktop-2 b/app-emulation/virtualbox-bin/files/virtualbox-bin.desktop-2
new file mode 100644
index 00000000..112e8f81
--- /dev/null
+++ b/app-emulation/virtualbox-bin/files/virtualbox-bin.desktop-2
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Name=Oracle xVM VirtualBox
+Type=Application
+Comment=Run several virtual systems on a single host computer
+Exec=VirtualBox
+TryExec=VirtualBox
+Icon=virtualbox-bin
+Categories=System;Emulator;
diff --git a/app-emulation/virtualbox-bin/metadata.xml b/app-emulation/virtualbox-bin/metadata.xml
new file mode 100644
index 00000000..02386d4b
--- /dev/null
+++ b/app-emulation/virtualbox-bin/metadata.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>masterzorag@gmail.com</email>
+ </maintainer>
+ <maintainer type="project">
+ <email>proxy-maint@gentoo.org</email>
+ <name>Proxy Maintainers</name>
+ </maintainer>
+ <use>
+ <flag name="additions">Install Guest System Tools ISO</flag>
+ <flag name="chm">Install kchmviewer binary to enable online help (in MS CHM format)</flag>
+ <flag name="headless">Install without any graphic frontend</flag>
+ <flag name="sdk">Enable building of SDK</flag>
+ <flag name="vboxwebsrv">Install the VirtualBox webservice</flag>
+ <flag name="rdesktop-vrdp">Install the rdesktop client integration</flag>
+ </use>
+</pkgmetadata>
diff --git a/app-emulation/virtualbox-bin/virtualbox-bin-5.1.8.111374.ebuild b/app-emulation/virtualbox-bin/virtualbox-bin-5.1.8.111374.ebuild
new file mode 100644
index 00000000..0c5a7815
--- /dev/null
+++ b/app-emulation/virtualbox-bin/virtualbox-bin-5.1.8.111374.ebuild
@@ -0,0 +1,288 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit eutils fdo-mime gnome2 pax-utils python-r1 udev unpacker versionator
+
+MAIN_PV="$(get_version_component_range 1-3)"
+if [[ ${PV} = *_beta* ]] || [[ ${PV} = *_rc* ]] ; then
+ MY_PV="${MAIN_PV}_$(get_version_component_range 5)"
+ MY_PV="${MY_PV/beta/BETA}"
+ MY_PV="${MY_PV/rc/RC}"
+else
+ MY_PV="${MAIN_PV}"
+fi
+VBOX_BUILD_ID="$(get_version_component_range 4)"
+VBOX_PV="${MY_PV}-${VBOX_BUILD_ID}"
+MY_P="VirtualBox-${VBOX_PV}-Linux"
+# needed as sometimes the extpack gets another build ID
+EXTP_PV="${VBOX_PV}"
+EXTP_PN="Oracle_VM_VirtualBox_Extension_Pack"
+EXTP_P="${EXTP_PN}-${EXTP_PV}"
+# needed as sometimes the SDK gets another build ID
+SDK_PV="${VBOX_PV}"
+SDK_P="VirtualBoxSDK-${SDK_PV}"
+
+DESCRIPTION="Family of powerful x86 virtualization products for enterprise as well as home use"
+HOMEPAGE="http://www.virtualbox.org/"
+SRC_URI="amd64? ( http://download.virtualbox.org/virtualbox/${MY_PV}/${MY_P}_amd64.run )
+ x86? ( http://download.virtualbox.org/virtualbox/${MY_PV}/${MY_P}_x86.run )
+ http://download.virtualbox.org/virtualbox/${MY_PV}/${EXTP_P}.vbox-extpack -> ${EXTP_P}.tar.gz"
+
+LICENSE="GPL-2 PUEL"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+additions +chm headless python vboxwebsrv rdesktop-vrdp"
+RESTRICT="mirror"
+
+if [[ "${PV}" != *beta* ]] ; then
+ SRC_URI+="
+ sdk? ( http://download.virtualbox.org/virtualbox/${MY_PV}/${SDK_P}.zip )"
+ IUSE+=" sdk"
+fi
+
+DEPEND="app-arch/unzip
+ ${PYTHON_DEPS}"
+
+RDEPEND="!!app-emulation/virtualbox
+ !app-emulation/virtualbox-additions
+ ~app-emulation/virtualbox-modules-${MAIN_PV}
+ !headless? (
+ dev-libs/glib
+ media-libs/fontconfig
+ media-libs/freetype
+ media-libs/libpng
+ media-libs/libsdl[X]
+ x11-libs/libXcursor
+ x11-libs/libXext
+ x11-libs/libXfixes
+ x11-libs/libXft
+ x11-libs/libXi
+ x11-libs/libXinerama
+ x11-libs/libXrandr
+ x11-libs/libXrender
+ chm? ( dev-libs/expat )
+ )
+ dev-libs/libxml2
+ sys-fs/lvm2
+ x11-libs/libXau
+ x11-libs/libX11
+ x11-libs/libXt
+ x11-libs/libXmu
+ x11-libs/libSM
+ x11-libs/libICE
+ x11-libs/libXdmcp
+ ${PYTHON_DEPS}"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+S=${WORKDIR}
+
+QA_PREBUILT="opt/VirtualBox/*"
+
+PYTHON_UPDATER_IGNORE="1"
+
+src_unpack() {
+ unpack_makeself ${MY_P}_${ARCH}.run
+ unpack ./VirtualBox.tar.bz2
+
+ mkdir "${S}"/${EXTP_PN} || die
+ pushd "${S}"/${EXTP_PN} &>/dev/null || die
+ unpack ${EXTP_P}.tar.gz
+ popd &>/dev/null || die
+
+ if [[ "${PV}" != *beta* ]] && use sdk ; then
+ unpack VirtualBoxSDK-${SDK_PV}.zip
+ fi
+}
+
+src_configure() {
+ :;
+}
+
+src_compile() {
+ :;
+}
+
+src_install() {
+ # create virtualbox configurations files
+ insinto /etc/vbox
+ newins "${FILESDIR}/${PN}-config" vbox.cfg
+
+ if ! use headless ; then
+ newmenu "${FILESDIR}"/${PN}.desktop-2 ${PN}.desktop
+
+ # set up symlinks (bug #572012)
+ dosym /opt/VirtualBox/virtualbox.xml /usr/share/mime/packages/virtualbox.xml
+
+ local size ico icofile
+ for size in 16 24 32 48 64 72 96 128 256 ; do
+ pushd "${S}"/icons/${size}x${size} &>/dev/null || die
+ if [[ -f "virtualbox.png" ]] ; then
+ doicon -s ${size} virtualbox.png
+ fi
+ for ico in hdd ova ovf vbox{,-extpack} vdi vdh vmdk ; do
+ icofile="virtualbox-${ico}.png"
+ if [[ -f "${icofile}" ]] ; then
+ doicon -s ${size} ${icofile}
+ fi
+ done
+ popd &>/dev/null || die
+ done
+ doicon -s scalable "${S}"/icons/scalable/virtualbox.svg
+ insinto /usr/share/pixmaps
+ newins "${S}"/icons/48x48/virtualbox.png ${PN}.png
+ fi
+
+ pushd "${S}"/${EXTP_PN} &>/dev/null || die
+ insinto /opt/VirtualBox/ExtensionPacks/${EXTP_PN}
+ doins -r linux.${ARCH}
+ doins ExtPack* PXE-Intel.rom
+ popd &>/dev/null || die
+ rm -rf "${S}"/${EXTP_PN}
+
+ insinto /opt/VirtualBox
+ dodir /opt/bin
+
+ doins UserManual.pdf
+
+ if [[ "${PV}" != *beta* ]] && use sdk ; then
+ doins -r sdk
+ fi
+
+ if use additions; then
+ doins -r additions
+ fi
+
+ if use vboxwebsrv; then
+ doins vboxwebsrv
+ fowners root:vboxusers /opt/VirtualBox/vboxwebsrv
+ fperms 0750 /opt/VirtualBox/vboxwebsrv
+ dosym /opt/VirtualBox/VBox.sh /opt/bin/vboxwebsrv
+ newinitd "${FILESDIR}"/vboxwebsrv-initd vboxwebsrv
+ newconfd "${FILESDIR}"/vboxwebsrv-confd vboxwebsrv
+ fi
+
+ if use rdesktop-vrdp; then
+ doins rdesktop-vrdp
+ doins -r rdesktop-vrdp-keymaps
+ fperms 0750 /opt/VirtualBox/rdesktop-vrdp
+ dosym /opt/VirtualBox/rdesktop-vrdp /opt/bin/rdesktop-vrdp
+ fi
+
+ if ! use headless && use chm; then
+ doins kchmviewer VirtualBox.chm
+ fowners root:vboxusers /opt/VirtualBox/kchmviewer
+ fperms 0750 /opt/VirtualBox/kchmviewer
+ fi
+
+ # This ebuild / package supports only py2.7. When py3 comes is unknown.
+ # The compile phase makes VBoxPython2_7.so.
+ # py3 support would presumably require a binary pre-compiled by py3.
+ use python && doins VBoxPython.so VBoxPython2_7.so
+
+ rm -rf src rdesktop* deffiles install* routines.sh runlevel.sh \
+ vboxdrv.sh VBox.sh VBox.png vboxnet.sh additions VirtualBox.desktop \
+ VirtualBox.tar.bz2 LICENSE VBoxSysInfo.sh rdesktop* vboxwebsrv \
+ webtest kchmviewer VirtualBox.chm vbox-create-usb-node.sh \
+ 90-vbox-usb.fdi uninstall.sh vboxshell.py vboxdrv-pardus.py \
+ VBoxPython?_*.so
+
+ if use headless ; then
+ rm -rf VBoxSDL VirtualBox VBoxKeyboard.so
+ fi
+
+ doins -r * || die
+
+ # create symlinks for working around unsupported $ORIGIN/.. in VBoxC.so (setuid)
+ dosym /opt/VirtualBox/VBoxVMM.so /opt/VirtualBox/components/VBoxVMM.so
+ dosym /opt/VirtualBox/VBoxREM.so /opt/VirtualBox/components/VBoxREM.so
+ dosym /opt/VirtualBox/VBoxRT.so /opt/VirtualBox/components/VBoxRT.so
+ dosym /opt/VirtualBox/VBoxDDU.so /opt/VirtualBox/components/VBoxDDU.so
+ dosym /opt/VirtualBox/VBoxXPCOM.so /opt/VirtualBox/components/VBoxXPCOM.so
+
+ local each
+ for each in VBox{Manage,SVC,XPCOMIPCD,Tunctl,NetAdpCtl,NetDHCP,NetNAT,TestOGL,ExtPackHelperApp}; do
+ fowners root:vboxusers /opt/VirtualBox/${each}
+ fperms 0750 /opt/VirtualBox/${each}
+ pax-mark -m "${D}"/opt/VirtualBox/${each}
+ done
+ # VBoxNetAdpCtl and VBoxNetDHCP binaries need to be suid root in any case..
+ fperms 4750 /opt/VirtualBox/VBoxNetAdpCtl
+ fperms 4750 /opt/VirtualBox/VBoxNetDHCP
+ fperms 4750 /opt/VirtualBox/VBoxNetNAT
+
+ if ! use headless ; then
+ # Hardened build: Mark selected binaries set-user-ID-on-execution
+ for each in VBox{SDL,Headless} VirtualBox; do
+ fowners root:vboxusers /opt/VirtualBox/${each}
+ fperms 4510 /opt/VirtualBox/${each}
+ pax-mark -m "${D}"/opt/VirtualBox/${each}
+ done
+
+ dosym /opt/VirtualBox/VBox.sh /opt/bin/VirtualBox
+ dosym /opt/VirtualBox/VBox.sh /opt/bin/VBoxSDL
+ else
+ # Hardened build: Mark selected binaries set-user-ID-on-execution
+ fowners root:vboxusers /opt/VirtualBox/VBoxHeadless
+ fperms 4510 /opt/VirtualBox/VBoxHeadless
+ pax-mark -m "${D}"/opt/VirtualBox/VBoxHeadless
+ fi
+
+ exeinto /opt/VirtualBox
+ newexe "${FILESDIR}/${PN}-3-wrapper" "VBox.sh"
+ fowners root:vboxusers /opt/VirtualBox/VBox.sh
+ fperms 0750 /opt/VirtualBox/VBox.sh
+
+ dosym /opt/VirtualBox/VBox.sh /opt/bin/VBoxManage
+ dosym /opt/VirtualBox/VBox.sh /opt/bin/VBoxVRDP
+ dosym /opt/VirtualBox/VBox.sh /opt/bin/VBoxHeadless
+ dosym /opt/VirtualBox/VBoxTunctl /opt/bin/VBoxTunctl
+
+ # set an env-variable for 3rd party tools
+ echo -n "VBOX_APP_HOME=/opt/VirtualBox" > "${T}/90virtualbox"
+ doenvd "${T}/90virtualbox"
+
+ local udevdir="$(get_udevdir)"
+ insinto ${udevdir}/rules.d
+ doins "${FILESDIR}"/10-virtualbox.rules
+ sed "s@%UDEVDIR%@${udevdir}@" \
+ -i "${D}"${udevdir}/rules.d/10-virtualbox.rules || die
+ # move udev scripts into ${udevdir} (bug #372491)
+ mv "${D}"/opt/VirtualBox/VBoxCreateUSBNode.sh "${D}"${udevdir} || die
+ fperms 0750 ${udevdir}/VBoxCreateUSBNode.sh
+}
+
+pkg_postinst() {
+ fdo-mime_desktop_database_update
+
+ gnome2_icon_cache_update
+
+ udevadm control --reload-rules && udevadm trigger --subsystem-match=usb
+
+ elog ""
+ if ! use headless ; then
+ elog "To launch VirtualBox just type: \"VirtualBox\""
+ elog ""
+ fi
+ elog "You must be in the vboxusers group to use VirtualBox."
+ elog ""
+ elog "For advanced networking setups you should emerge:"
+ elog "net-misc/bridge-utils and sys-apps/usermode-utilities"
+ elog ""
+ elog "Please visit http://www.virtualbox.org/wiki/Editions for"
+ elog "an overview about the different features of ${PN}"
+ elog "and virtualbox-ose"
+ if [ -e "${ROOT}/etc/udev/rules.d/10-virtualbox.rules" ] ; then
+ elog ""
+ elog "Please remove \"${ROOT}/etc/udev/rules.d/10-virtualbox.rules\""
+ elog "or else USB in ${PN} won't work."
+ fi
+}
+
+pkg_postrm() {
+ fdo-mime_desktop_database_update
+}
diff --git a/app-emulation/virtualbox-guest-additions/Manifest b/app-emulation/virtualbox-guest-additions/Manifest
new file mode 100644
index 00000000..c8bd71b8
--- /dev/null
+++ b/app-emulation/virtualbox-guest-additions/Manifest
@@ -0,0 +1 @@
+DIST VirtualBox-5.1.8.tar.bz2 114688166 SHA256 e447031de468aee746529b2cf60768922f9beff22a13c54284aa430f5e925933 SHA512 178299173ee0062e23aee779faa893a42815d17163eab9ba2ed8b46be63a7110fe1690792de21514dc05ccd5a1752ea0f11357220e0e6f91f101dea3416e819c WHIRLPOOL 20ea8d253d177fd11c4349656aaa0f87f0fb76018511b345e85800d4dd8ab1e2e05c300a1f932670e5f5fac6ea547bfaa0a52b8526c4f363358911c770444a81
diff --git a/app-emulation/virtualbox-guest-additions/files/vboxclient.desktop b/app-emulation/virtualbox-guest-additions/files/vboxclient.desktop
new file mode 100644
index 00000000..316eb9f6
--- /dev/null
+++ b/app-emulation/virtualbox-guest-additions/files/vboxclient.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Type=Application
+Name=VirtualBox Client Service
+Exec=VBoxClient-all
+Terminal=false
+X-KDE-StartupNotify=false
+StartupNotify=false
diff --git a/app-emulation/virtualbox-guest-additions/files/vboxguest-4.1.0-log-use-c99.patch b/app-emulation/virtualbox-guest-additions/files/vboxguest-4.1.0-log-use-c99.patch
new file mode 100644
index 00000000..8f66a003
--- /dev/null
+++ b/app-emulation/virtualbox-guest-additions/files/vboxguest-4.1.0-log-use-c99.patch
@@ -0,0 +1,13 @@
+# https://bugs.gentoo.org/298988
+
+--- a/vboxguest/Makefile
++++ b/vboxguest/Makefile
+@@ -104,7 +104,7 @@
+
+ MOD_DEFS = -DVBOX -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_GUEST \
+ -DIN_GUEST_R0 -DIN_MODULE -DRT_WITH_VBOX -DVBGL_VBOXGUEST \
+- -DVBOX_WITH_HGCM
++ -DVBOX_WITH_HGCM -DLOG_USE_C99
+ ifeq ($(BUILD_TARGET_ARCH),amd64)
+ MOD_DEFS += -DRT_ARCH_AMD64
+ else
diff --git a/app-emulation/virtualbox-guest-additions/files/virtualbox-guest-additions-5-localconfig b/app-emulation/virtualbox-guest-additions/files/virtualbox-guest-additions-5-localconfig
new file mode 100644
index 00000000..f04dab4d
--- /dev/null
+++ b/app-emulation/virtualbox-guest-additions/files/virtualbox-guest-additions-5-localconfig
@@ -0,0 +1,30 @@
+# -*- Makefile -*-
+#
+# Overwrite some default kBuild settings
+#
+
+#
+# Copyright (C) 2006-2008 Sun Microsystems, Inc.
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file 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,
+# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+# distribution. VirtualBox OSE is distributed in the hope that it will
+# be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+
+# don't build testcases to save time, they are not needed for the package
+VBOX_WITH_TESTCASES :=
+VBOX_WITH_VALIDATIONKIT :=
+
+KBUILD_MSG_STYLE := brief
+
+## paths, origin, hardening
+VBOX_WITH_HARDENING := 2
+VBOX_WITH_ORIGIN :=
+VBOX_ONLY_ADDITIONS := 1
+
+## don't build with -Werror
+VBOX_WITH_WARNINGS_AS_ERRORS :=
diff --git a/app-emulation/virtualbox-guest-additions/files/virtualbox-guest-additions-8.initd b/app-emulation/virtualbox-guest-additions/files/virtualbox-guest-additions-8.initd
new file mode 100644
index 00000000..de143d04
--- /dev/null
+++ b/app-emulation/virtualbox-guest-additions/files/virtualbox-guest-additions-8.initd
@@ -0,0 +1,26 @@
+#!/sbin/openrc-run
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+pidfile="/var/run/vboxguest-service.pid"
+command="/usr/sbin/vboxguest-service"
+command_args="--foreground"
+command_background="true"
+
+depend() {
+ need dbus localmount
+ before xdm
+}
+
+start_pre() {
+ einfo "Loading kernel modules"
+ /sbin/modprobe vboxguest 2>&1
+ /sbin/modprobe vboxsf 2>&1
+}
+
+stop_post() {
+ einfo "Removing kernel modules"
+ /sbin/modprobe -r vboxsf 2>&1
+ /sbin/modprobe -r vboxguest 2>&1
+}
diff --git a/app-emulation/virtualbox-guest-additions/files/virtualbox-guest-additions.service b/app-emulation/virtualbox-guest-additions/files/virtualbox-guest-additions.service
new file mode 100644
index 00000000..35f9ce24
--- /dev/null
+++ b/app-emulation/virtualbox-guest-additions/files/virtualbox-guest-additions.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=VirtualBox Guest Additions
+ConditionVirtualization=oracle
+Before=display-manager.service
+
+[Service]
+Type=simple
+ExecStartPre=/sbin/modprobe vboxguest
+ExecStartPre=/sbin/modprobe vboxsf
+ExecStart=/usr/sbin/vboxguest-service --foreground
+ExecStopPost=/sbin/modprobe -r vboxsf
+ExecStopPost=/sbin/modprobe -r vboxguest
+PIDFile=/var/run/vboxguest-service.pid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/app-emulation/virtualbox-guest-additions/files/xorg.conf.vbox b/app-emulation/virtualbox-guest-additions/files/xorg.conf.vbox
new file mode 100644
index 00000000..a8624694
--- /dev/null
+++ b/app-emulation/virtualbox-guest-additions/files/xorg.conf.vbox
@@ -0,0 +1,13 @@
+Section "Device"
+ Identifier "Device-vboxvideo"
+ Driver "vboxvideo"
+EndSection
+Section "Screen"
+ Identifier "Screen-vboxvideo"
+ Device "Device-vboxvideo"
+EndSection
+
+Section "ServerLayout"
+ Identifier "Default Layout"
+ Screen "Screen-vboxvideo"
+EndSection
diff --git a/app-emulation/virtualbox-guest-additions/virtualbox-guest-additions-5.1.8.ebuild b/app-emulation/virtualbox-guest-additions/virtualbox-guest-additions-5.1.8.ebuild
new file mode 100644
index 00000000..99fe6748
--- /dev/null
+++ b/app-emulation/virtualbox-guest-additions/virtualbox-guest-additions-5.1.8.ebuild
@@ -0,0 +1,218 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+inherit eutils linux-mod systemd user toolchain-funcs
+
+MY_PV="${PV/beta/BETA}"
+MY_PV="${MY_PV/rc/RC}"
+MY_P=VirtualBox-${MY_PV}
+DESCRIPTION="VirtualBox kernel modules and user-space tools for Gentoo guests"
+HOMEPAGE="http://www.virtualbox.org/"
+SRC_URI="http://download.virtualbox.org/virtualbox/${MY_PV}/${MY_P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="X"
+
+RDEPEND="X? ( ~x11-drivers/xf86-video-virtualbox-${PV}
+ x11-apps/xrandr
+ x11-apps/xrefresh
+ x11-libs/libXmu
+ x11-libs/libX11
+ x11-libs/libXt
+ x11-libs/libXext
+ x11-libs/libXau
+ x11-libs/libXdmcp
+ x11-libs/libSM
+ x11-libs/libICE
+ x11-proto/glproto )
+ sys-apps/dbus
+ !!x11-drivers/xf86-input-virtualbox"
+DEPEND="${RDEPEND}
+ >=dev-util/kbuild-0.1.9998_pre20131130
+ >=dev-lang/yasm-0.6.2
+ sys-devel/bin86
+ sys-libs/pam
+ sys-power/iasl
+ X? ( x11-proto/renderproto )
+ !X? ( x11-proto/xproto )"
+
+BUILD_TARGETS="all"
+BUILD_TARGET_ARCH="${ARCH}"
+MODULE_NAMES="vboxguest(misc:${WORKDIR}/vboxguest:${WORKDIR}/vboxguest)
+ vboxsf(misc:${WORKDIR}/vboxsf:${WORKDIR}/vboxsf)"
+
+S="${WORKDIR}/${MY_P}"
+
+pkg_setup() {
+ linux-mod_pkg_setup
+ BUILD_PARAMS="KERN_DIR=${KV_OUT_DIR} KERNOUT=${KV_OUT_DIR}"
+ enewgroup vboxguest
+ enewuser vboxguest -1 /bin/sh /dev/null vboxguest
+ # automount Error: VBoxServiceAutoMountWorker: Group "vboxsf" does not exist
+ enewgroup vboxsf
+}
+
+src_unpack() {
+ unpack ${A}
+
+ # Create and unpack a tarball with the sources of the Linux guest
+ # kernel modules, to include all the needed files
+ "${S}"/src/VBox/Additions/linux/export_modules "${WORKDIR}/vbox-kmod.tar.gz"
+ unpack ./vbox-kmod.tar.gz
+
+ # Remove shipped binaries (kBuild,yasm), see bug #232775
+ cd "${S}"
+ rm -rf kBuild/bin tools
+}
+
+src_prepare() {
+ # PaX fixes (see bug #298988)
+ pushd "${WORKDIR}" &>/dev/null || die
+ eapply "${FILESDIR}"/vboxguest-4.1.0-log-use-c99.patch
+ popd &>/dev/null || die
+
+ # Disable things unused or splitted into separate ebuilds
+ cp "${FILESDIR}/${PN}-5-localconfig" LocalConfig.kmk || die
+ use X || echo "VBOX_WITH_X11_ADDITIONS :=" >> LocalConfig.kmk
+
+ # stupid new header references...
+ for vboxheader in {product,revision,version}-generated.h ; do
+ for mdir in vbox{guest,sf} ; do
+ ln -sf "${S}"/out/linux.${ARCH}/release/${vboxheader} \
+ "${WORKDIR}/${mdir}/${vboxheader}"
+ done
+ done
+
+ # Remove pointless GCC version limitations in check_gcc()
+ sed -e "/\s*-o\s*\\\(\s*\$cc_maj\s*-eq\s*[5-9]\s*-a\s*\$cc_min\s*-gt\s*[0-5]\s*\\\)\s*\\\/d" \
+ -i configure || die
+
+ eapply_user
+}
+
+src_configure() {
+ # build the user-space tools, warnings are harmless
+ local cmd=(
+ ./configure
+ --nofatal
+ --disable-xpcom
+ --disable-sdl-ttf
+ --disable-pulse
+ --disable-alsa
+ --with-gcc="$(tc-getCC)"
+ --with-g++="$(tc-getCXX)"
+ --target-arch=${ARCH}
+ --with-linux="${KV_OUT_DIR}"
+ --build-headless
+ )
+ echo "${cmd[@]}"
+ "${cmd[@]}" || die "configure failed"
+ source ./env.sh
+ export VBOX_GCC_OPT="${CFLAGS} ${CPPFLAGS}"
+}
+
+src_compile() {
+ MAKE="kmk" \
+ emake TOOL_YASM_AS=yasm \
+ VBOX_ONLY_ADDITIONS=1 \
+ KBUILD_VERBOSE=2
+
+ # Now creating the kernel modules. We must do this _after_
+ # we compiled the user-space tools as we need two of the
+ # automatically generated header files. (>=3.2.0)
+ linux-mod_src_compile
+}
+
+src_install() {
+ linux-mod_src_install
+
+ cd "${S}"/out/linux.${ARCH}/release/bin/additions || die
+
+ insinto /sbin
+ newins mount.vboxsf mount.vboxsf
+ fperms 4755 /sbin/mount.vboxsf
+
+ newinitd "${FILESDIR}"/${PN}-8.initd ${PN}
+
+ insinto /usr/sbin/
+ newins VBoxService vboxguest-service
+ fperms 0755 /usr/sbin/vboxguest-service
+
+ insinto /usr/bin
+ doins VBoxControl
+ fperms 0755 /usr/bin/VBoxControl
+
+ # VBoxClient user service and xrandr wrapper
+ if use X ; then
+ doins VBoxClient
+ fperms 0755 /usr/bin/VBoxClient
+
+ pushd "${S}"/src/VBox/Additions/x11/Installer &>/dev/null \
+ || die
+ newins 98vboxadd-xclient VBoxClient-all
+ fperms 0755 /usr/bin/VBoxClient-all
+ popd &>/dev/null || die
+ fi
+
+ # udev rule for vboxdrv
+ local udev_rules_dir="/lib/udev/rules.d"
+ dodir ${udev_rules_dir}
+ echo 'KERNEL=="vboxguest", OWNER="vboxguest", GROUP="vboxguest", MODE="0660"' \
+ >> "${D}/${udev_rules_dir}/60-virtualbox-guest-additions.rules" \
+ || die
+ echo 'KERNEL=="vboxuser", OWNER="vboxguest", GROUP="vboxguest", MODE="0660"' \
+ >> "${D}/${udev_rules_dir}/60-virtualbox-guest-additions.rules" \
+ || die
+
+ # VBoxClient autostart file
+ insinto /etc/xdg/autostart
+ doins "${FILESDIR}"/vboxclient.desktop
+
+ # sample xorg.conf
+ insinto /usr/share/doc/${PF}
+ doins "${FILESDIR}"/xorg.conf.vbox
+
+ systemd_dounit "${FILESDIR}/${PN}.service"
+}
+
+pkg_postinst() {
+ linux-mod_pkg_postinst
+ if ! use X ; then
+ elog "use flag X is off, enable it to install the"
+ elog "X Window System video driver."
+ fi
+ elog ""
+ elog "Please add users to the \"vboxguest\" group so they can"
+ elog "benefit from seamless mode, auto-resize and clipboard."
+ elog ""
+ elog "The vboxsf group has been added to make automount services work."
+ elog "These services are part of the shared folders support."
+ elog ""
+ elog "Please add:"
+ elog "/etc/init.d/${PN}"
+ elog "to the default runlevel in order to start"
+ elog "needed services."
+ elog "To use the VirtualBox X driver, use the following"
+ elog "file as your /etc/X11/xorg.conf:"
+ elog " /usr/share/doc/${PF}/xorg.conf.vbox"
+ elog ""
+ elog "Also make sure you use the Mesa library for OpenGL:"
+ elog " eselect opengl set xorg-x11"
+ elog ""
+ elog "An autostart .desktop file has been installed to start"
+ elog "VBoxClient in desktop sessions."
+ elog ""
+ elog "You can mount shared folders with:"
+ elog " mount -t vboxsf <shared_folder_name> <mount_point>"
+ elog ""
+ elog "Warning:"
+ elog "this ebuild is only needed if you are running gentoo"
+ elog "inside a VirtualBox Virtual Machine, you don't need"
+ elog "it to run VirtualBox itself."
+ elog ""
+}
diff --git a/app-emulation/virtualbox-modules/Manifest b/app-emulation/virtualbox-modules/Manifest
new file mode 100644
index 00000000..76141d3a
--- /dev/null
+++ b/app-emulation/virtualbox-modules/Manifest
@@ -0,0 +1 @@
+DIST vbox-kernel-module-src-5.1.8.tar.xz 612740 SHA256 a9448ae2cb0468b9dbc94cbcdafc7d8c49787bc6246e69d9cc905dfe61d0f3c8 SHA512 56ebaaab238d1a4b9b632cea9a9653849c88af23fff64bf6fb7b96b9a0890108f83fca33562abbad51358dd5757c57b619beb466f703bb2bf1d103631655ec45 WHIRLPOOL 396a44167f337e9a0acd1cee2cd325d493486786976ce9a34f44eee7fb2443730fc57a07a7e89f0f190a8cc6f5bc89692066af44a34a86a61b63a5c20e112cba
diff --git a/app-emulation/virtualbox-modules/files/create_vbox_modules_tarball.sh b/app-emulation/virtualbox-modules/files/create_vbox_modules_tarball.sh
new file mode 100755
index 00000000..756d2435
--- /dev/null
+++ b/app-emulation/virtualbox-modules/files/create_vbox_modules_tarball.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+# Create a virtualbox modules tarball from a VirtualBox binary package.
+# We cannot download the package by this script because of the unpredictable
+# build number being in the filename.
+#
+# usage: create_vbox_modules_tarball.sh VirtualBox-4.1.18-78361-Linux_amd64.run
+
+[ -f "$1" ] || exit 1
+
+VBOX_PACKAGE="$1"
+VERSION_SUFFIX=""
+
+if [[ ${VBOX_PACKAGE} = *_BETA* ]] || [[ ${VBOX_PACKAGE} = *_RC* ]] ; then
+ VERSION_SUFFIX="$(echo ${VBOX_PACKAGE} | sed 's@.*VirtualBox-[[:digit:]\.]\+\(_[[:alpha:]]\+[[:digit:]]\).*@\L\1@')"
+
+fi
+
+VBOX_VER="$(echo ${VBOX_PACKAGE} | sed 's@.*VirtualBox-\([[:digit:]\.]\+\).*@\1@')${VERSION_SUFFIX}"
+
+
+sh ${VBOX_PACKAGE} --noexec --keep --nox11 || exit 2
+cd install || exit 3
+tar -xaf VirtualBox.tar.bz2 || exit 4
+cd src/vboxhost || exit 5
+tar -cvJf ../../../vbox-kernel-module-src-${VBOX_VER}.tar.xz . || exit 6
+cd ../../.. && rm install -rf
+
+exit 0
diff --git a/app-emulation/virtualbox-modules/files/virtualbox-modules-4.1.4-pax-const.patch b/app-emulation/virtualbox-modules/files/virtualbox-modules-4.1.4-pax-const.patch
new file mode 100644
index 00000000..4e4cde06
--- /dev/null
+++ b/app-emulation/virtualbox-modules/files/virtualbox-modules-4.1.4-pax-const.patch
@@ -0,0 +1,48 @@
+diff -urp vboxdrv.orig/SUPDrvIDC.h vboxdrv/SUPDrvIDC.h
+--- vboxdrv.orig/SUPDrvIDC.h 2011-09-06 15:53:27.852567531 +0200
++++ vboxdrv/SUPDrvIDC.h 2011-09-06 15:54:05.420565524 +0200
+@@ -160,7 +160,7 @@ typedef struct SUPDRVIDCREQGETSYM
+ {
+ /** The symbol address. */
+ PFNRT pfnSymbol;
+- } Out;
++ } __no_const Out;
+ } u;
+ } SUPDRVIDCREQGETSYM;
+ /** Pointer to a SUPDRV IDC get symbol request. */
+diff -urp vboxnetflt.orig/include/VBox/intnet.h vboxnetflt/include/VBox/intnet.h
+--- vboxnetflt.orig/include/VBox/intnet.h 2011-09-06 15:53:27.852567531 +0200
++++ vboxnetflt/include/VBox/intnet.h 2011-09-06 15:54:05.424565524 +0200
+@@ -783,7 +783,7 @@ typedef struct INTNETTRUNKFACTORY
+ DECLR0CALLBACKMEMBER(int, pfnCreateAndConnect,(struct INTNETTRUNKFACTORY *pIfFactory, const char *pszName,
+ PINTNETTRUNKSWPORT pSwitchPort, uint32_t fFlags,
+ PINTNETTRUNKIFPORT *ppIfPort));
+-} INTNETTRUNKFACTORY;
++} __no_const INTNETTRUNKFACTORY;
+ /** Pointer to the trunk factory. */
+ typedef INTNETTRUNKFACTORY *PINTNETTRUNKFACTORY;
+
+diff -urp vboxnetflt.orig/linux/VBoxNetFlt-linux.c vboxnetflt/linux/VBoxNetFlt-linux.c
+--- vboxnetflt.orig/linux/VBoxNetFlt-linux.c 2011-07-19 12:15:22.000000000 +0200
++++ vboxnetflt/linux/VBoxNetFlt-linux.c 2011-09-06 15:56:00.516559379 +0200
+@@ -840,7 +840,7 @@ typedef struct ethtool_ops OVR_OPSTYPE;
+
+ # else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29) */
+
+-typedef struct net_device_ops OVR_OPSTYPE;
++typedef net_device_ops_no_const OVR_OPSTYPE;
+ # define OVR_OPS netdev_ops
+ # define OVR_XMIT pOrgOps->ndo_start_xmit
+
+diff -urp vboxpci.orig/include/VBox/rawpci.h vboxpci/include/VBox/rawpci.h
+--- vboxpci.orig/include/VBox/rawpci.h 2011-04-18 17:01:12.000000000 +0200
++++ vboxpci/include/VBox/rawpci.h 2011-09-06 15:57:17.340555277 +0200
+@@ -545,7 +545,7 @@ typedef struct RAWPCIFACTORY
+ DECLR0CALLBACKMEMBER(void, pfnDeinitVm,(PRAWPCIFACTORY pFactory,
+ PVM pVM,
+ PRAWPCIPERVM pPciData));
+-} RAWPCIFACTORY;
++} __no_const RAWPCIFACTORY;
+
+ #define RAWPCIFACTORY_UUID_STR "ea089839-4171-476f-adfb-9e7ab1cbd0fb"
+
diff --git a/app-emulation/virtualbox-modules/files/virtualbox.conf b/app-emulation/virtualbox-modules/files/virtualbox.conf
new file mode 100644
index 00000000..452f0a9f
--- /dev/null
+++ b/app-emulation/virtualbox-modules/files/virtualbox.conf
@@ -0,0 +1,4 @@
+vboxnetflt
+vboxnetadp
+vboxdrv
+vboxpci
diff --git a/app-emulation/virtualbox-modules/virtualbox-modules-5.1.8.ebuild b/app-emulation/virtualbox-modules/virtualbox-modules-5.1.8.ebuild
new file mode 100644
index 00000000..5a8bf08d
--- /dev/null
+++ b/app-emulation/virtualbox-modules/virtualbox-modules-5.1.8.ebuild
@@ -0,0 +1,65 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# XXX: the tarball here is just the kernel modules split out of the binary
+# package that comes from virtualbox-bin
+
+EAPI=6
+
+inherit eutils linux-mod user
+
+MY_P=vbox-kernel-module-src-${PV}
+DESCRIPTION="Kernel Modules for Virtualbox"
+HOMEPAGE="http://www.virtualbox.org/"
+SRC_URI="https://dev.gentoo.org/~polynomial-c/virtualbox/${MY_P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="pax_kernel"
+
+RDEPEND="!=app-emulation/virtualbox-9999"
+
+S=${WORKDIR}
+
+BUILD_TARGETS="all"
+BUILD_TARGET_ARCH="${ARCH}"
+MODULE_NAMES="vboxdrv(misc:${S}) vboxnetflt(misc:${S}) vboxnetadp(misc:${S}) vboxpci(misc:${S})"
+
+pkg_setup() {
+ linux-mod_pkg_setup
+
+ BUILD_PARAMS="KERN_DIR=${KV_DIR} KERNOUT=${KV_OUT_DIR} V=1 KBUILD_VERBOSE=1"
+ enewgroup vboxusers
+
+ CONFIG_CHECK="!TRIM_UNUSED_KSYMS"
+ ERROR_TRIM_UNUSED_KSYMS="This option removed kernel symbols that are needed by ${PN} to load correctly."
+
+}
+
+src_prepare() {
+ if kernel_is -ge 2 6 33 ; then
+ # evil patch for new kernels - header moved
+ grep -lR linux/autoconf.h * | xargs sed -i -e 's:<linux/autoconf.h>:<generated/autoconf.h>:'
+ fi
+
+ if use pax_kernel && kernel_is -ge 3 0 0 ; then
+ epatch "${FILESDIR}"/${PN}-4.1.4-pax-const.patch
+ fi
+
+ default
+}
+
+src_install() {
+ linux-mod_src_install
+ insinto /usr/lib/modules-load.d/
+ doins "${FILESDIR}"/virtualbox.conf
+}
+
+pkg_postinst() {
+ linux-mod_pkg_postinst
+ elog "If you are using sys-apps/openrc, please add \"vboxdrv\", \"vboxnetflt\","
+ elog "\"vboxnetadp\" and \"vboxpci\" to:"
+ elog " /etc/conf.d/modules"
+}
diff --git a/x11-drivers/xf86-video-virtualbox/Manifest b/x11-drivers/xf86-video-virtualbox/Manifest
new file mode 100644
index 00000000..c8bd71b8
--- /dev/null
+++ b/x11-drivers/xf86-video-virtualbox/Manifest
@@ -0,0 +1 @@
+DIST VirtualBox-5.1.8.tar.bz2 114688166 SHA256 e447031de468aee746529b2cf60768922f9beff22a13c54284aa430f5e925933 SHA512 178299173ee0062e23aee779faa893a42815d17163eab9ba2ed8b46be63a7110fe1690792de21514dc05ccd5a1752ea0f11357220e0e6f91f101dea3416e819c WHIRLPOOL 20ea8d253d177fd11c4349656aaa0f87f0fb76018511b345e85800d4dd8ab1e2e05c300a1f932670e5f5fac6ea547bfaa0a52b8526c4f363358911c770444a81
diff --git a/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-2.2.0-enable-opengl.patch b/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-2.2.0-enable-opengl.patch
new file mode 100644
index 00000000..b0779d42
--- /dev/null
+++ b/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-2.2.0-enable-opengl.patch
@@ -0,0 +1,13 @@
+--- a/configure
++++ b/configure
+@@ -1955,8 +1955,8 @@
+ HEADLESS=1
+ WITH_SDL=0
+ WITH_SDL_TTF=0
+- WITH_X11=0
+- WITH_OPENGL=0
++ WITH_X11=1
++ WITH_OPENGL=1
+ WITH_QT4=0
+ ;;
+ --ose)
diff --git a/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-5-localconfig b/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-5-localconfig
new file mode 100644
index 00000000..aee5ec1e
--- /dev/null
+++ b/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-5-localconfig
@@ -0,0 +1,30 @@
+# -*- Makefile -*-
+#
+# Overwrite some default kBuild settings
+#
+
+#
+# Copyright (C) 2006-2008 Sun Microsystems, Inc.
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file 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,
+# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+# distribution. VirtualBox OSE is distributed in the hope that it will
+# be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+
+# don't build testcases to save time, they are not needed for the package
+VBOX_WITH_TESTCASES :=
+VBOX_WITH_VALIDATIONKIT :=
+
+KBUILD_MSG_STYLE := brief
+
+## paths, origin, hardening
+VBOX_WITH_HARDENING := 2
+VBOX_WITH_ORIGIN :=
+VBOX_ONLY_ADDITIONS := 1
+
+TEMPLATE_VBOXGUESTR3XF86MOD_LDFLAGS.release =
+TEMPLATE_VBOXGUESTR3XORGMOD_LDFLAGS = $(TEMPLATE_VBOXGUESTR3DLL_LDFLAGS)
diff --git a/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-5.0.0_beta3-configure_checks.patch b/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-5.0.0_beta3-configure_checks.patch
new file mode 100644
index 00000000..92f8a182
--- /dev/null
+++ b/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-5.0.0_beta3-configure_checks.patch
@@ -0,0 +1,52 @@
+--- VirtualBox-5.0.0_BETA3/configure
++++ VirtualBox-5.0.0_BETA3/configure
+@@ -1258,10 +1258,7 @@
+ XCloseDisplay(dpy);
+ }
+ EOF
+- [ -n "$INCX11" ] && I_INCX11=`prefix_I "$INCX11"`
+- if test_compile "$LIBX11 $I_INCX11" Xlibs Xlibs; then
+- log_success "found"
+- fi
++ test_compile "$LIBX11 $I_INCX11" Xlibs Xlibs
+ }
+
+
+@@ -1415,21 +1412,6 @@
+ #include <GL/glu.h>
+ extern "C" int main(void)
+ {
+- Display *dpy;
+- int major, minor;
+-
+- dpy = XOpenDisplay(NULL);
+- if (dpy)
+- {
+- Bool glx_version = glXQueryVersion(dpy, &major, &minor);
+- XCloseDisplay(dpy);
+- if (glx_version)
+- {
+- printf("found version %u.%u, OK.\n", major, minor);
+- return 0;
+- }
+- }
+- printf("found (inactive), OK.\n");
+ return 0;
+ }
+ EOF
+@@ -2706,7 +2688,6 @@
+ # don't check for yasm for the time beeing as 0.40 and 0.50 both have known bugs
+ # [ "$OS" != "darwin" ] && check_yasm
+ [ "$OS" != "darwin" ] && check_xsltproc
+- [ "$OS" != "darwin" ] && check_mkisofs
+ fi
+
+ # the libraries
+@@ -2774,7 +2755,6 @@
+ check_compiler_h
+ [ $ONLY_ADDITIONS -eq 0 -a "$BUILD_MACHINE" = "amd64" -a $WITH_VMMRAW -eq 1 ] && check_32bit
+ # tools/common/makeself*
+- [ $OSE -ge 1 ] && check_makeself
+ fi
+
+ [ -n "$SETUP_WINE" ] && setup_wine
diff --git a/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-5.1.4-Makefile.module.kms.patch b/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-5.1.4-Makefile.module.kms.patch
new file mode 100644
index 00000000..f34ac667
--- /dev/null
+++ b/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-5.1.4-Makefile.module.kms.patch
@@ -0,0 +1,11 @@
+--- a/src/VBox/Additions/linux/drm/Makefile.module.kms
++++ b/src/VBox/Additions/linux/drm/Makefile.module.kms
+@@ -43,7 +43,7 @@ else
+ MANGLING := $(KBUILD_EXTMOD)/include/VBox/VBoxGuestMangling.h
+ endif
+ MOD_CFLAGS = -Wno-declaration-after-statement -fshort-wchar -include $(MANGLING) -fno-pie
+-MOD_INCL = $(addprefix -I$(KBUILD_EXTMOD),/ /include)
++MOD_INCL = $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux)
+ # What on earth is this?
+ MOD_INCL += $(addprefix -I$(KBUILD_EXTMOD)/vboxvideo,/ /include)
+ MOD_INCL += -Iinclude/drm
diff --git a/x11-drivers/xf86-video-virtualbox/xf86-video-virtualbox-5.1.8.ebuild b/x11-drivers/xf86-video-virtualbox/xf86-video-virtualbox-5.1.8.ebuild
new file mode 100644
index 00000000..780bd878
--- /dev/null
+++ b/x11-drivers/xf86-video-virtualbox/xf86-video-virtualbox-5.1.8.ebuild
@@ -0,0 +1,220 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 )
+inherit eutils linux-mod multilib python-single-r1 versionator toolchain-funcs
+
+MY_PV="${PV/beta/BETA}"
+MY_PV="${MY_PV/rc/RC}"
+MY_P=VirtualBox-${MY_PV}
+DESCRIPTION="VirtualBox video driver"
+HOMEPAGE="http://www.virtualbox.org/"
+SRC_URI="http://download.virtualbox.org/virtualbox/${MY_PV}/${MY_P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="dri"
+
+RDEPEND=">=x11-base/xorg-server-1.7:=[-minimal]
+ x11-libs/libXcomposite"
+DEPEND="${RDEPEND}
+ >=dev-util/kbuild-0.1.9998_pre20131130
+ ${PYTHON_DEPS}
+ >=dev-lang/yasm-0.6.2
+ >=sys-devel/gcc-4.9.0
+ sys-power/iasl
+ x11-proto/fontsproto
+ x11-proto/randrproto
+ x11-proto/renderproto
+ x11-proto/resourceproto
+ x11-proto/scrnsaverproto
+ x11-proto/xextproto
+ x11-proto/xineramaproto
+ x11-proto/xproto
+ x11-libs/libXdmcp
+ x11-libs/libXau
+ x11-libs/libX11
+ x11-libs/libXfixes
+ x11-libs/libXext
+ dri? ( x11-proto/xf86driproto
+ >=x11-libs/libdrm-2.4.5 )"
+
+REQUIRED_USE=( "${PYTHON_REQUIRED_USE}" )
+
+BUILD_TARGETS="all"
+BUILD_TARGET_ARCH="${ARCH}"
+S="${WORKDIR}/${MY_P}"
+MODULES_SRC_DIR="${S}/src/VBox/Additions/linux/drm"
+MODULE_NAMES="vboxvideo(misc:${MODULES_SRC_DIR}:${MODULES_SRC_DIR})"
+
+PATCHES=(
+ # Ugly hack to build the opengl part of the video driver
+ "${FILESDIR}/${PN}-2.2.0-enable-opengl.patch"
+
+ # unset useless/problematic checks in configure
+ "${FILESDIR}/${PN}-5.0.0_beta3-configure_checks.patch"
+)
+
+QA_TEXTRELS_x86="usr/lib/VBoxOGL.so"
+
+pkg_setup() {
+ if [ "${MERGE_TYPE}" != "binary" ]; then
+ version_is_at_least 4.9 $(gcc-version) || die "Please set gcc 4.9 or higher as active in gcc-config to build ${PN}"
+ fi
+
+ CONFIG_CHECK="~DRM ~DRM_TTM"
+ linux-mod_pkg_setup
+ BUILD_PARAMS="KERN_DIR=${KV_OUT_DIR} KERNOUT=${KV_OUT_DIR}"
+
+ python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ # Prepare the vboxvideo_drm Makefiles and build dir
+ eapply "${FILESDIR}"/${PN}-5.1.4-Makefile.module.kms.patch
+
+ # Remove shipped binaries (kBuild,yasm), see bug #232775
+ rm -r kBuild/bin tools || die
+
+ # Disable things unused or splitted into separate ebuilds
+ cp "${FILESDIR}/${PN}-5-localconfig" LocalConfig.kmk || die
+
+ # Remove pointless GCC version limitations in check_gcc()
+ sed -e "/\s*-o\s*\\\(\s*\$cc_maj\s*-eq\s*[5-9]\s*-a\s*\$cc_min\s*-gt\s*[0-5]\s*\\\)\s*\\\/d" \
+ -i configure || die
+
+ default
+
+ # link with lazy on hardened #394757
+ sed '/^TEMPLATE_VBOXR3EXE_LDFLAGS.linux/s/$/ -Wl,-z,lazy/' \
+ -i Config.kmk || die
+}
+
+src_configure() {
+ # build the user-space tools, warnings are harmless
+ local cmd=(
+ ./configure
+ --nofatal
+ --disable-xpcom
+ --disable-sdl-ttf
+ --disable-pulse
+ --disable-alsa
+ --with-gcc="$(tc-getCC)"
+ --with-g++="$(tc-getCXX)"
+ --target-arch=${ARCH}
+ --with-linux="${KV_OUT_DIR}"
+ --build-headless
+ )
+ echo "${cmd[@]}"
+ "${cmd[@]}" || die "configure failed"
+ source ./env.sh
+ export VBOX_GCC_OPT="${CFLAGS} ${CPPFLAGS}"
+}
+
+src_compile() {
+ local each targets=(
+ Runtime
+ Additions/common/VBoxGuestLib
+ GuestHost/OpenGL
+ Additions/x11/x11stubs
+ Additions/common/crOpenGL
+ Additions/x11/vboxvideo
+ )
+
+ # need to use the upstream build system to create necessary objects properly
+ use dri && targets+=( Additions/linux/drm )
+
+ for each in ${targets[@]} ; do
+ pushd "${S}"/src/VBox/${each} $>/dev/null || die
+ MAKE="kmk" \
+ emake TOOL_YASM_AS=yasm \
+ VBOX_USE_SYSTEM_XORG_HEADERS=1 \
+ KBUILD_PATH="${S}/kBuild" \
+ KBUILD_VERBOSE=2
+ popd &>/dev/null || die
+ done
+
+ if use dri; then
+ local objdir="out/linux.${ARCH}/release/obj/vboxvideo_drm"
+ # We need a Makefile, so use Makefile.module.kms
+ ln -s Makefile.module.kms "${MODULES_SRC_DIR}"/Makefile || die
+ # All of these are expected to be in $(KBUILD_EXTMOD)/ so symlink them into place
+ targets=(
+ include
+ src/VBox/Runtime/r0drv
+ src/VBox/Installer/linux/Makefile.include.{head,foot}er
+ out/linux.${ARCH}/release/{product,version,revision}-generated.h
+ )
+ for each in ${targets[@]} ; do
+ ln -s "${S}"/${each} \
+ "${MODULES_SRC_DIR}"/${each##*/} || die
+ done
+ # see the vboxvideo_drm_SOURCES list in Makefile.kmk for the below,
+ # and replace '..' with 'dt'
+ targets=(
+ dt/dt/common/VBoxVideo/HGSMIBase.o
+ dt/dt/common/VBoxVideo/Modesetting.o
+ dt/dt/common/VBoxVideo/VBVABase.o
+ dt/dt/dt/GuestHost/HGSMI/HGSMICommon.o
+ dt/dt/dt/GuestHost/HGSMI/HGSMIMemAlloc.o
+ dt/dt/dt/Runtime/common/alloc/heapoffset.o
+ )
+ for each in ${targets[@]} ; do
+ ln -s "${S}"/${objdir}/${each} \
+ "${MODULES_SRC_DIR}" || die
+ ln -s "${S}"/${objdir}/${each}.dep \
+ "${MODULES_SRC_DIR}" || die
+ done
+
+ # Now creating the kernel modules. We must do this _after_
+ # we compiled the user-space tools as we need two of the
+ # automatically generated header files. (>=3.2.0)
+ pushd "${MODULES_SRC_DIR}" &>/dev/null || die
+ linux-mod_src_compile
+ popd &>/dev/null || die
+ fi
+}
+
+src_install() {
+ if use dri; then
+ pushd "${MODULES_SRC_DIR}" &>/dev/null || die
+ linux-mod_src_install
+ popd &>/dev/null || die
+ fi
+
+ cd "${S}/out/linux.${ARCH}/release/bin/additions" || die
+ insinto /usr/$(get_libdir)/xorg/modules/drivers
+ newins vboxvideo_drv_system.so vboxvideo_drv.so
+
+ # Guest OpenGL driver
+ insinto /usr/$(get_libdir)
+ doins -r VBoxOGL*
+
+ if use dri ; then
+ dosym /usr/$(get_libdir)/VBoxOGL.so \
+ /usr/$(get_libdir)/dri/vboxvideo_dri.so
+ fi
+}
+
+pkg_postinst() {
+ elog "You need to edit the file /etc/X11/xorg.conf and set:"
+ elog ""
+ elog " Driver \"vboxvideo\""
+ elog ""
+ elog "in the Graphics device section (Section \"Device\")"
+ elog ""
+ if use dri; then
+ elog "To use the kernel drm video driver, please add:"
+ elog "\"${MODULE_NAMES%(*}\" to:"
+ if has_version sys-apps/openrc ; then
+ elog "/etc/conf.d/modules"
+ else
+ elog "/etc/modules.autoload.d/kernel-${KV_MAJOR}.${KV_MINOR}"
+ fi
+ elog ""
+ fi
+}