summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app-emulation/virtualbox/Manifest21
-rw-r--r--app-emulation/virtualbox/files/10-virtualbox.rules7
-rw-r--r--app-emulation/virtualbox/files/vboxwebsrv-confd18
-rw-r--r--app-emulation/virtualbox/files/vboxwebsrv-initd24
-rw-r--r--app-emulation/virtualbox/files/virtualbox-4-asneeded.patch27
-rw-r--r--app-emulation/virtualbox/files/virtualbox-4-config1
-rw-r--r--app-emulation/virtualbox/files/virtualbox-4-localconfig45
-rw-r--r--app-emulation/virtualbox/files/virtualbox-4-makeself-check.patch10
-rw-r--r--app-emulation/virtualbox/files/virtualbox-4-mkisofs-check.patch10
-rw-r--r--app-emulation/virtualbox/files/virtualbox-4-vnc.patch101
-rw-r--r--app-emulation/virtualbox/files/virtualbox-4.0.2-restore_old_machines_dir.patch12
-rw-r--r--app-emulation/virtualbox/files/virtualbox-4.0.4-gcc46.patch14
-rw-r--r--app-emulation/virtualbox/files/virtualbox-4.1.0-vboxpci-build.patch18
-rw-r--r--app-emulation/virtualbox/files/virtualbox-ose-3-config1
-rw-r--r--app-emulation/virtualbox/files/virtualbox-ose-3-localconfig45
-rwxr-xr-xapp-emulation/virtualbox/files/virtualbox-ose-3-wrapper104
-rw-r--r--app-emulation/virtualbox/files/virtualbox-ose-3.2.8-mesa-check.patch36
-rw-r--r--app-emulation/virtualbox/files/virtualbox-ose-asneeded.patch16
-rw-r--r--app-emulation/virtualbox/files/virtualbox-ose-vnc.patch101
-rw-r--r--app-emulation/virtualbox/files/virtualbox-ose.desktop-28
-rw-r--r--app-emulation/virtualbox/virtualbox-4.0.12.ebuild366
21 files changed, 985 insertions, 0 deletions
diff --git a/app-emulation/virtualbox/Manifest b/app-emulation/virtualbox/Manifest
new file mode 100644
index 0000000..8e4f1c4
--- /dev/null
+++ b/app-emulation/virtualbox/Manifest
@@ -0,0 +1,21 @@
+AUX 10-virtualbox.rules 576 RMD160 3dddd2ffa03bc214fea9d2e8b3363399ffd898e5 SHA1 6840d9e79790d01621ba79e00228071eda98355d SHA256 9fe8aaa16b42e6730a2ebd6cf0fbc9ad0db0f45e06e554cc4ae06b4dfc0045e1
+AUX vboxwebsrv-confd 623 RMD160 ad4a86aa317d466e556d613e57a7fa6a195db986 SHA1 f6f0f568a10093f082b3f8e09c9dfa515a560adc SHA256 8a6773013072e3049fa3ede7b5117e59dde9b35bc3402fc31e9985361b5f9147
+AUX vboxwebsrv-initd 749 RMD160 3cfe8484be4fe67d7be25044a4ab79c44ad42492 SHA1 5dddd297edd74a2e12a731e19f663128d6289b4b SHA256 279addc442d19f982c6b209c8900fe9bd65d73e2dcf98b96cd08b168eb8bf54d
+AUX virtualbox-4-asneeded.patch 1076 RMD160 94e7a836f4f0b2c5de7ed327b4732adde4c4abca SHA1 9e55fea49a185579049e3cc7b185726904aee7f7 SHA256 f081d030eceeccdb164e726c12d46847c4c0c76d71f934f43b3cf82893439339
+AUX virtualbox-4-config 38 RMD160 44974362ca28f2762c0501b4d4c18de2634aa063 SHA1 d475cbdbf469dd3a178fa9a4a8580859aacd7c37 SHA256 cc3cd896be49a421b06665683a22edb0fe17d6588fc259140b139c3d8a8581b5
+AUX virtualbox-4-localconfig 1434 RMD160 773b58324831c919afaf6a85ddbbccd03c49dead SHA1 6ab0f7e45f5778c1d392025dcec07c332678546a SHA256 e7d23a6c15b5982f7132c38ee5d660bae111a46c6a5603c2212488637cdcfe20
+AUX virtualbox-4-makeself-check.patch 289 RMD160 ff0385e86ad83501d58ff051b6c80c5122f6d956 SHA1 aa54f6621bf40da58897539aa4efda6f21a26a96 SHA256 31ddafbeef6d35696d76de06988412f888fd5403854952bb00ceab99f5ed4966
+AUX virtualbox-4-mkisofs-check.patch 356 RMD160 2562cee4530976224ae128a732ae99d79eece99d SHA1 050479d15ee5fed1504646c0687fd6e2c8a22dc1 SHA256 0e72a5ef8d915c550fd92865b40c265153dc2d4621714a599d3a7172726b6fff
+AUX virtualbox-4-vnc.patch 2558 RMD160 fc768f799f479dc3d5cd00ecb307357d553442f6 SHA1 3cad28c0d122078366186489dbcc9770dbbf94cc SHA256 69e31d5eb7a9e4933d8424e2ed61b86df67760f65f0ec9560a9189e64aec3581
+AUX virtualbox-4.0.2-restore_old_machines_dir.patch 528 RMD160 41dde2f1b062a42b0f54488ce70c7c40693b0c9d SHA1 699f43f729bf64adf32647b5d9664864fcd0634d SHA256 0867e42e671245b5f9851a3221ffc321cd660a382d0df02878fe57898087cac0
+AUX virtualbox-4.0.4-gcc46.patch 773 RMD160 d243f805aed7e4d1534c13acbd257a4003c10ed8 SHA1 c6f5928d6cebd35b2e87cf02d7aac730874abf05 SHA256 5a7a4a5e0a537d91d93c6b3605d74614ec02ca393ad48d465cb32655f2f573d3
+AUX virtualbox-4.1.0-vboxpci-build.patch 488 RMD160 443389ca2e55bb27b6309b9fc396617649fcac7a SHA1 f27090bc38401908591ee436ba4639fad6c430da SHA256 fdfd26d94bc2a239fa129016bd746664c832c30c1d9b42e2fb554827bb17fb19
+AUX virtualbox-ose-3-config 38 RMD160 44974362ca28f2762c0501b4d4c18de2634aa063 SHA1 d475cbdbf469dd3a178fa9a4a8580859aacd7c37 SHA256 cc3cd896be49a421b06665683a22edb0fe17d6588fc259140b139c3d8a8581b5
+AUX virtualbox-ose-3-localconfig 1434 RMD160 773b58324831c919afaf6a85ddbbccd03c49dead SHA1 6ab0f7e45f5778c1d392025dcec07c332678546a SHA256 e7d23a6c15b5982f7132c38ee5d660bae111a46c6a5603c2212488637cdcfe20
+AUX virtualbox-ose-3-wrapper 2931 RMD160 c73f7fca4531dc8023484b860c81c0a5805f022c SHA1 1d51680f1dc67394b0bf2c0533305e54c68ef177 SHA256 7ed4834ece201cb6a9da57e36a1a9b47bd054057d2ac4a46343a9966ff460644
+AUX virtualbox-ose-3.2.8-mesa-check.patch 701 RMD160 061b6eaf0b3cdbcaac7258d85909d1e9d89cdeb3 SHA1 7e5cf6d11421d392d4f2a7bf9846cc71d9688d03 SHA256 6b4ce64673cda33631e7a60ac94f23ab2d020d52b6160bb072ad8d6f9547c251
+AUX virtualbox-ose-asneeded.patch 516 RMD160 28adba1239f394e37a3d1955bb07908868e0bd02 SHA1 8698d7b915a00d824426bdb4d28d877580cd28df SHA256 62f289530b6a3baee4eba8c4c32cc6697acc75bb3a413d4d3c25d8b685df5f6c
+AUX virtualbox-ose-vnc.patch 2509 RMD160 7c3fa2d923ac9812ede7e3995c5efa729da17772 SHA1 0837f80aefabf3e9c98786e0f6a88d6362d8f0aa SHA256 c1277fd6d0fb0411a1da921f11e40f7c8fa17d8f0b250a03393ad0d8c59225a5
+AUX virtualbox-ose.desktop-2 201 RMD160 9cf3ef83d1fda93142d192b0bb4eae9d6dc62118 SHA1 58d6c89123034510476a65a8b4836fac5d0c57aa SHA256 fa7fc3dae940e768560559db944289c578acb691db2dcb51c8c85bfaf3298a25
+DIST VirtualBox-4.0.12.tar.bz2 69566771 RMD160 f25d361c19d25a883918b0e8f2ae9bc1c2dd83e8 SHA1 9e49c6a5a7b7b224a970655643cce52aac43eb0c SHA256 0175c4118af1f9633f33a055a0b0cc0b5a2d95a63b44269af2139eb2fd07e5a9
+EBUILD virtualbox-4.0.12.ebuild 11914 RMD160 82092f83b833380dfff8000d6057639c48bf56a8 SHA1 abfe0879ddb5632af83473315644bbdf6cf5dd99 SHA256 38e527ff84adc9c678b3464e07f3df3417ccad3309f42ff2f7f2ff357859c361
diff --git a/app-emulation/virtualbox/files/10-virtualbox.rules b/app-emulation/virtualbox/files/10-virtualbox.rules
new file mode 100644
index 0000000..8efff24
--- /dev/null
+++ b/app-emulation/virtualbox/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="/lib/udev/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}"
+SUBSYSTEM=="usb", ACTION!="remove", ENV{DEVTYPE}=="usb_device", RUN="/lib/udev/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}"
+SUBSYSTEM=="usb_device", ACTION=="remove", RUN="/lib/udev/VBoxCreateUSBNode.sh --remove $major $minor"
+SUBSYSTEM=="usb", ACTION=="remove", ENV{DEVTYPE}=="usb_device", RUN="/lib/udev/VBoxCreateUSBNode.sh --remove $major $minor"
diff --git a/app-emulation/virtualbox/files/vboxwebsrv-confd b/app-emulation/virtualbox/files/vboxwebsrv-confd
new file mode 100644
index 0000000..92d61e9
--- /dev/null
+++ b/app-emulation/virtualbox/files/vboxwebsrv-confd
@@ -0,0 +1,18 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/virtualbox/files/vboxwebsrv-confd,v 1.1 2011/01/06 22:47:33 polynomial-c Exp $
+
+# 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
+
diff --git a/app-emulation/virtualbox/files/vboxwebsrv-initd b/app-emulation/virtualbox/files/vboxwebsrv-initd
new file mode 100644
index 0000000..d04cdc2
--- /dev/null
+++ b/app-emulation/virtualbox/files/vboxwebsrv-initd
@@ -0,0 +1,24 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/virtualbox/files/vboxwebsrv-initd,v 1.1 2011/01/06 22:47:34 polynomial-c Exp $
+
+depend() {
+ need net
+}
+
+start() {
+ #checkconfig || return $?
+
+ ebegin "Starting VirtualBox WebService"
+ start-stop-daemon --start --quiet --pidfile /var/run/vboxwebsrv.pid \
+ --background --make-pidfile --exec /usr/bin/vboxwebsrv \
+ -- -H ${VBOXWEBSRV_HOST} -p ${VBOXWEBSRV_PORT} -t ${VBOXWEBSRV_TIMEOUT} -i ${VBOXWEBSRV_INTERVAL}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping VirtualBox WebService"
+ start-stop-daemon --stop --quiet --pidfile /var/run/vboxwebsrv.pid
+ eend $?
+}
diff --git a/app-emulation/virtualbox/files/virtualbox-4-asneeded.patch b/app-emulation/virtualbox/files/virtualbox-4-asneeded.patch
new file mode 100644
index 0000000..5533bb0
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-4-asneeded.patch
@@ -0,0 +1,27 @@
+--- VirtualBox-4.0.0_OSE/src/libs/xpcom18a4/Makefile.kmk
++++ VirtualBox-4.0.0_OSE/src/libs/xpcom18a4/Makefile.kmk
+@@ -469,9 +469,11 @@
+ libIDL_config_cflags := $(shell $(VBOX_LIBIDL_CONFIG) --cflags)
+ libIDL_config_libs := $(shell $(VBOX_LIBIDL_CONFIG) --libs)
+ xpidl_CFLAGS = \
+- $(libIDL_config_cflags)
++ $(shell pkg-config --cflags libIDL-2.0)
+ xpidl_LDFLAGS = \
+- $(libIDL_config_libs)
++ $(shell pkg-config --libs-only-L libIDL-2.0)
++xpidl_LIBS.linux = \
++ $(shell pkg-config --libs-only-l libIDL-2.0 | sed -e 's/-l//g')
+ xpidl_LDFLAGS.linux = \
+ $(VBOX_LD_as_needed)
+ endif
+--- VirtualBox-4.0.0_OSE/Config.kmk
++++ VirtualBox-4.0.0_OSE/Config.kmk
+@@ -4053,7 +4053,7 @@
+ TEMPLATE_VBOXBLDPROG_LDFLAGS.amd64 = -m64
+ TEMPLATE_VBOXBLDPROG_LDFLAGS.sparc64 = -m64
+ ifeq ($(KBUILD_HOST),linux)
+-TEMPLATE_VBOXBLDPROG_LIBS = pthread m rt dl
++TEMPLATE_VBOXBLDPROG_LIBS = pthread m rt dl crypt
+ else ifeq ($(KBUILD_HOST),os2)
+ TEMPLATE_VBOXBLDPROG_TOOL = GXX3OMF
+ TEMPLATE_VBOXBLDPROG_LIBS = socket iconv \ No newline at end of file
diff --git a/app-emulation/virtualbox/files/virtualbox-4-config b/app-emulation/virtualbox/files/virtualbox-4-config
new file mode 100644
index 0000000..af78221
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-4-config
@@ -0,0 +1 @@
+INSTALL_DIR=/usr/MY_LIBDIR/virtualbox
diff --git a/app-emulation/virtualbox/files/virtualbox-4-localconfig b/app-emulation/virtualbox/files/virtualbox-4-localconfig
new file mode 100644
index 0000000..5138d92
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-4-localconfig
@@ -0,0 +1,45 @@
+# -*- 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.
+#
+
+# shut up wine complaining about unknown locale
+EXEC_X86_WIN32 := wine
+
+# don't build testcases to save time, they are not needed for the package
+VBOX_WITH_TESTCASES :=
+VBOX_WITH_TESTSUITE :=
+VBOX_DOCBOOK_WITH_LATEX := 1
+
+KBUILD_MSG_STYLE := brief
+
+## paths, origin, hardening
+VBOX_WITH_HARDENING := 1
+VBOX_WITH_ORIGIN :=
+VBOX_PATH_APP_PRIVATE_ARCH := /usr/MY_LIBDIR/virtualbox
+VBOX_PATH_SHARED_LIBS := $(VBOX_PATH_APP_PRIVATE_ARCH)
+VBOX_WITH_RUNPATH := $(VBOX_PATH_APP_PRIVATE_ARCH)
+VBOX_PATH_APP_PRIVATE := /usr/share/virtualbox
+VBOX_PATH_APP_DOCS = $(VBOX_PATH_PACKAGE_DOCS)
+
+## don't build unwanted/splitted stuff
+VBOX_WITHOUT_ADDITIONS := 1
+VBOX_WITH_VBOXDRV :=
+VBOX_WITH_VBOXBFE :=
+VBOX_WITH_KCHMVIEWER :=
+
+## don't build with -Werror
+VBOX_WITH_WARNINGS_AS_ERRORS :=
+
diff --git a/app-emulation/virtualbox/files/virtualbox-4-makeself-check.patch b/app-emulation/virtualbox/files/virtualbox-4-makeself-check.patch
new file mode 100644
index 0000000..e1fcb8c
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-4-makeself-check.patch
@@ -0,0 +1,10 @@
+--- VirtualBox-4.0.0_OSE/configure
++++ VirtualBox-4.0.0_OSE/configure
+@@ -2527,7 +2527,6 @@
+ check_compiler_h
+ [ "$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/app-emulation/virtualbox/files/virtualbox-4-mkisofs-check.patch b/app-emulation/virtualbox/files/virtualbox-4-mkisofs-check.patch
new file mode 100644
index 0000000..8b0d591
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-4-mkisofs-check.patch
@@ -0,0 +1,10 @@
+--- VirtualBox-4.0.0_OSE/configure
++++ VirtualBox-4.0.0_OSE/configure
+@@ -2499,7 +2499,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
+
+ # the libraries
+ [ "$OS" != "darwin" ] && check_pthread
diff --git a/app-emulation/virtualbox/files/virtualbox-4-vnc.patch b/app-emulation/virtualbox/files/virtualbox-4-vnc.patch
new file mode 100644
index 0000000..76e2c68
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-4-vnc.patch
@@ -0,0 +1,101 @@
+--- configure.old 2011-02-18 20:22:18.879463002 +0100
++++ configure 2011-02-18 20:30:22.355463011 +0100
+@@ -88,6 +88,7 @@
+ WITH_OPENGL=1
+ WITH_HARDENING=1
+ WITH_VDE=0
++WITH_VNC=0
+ WITH_DOCS=1
+ BUILD_LIBXML2=
+ BUILD_LIBXSLT=
+@@ -123,6 +124,8 @@
+ MESA="-lGL"
+ INCZ=""
+ LIBZ="-lz"
++INCVNCSERVER=""
++LIBVNCSERVER="-lvncserver"
+ CXX_FLAGS=""
+ if [ "$OS" = "freebsd" ]; then
+ INCCURL="-I/usr/local/include"
+@@ -956,6 +959,47 @@
+ }
+
+ #
++# Check for libvncserver, needed for VNC in OSE
++#
++check_vncserver()
++{
++ test_header libvncserver
++ cat > $ODIR.tmp_src.cc <<EOF
++#include <cstdio>
++#include <rfb/rfbconfig.h>
++
++extern "C" int main()
++{
++ const char* v=LIBVNCSERVER_VERSION;
++ unsigned int major = 0, minor = 0, micro = 0;
++
++ for (; *v !='.' && *v != '\0'; v++) major = major*10 + *v-'0';
++ if (*v == '.') v++;
++ for (; *v !='.' && *v != '\0'; v++) minor = minor*10 + *v-'0';
++ if (*v == '.') v++;
++ for (; *v !='.' && *v != '\0'; v++) micro = micro*10 + *v-'0';
++
++ printf("found version %s", LIBVNCSERVER_PACKAGE_VERSION);
++ if (major*10000 + minor*100 + micro >= 907)
++ {
++ printf(", OK.\n");
++ return 0;
++ }
++ else
++ {
++ printf(", expected version 0.9.7 or higher\n");
++ return 1;
++ }
++}
++EOF
++ if test_compile "$LIBVNCSERVER $INCVNCSERVER" libvncserver libvncserver; then
++ if test_execute; then
++ cnf_append "VBOX_WITH_VNC" "1"
++ fi
++ fi
++}
++
++#
+ # Check for libcurl, needed by S3
+ #
+ check_curl()
+@@ -2115,6 +2159,7 @@
+ [ $WITH_KMODS -eq 1 ] && echo " --disable-kmods don't build Linux kernel modules (host and guest)"
+ [ $WITH_OPENGL -eq 1 ] && echo " --disable-opengl disable OpenGL support (2D & 3D)"
+ [ $WITH_GSOAP -eq 0 ] && echo " --enable-webservice enable the webservice stuff"
++[ $OSE -eq 1 ] && echo " --enable-vnc enable the VNC server"
+ [ $WITH_DOCS -eq 1 ] && echo " --disable-docs don't build the documentation"
+ [ "$OS" = "linux" -o "$OS" = "freebsd" ] && echo " --enable-vde enable VDE networking"
+ cat << EOF
+@@ -2280,6 +2325,9 @@
+ --enable-webservice)
+ [ $WITH_GSOAP -eq 0 ] && WITH_GSOAP=1
+ ;;
++ --enable-vnc)
++ WITH_VNC=1
++ ;;
+ --disable-hardening)
+ WITH_HARDENING=0
+ ;;
+@@ -2553,6 +2601,15 @@
+ cnf_append "VBOX_WITH_DOCS_PACKING" ""
+ fi
+
++# VNC server support
++if [ $OSE -ge 1 ]; then
++ if [ $WITH_VNC = 1 ]; then
++ check_vncserver
++ else
++ cnf_append "VBOX_WITH_VNC" ""
++ fi
++fi
++
+ # success!
+ echo
+ echo "Successfully generated '$CNF' and '$ENV'."
diff --git a/app-emulation/virtualbox/files/virtualbox-4.0.2-restore_old_machines_dir.patch b/app-emulation/virtualbox/files/virtualbox-4.0.2-restore_old_machines_dir.patch
new file mode 100644
index 0000000..a79cd90
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-4.0.2-restore_old_machines_dir.patch
@@ -0,0 +1,12 @@
+--- VirtualBox-4.0.2_OSE/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
++++ VirtualBox-4.0.2_OSE/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
+@@ -1035,7 +1035,8 @@
+ // new default with VirtualBox 4.0: "$HOME/VirtualBox VMs"
+ HRESULT rc = getUserHomeDirectory(path);
+ if (FAILED(rc)) return rc;
+- path += RTPATH_SLASH_STR "VirtualBox VMs";
++ path += RTPATH_SLASH_STR ".VirtualBox";
++ path += RTPATH_SLASH_STR "Machines";
+ }
+
+ if (!RTPathStartsWithRoot(path.c_str()))
diff --git a/app-emulation/virtualbox/files/virtualbox-4.0.4-gcc46.patch b/app-emulation/virtualbox/files/virtualbox-4.0.4-gcc46.patch
new file mode 100644
index 0000000..a9f8077
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-4.0.4-gcc46.patch
@@ -0,0 +1,14 @@
+--- VirtualBox-4.0.4_OSE.orig/configure 2011-02-18 00:30:48.000000000 +0800
++++ VirtualBox-4.0.4_OSE.orig/configure 2011-04-10 13:37:42.513743178 +0800
+@@ -409,9 +409,9 @@ check_gcc()
+ elif [ $cc_maj -lt 3 \
+ -o \( $cc_maj -eq 3 -a $cc_min -lt 2 \) \
+ -o \( $cc_maj -eq 4 -a $cc_min -lt 1 -a "$OS" != "darwin" \) \
+- -o \( $cc_maj -eq 4 -a $cc_min -gt 5 \) \
++ -o \( $cc_maj -eq 4 -a $cc_min -gt 6 \) \
+ -o $cc_maj -gt 4 ]; then
+- log_failure "gcc version $cc_ver found, expected gcc 3.x with x>1 or gcc 4.x with 0<x<5"
++ log_failure "gcc version $cc_ver found, expected gcc 3.x with x>1 or gcc 4.x with 0<x<=6"
+ fail really
+ else
+ log_success "found version $cc_ver"
diff --git a/app-emulation/virtualbox/files/virtualbox-4.1.0-vboxpci-build.patch b/app-emulation/virtualbox/files/virtualbox-4.1.0-vboxpci-build.patch
new file mode 100644
index 0000000..632e6a5
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-4.1.0-vboxpci-build.patch
@@ -0,0 +1,18 @@
+--- VirtualBox-4.1.0_OSE/src/VBox/HostDrivers/VBoxPci/Makefile.kmk
++++ VirtualBox-4.1.0_OSE/src/VBox/HostDrivers/VBoxPci/Makefile.kmk
+@@ -5,6 +5,7 @@
+
+ if1of ($(KBUILD_TARGET), linux)
+
++ ifdef VBOX_WITH_VBOXDRV
+ SYSMODS += VBoxPci
+ VBoxPci_TEMPLATE = VBOXR0DRV
+ VBoxPci_INST = $(INST_VBOXPCI)$(if $(eq $(KBUILD_TARGET),darwin),Contents/MacOS/)
+@@ -23,6 +24,7 @@
+ VBoxPci_LIBS += \
+ $(PATH_LIB)/SUPR0IdcClient$(VBOX_SUFF_LIB)
+
++ endif # VBOX_WITH_VBOXDRV
+ endif
+
+
diff --git a/app-emulation/virtualbox/files/virtualbox-ose-3-config b/app-emulation/virtualbox/files/virtualbox-ose-3-config
new file mode 100644
index 0000000..af78221
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-ose-3-config
@@ -0,0 +1 @@
+INSTALL_DIR=/usr/MY_LIBDIR/virtualbox
diff --git a/app-emulation/virtualbox/files/virtualbox-ose-3-localconfig b/app-emulation/virtualbox/files/virtualbox-ose-3-localconfig
new file mode 100644
index 0000000..5138d92
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-ose-3-localconfig
@@ -0,0 +1,45 @@
+# -*- 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.
+#
+
+# shut up wine complaining about unknown locale
+EXEC_X86_WIN32 := wine
+
+# don't build testcases to save time, they are not needed for the package
+VBOX_WITH_TESTCASES :=
+VBOX_WITH_TESTSUITE :=
+VBOX_DOCBOOK_WITH_LATEX := 1
+
+KBUILD_MSG_STYLE := brief
+
+## paths, origin, hardening
+VBOX_WITH_HARDENING := 1
+VBOX_WITH_ORIGIN :=
+VBOX_PATH_APP_PRIVATE_ARCH := /usr/MY_LIBDIR/virtualbox
+VBOX_PATH_SHARED_LIBS := $(VBOX_PATH_APP_PRIVATE_ARCH)
+VBOX_WITH_RUNPATH := $(VBOX_PATH_APP_PRIVATE_ARCH)
+VBOX_PATH_APP_PRIVATE := /usr/share/virtualbox
+VBOX_PATH_APP_DOCS = $(VBOX_PATH_PACKAGE_DOCS)
+
+## don't build unwanted/splitted stuff
+VBOX_WITHOUT_ADDITIONS := 1
+VBOX_WITH_VBOXDRV :=
+VBOX_WITH_VBOXBFE :=
+VBOX_WITH_KCHMVIEWER :=
+
+## don't build with -Werror
+VBOX_WITH_WARNINGS_AS_ERRORS :=
+
diff --git a/app-emulation/virtualbox/files/virtualbox-ose-3-wrapper b/app-emulation/virtualbox/files/virtualbox-ose-3-wrapper
new file mode 100755
index 0000000..6f2da49
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-ose-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/files/virtualbox-ose-3.2.8-mesa-check.patch b/app-emulation/virtualbox/files/virtualbox-ose-3.2.8-mesa-check.patch
new file mode 100644
index 0000000..6813a17
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-ose-3.2.8-mesa-check.patch
@@ -0,0 +1,36 @@
+--- configure
++++ configure
+@@ -1225,10 +1225,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
+ }
+
+
+@@ -1382,21 +1379,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
diff --git a/app-emulation/virtualbox/files/virtualbox-ose-asneeded.patch b/app-emulation/virtualbox/files/virtualbox-ose-asneeded.patch
new file mode 100644
index 0000000..2eee125
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-ose-asneeded.patch
@@ -0,0 +1,16 @@
+--- src/libs/xpcom18a4/Makefile.kmk
++++ src/libs/xpcom18a4/Makefile.kmk
+@@ -469,9 +469,10 @@
+ libIDL_config_cflags := $(shell $(VBOX_LIBIDL_CONFIG) --cflags)
+ libIDL_config_libs := $(shell $(VBOX_LIBIDL_CONFIG) --libs)
+ xpidl_CFLAGS = \
+- $(libIDL_config_cflags)
+- xpidl_LDFLAGS = \
+- $(libIDL_config_libs)
++ $(shell pkg-config --cflags libIDL-2.0)
++ xpidl_LDFLAGS = $(shell pkg-config --libs-only-L libIDL-2.0)
++ xpidl_LIBS.linux = $(shell pkg-config --libs-only-l libIDL-2.0 | sed -e 's/-l//g')
++
+ endif
+
+ #
diff --git a/app-emulation/virtualbox/files/virtualbox-ose-vnc.patch b/app-emulation/virtualbox/files/virtualbox-ose-vnc.patch
new file mode 100644
index 0000000..b8a2088
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-ose-vnc.patch
@@ -0,0 +1,101 @@
+--- configure.orig 2010-11-20 20:35:43.399739771 +0100
++++ configure 2010-11-20 22:04:15.523490599 +0100
+@@ -87,6 +87,7 @@
+ WITH_OPENGL=1
+ WITH_HARDENING=1
+ WITH_VDE=0
++WITH_VNC=0
+ BUILD_LIBXML2=
+ BUILD_LIBXSLT=
+ BUILD_LIBCURL=
+@@ -122,6 +123,8 @@
+ LIBZ="-lz"
+ INCPNG=""
+ LIBPNG="-lpng"
++INCVNCSERVER=""
++LIBVNCSERVER="-lvncserver"
+ CXX_FLAGS=""
+ if [ "$OS" = "freebsd" ]; then
+ INCCURL="-I/usr/local/include"
+@@ -949,6 +952,47 @@
+ }
+
+ #
++# Check for libvncserver, needed for VNC in OSE
++#
++check_vncserver()
++{
++ test_header libvncserver
++ cat > $ODIR.tmp_src.cc <<EOF
++#include <cstdio>
++#include <rfb/rfbconfig.h>
++
++extern "C" int main()
++{
++ const char* v=LIBVNCSERVER_VERSION;
++ unsigned int major = 0, minor = 0, micro = 0;
++
++ for (; *v !='.' && *v != '\0'; v++) major = major*10 + *v-'0';
++ if (*v == '.') v++;
++ for (; *v !='.' && *v != '\0'; v++) minor = minor*10 + *v-'0';
++ if (*v == '.') v++;
++ for (; *v !='.' && *v != '\0'; v++) micro = micro*10 + *v-'0';
++
++ printf("found version %s", LIBVNCSERVER_PACKAGE_VERSION);
++ if (major*10000 + minor*100 + micro >= 907)
++ {
++ printf(", OK.\n");
++ return 0;
++ }
++ else
++ {
++ printf(", expected version 0.9.7 or higher\n");
++ return 1;
++ }
++}
++EOF
++ if test_compile "$LIBVNCSERVER $INCVNCSERVER" libvncserver libvncserver; then
++ if test_execute; then
++ cnf_append "VBOX_WITH_VNC" "1"
++ fi
++ fi
++}
++
++#
+ # Check for libcurl, needed by S3
+ #
+ check_curl()
+@@ -2063,6 +2107,7 @@
+ [ $WITH_KMODS -eq 1 ] && echo " --disable-kmods don't build Linux kernel modules (host and guest)"
+ [ $WITH_OPENGL -eq 1 ] && echo " --disable-opengl disable OpenGL support (2D & 3D)"
+ [ $WITH_GSOAP -eq 0 ] && echo " --enable-webservice enable the webservice stuff"
++[ $OSE -eq 1 ] && echo " --enable-vnc enable the VNC server"
+ [ "$OS" = "linux" -o "$OS" = "freebsd" ] && echo " --enable-vde enable VDE networking"
+ cat << EOF
+ --disable-hardening don't be strict about /dev/vboxdrv access
+@@ -2224,6 +2269,9 @@
+ --enable-webservice)
+ [ $WITH_GSOAP -eq 0 ] && WITH_GSOAP=1
+ ;;
++ --enable-vnc)
++ WITH_VNC=1
++ ;;
+ --disable-hardening)
+ WITH_HARDENING=0
+ ;;
+@@ -2484,6 +2532,15 @@
+ fi
+ fi
+
++# VNC server support
++if [ $OSE -ge 1 ]; then
++ if [ $WITH_VNC = 1 ]; then
++ check_vncserver
++ else
++ cnf_append "VBOX_WITH_VNC" ""
++ fi
++fi
++
+ # success!
+ echo
+ echo "Successfully generated '$CNF' and '$ENV'."
diff --git a/app-emulation/virtualbox/files/virtualbox-ose.desktop-2 b/app-emulation/virtualbox/files/virtualbox-ose.desktop-2
new file mode 100644
index 0000000..ce798da
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-ose.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
+Categories=System;Emulator;
diff --git a/app-emulation/virtualbox/virtualbox-4.0.12.ebuild b/app-emulation/virtualbox/virtualbox-4.0.12.ebuild
new file mode 100644
index 0000000..9d0ae18
--- /dev/null
+++ b/app-emulation/virtualbox/virtualbox-4.0.12.ebuild
@@ -0,0 +1,366 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/virtualbox/virtualbox-4.0.12.ebuild,v 1.4 2011/07/25 08:25:48 polynomial-c Exp $
+
+EAPI=4
+
+inherit eutils fdo-mime flag-o-matic linux-info pax-utils qt4-r2 toolchain-funcs java-pkg-opt-2
+
+if [[ ${PV} == "9999" ]] ; then
+ # XXX: should finish merging the -9999 ebuild into this one ...
+ ESVN_REPO_URI="http://www.virtualbox.org/svn/vbox/trunk"
+ inherit linux-mod subversion
+else
+ MY_P=VirtualBox-${PV}
+ SRC_URI="http://download.virtualbox.org/virtualbox/${PV}/${MY_P}.tar.bz2"
+ S="${WORKDIR}/${MY_P}_OSE"
+fi
+
+DESCRIPTION="Software family of powerful x86 virtualization"
+HOMEPAGE="http://www.virtualbox.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="+additions alsa doc extensions headless java pulseaudio +opengl python +qt4 +sdk vboxwebsrv vnc"
+
+RDEPEND="!app-emulation/virtualbox-bin
+ ~app-emulation/virtualbox-modules-${PV}
+ dev-libs/libIDL
+ >=dev-libs/libxslt-1.1.19
+ net-misc/curl
+ dev-libs/openssl
+ dev-libs/libxml2
+ sys-libs/zlib
+ !headless? (
+ qt4? (
+ x11-libs/qt-gui:4
+ x11-libs/qt-core:4
+ opengl? ( x11-libs/qt-opengl:4 )
+ x11-libs/libXinerama
+ )
+ opengl? ( virtual/opengl media-libs/freeglut )
+ x11-libs/libX11
+ x11-libs/libXcursor
+ x11-libs/libXext
+ x11-libs/libXmu
+ x11-libs/libXt
+ media-libs/libsdl[X,video]
+ )
+ vnc? ( >=net-libs/libvncserver-0.9.7 )
+ java? ( >=virtual/jre-1.5 )"
+DEPEND="${RDEPEND}
+ >=dev-util/kbuild-0.1.5-r1
+ >=dev-lang/yasm-0.6.2
+ sys-devel/bin86
+ sys-devel/dev86
+ sys-power/iasl
+ media-libs/libpng
+ sys-libs/pam
+ sys-libs/libcap
+ doc? (
+ dev-texlive/texlive-basic
+ dev-texlive/texlive-latex
+ dev-texlive/texlive-latexrecommended
+ dev-texlive/texlive-latexextra
+ dev-texlive/texlive-fontsrecommended
+ dev-texlive/texlive-fontsextra
+ )
+ java? ( >=virtual/jdk-1.5 )
+ dev-util/pkgconfig
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ !headless? ( x11-libs/libXinerama )
+ pulseaudio? ( media-sound/pulseaudio )
+ python? ( >=dev-lang/python-2.3[threads] )
+ vboxwebsrv? ( >=net-libs/gsoap-2.7.13 )"
+PDEPEND="additions? ( ~app-emulation/virtualbox-additions-${PV} )
+ extensions? ( ~app-emulation/virtualbox-extpack-oracle-${PV} )"
+
+QA_TEXTRELS_x86="usr/lib/virtualbox-ose/VBoxGuestPropSvc.so
+ usr/lib/virtualbox/VBoxSDL.so
+ usr/lib/virtualbox/VBoxSharedFolders.so
+ usr/lib/virtualbox/VBoxDD2.so
+ usr/lib/virtualbox/VBoxOGLrenderspu.so
+ usr/lib/virtualbox/VBoxPython.so
+ usr/lib/virtualbox/VBoxDD.so
+ usr/lib/virtualbox/VBoxDDU.so
+ usr/lib/virtualbox/VBoxREM64.so
+ usr/lib/virtualbox/VBoxSharedClipboard.so
+ usr/lib/virtualbox/VBoxHeadless.so
+ usr/lib/virtualbox/VBoxRT.so
+ usr/lib/virtualbox/VBoxREM.so
+ usr/lib/virtualbox/VBoxSettings.so
+ usr/lib/virtualbox/VBoxKeyboard.so
+ usr/lib/virtualbox/VBoxSharedCrOpenGL.so
+ usr/lib/virtualbox/VBoxVMM.so
+ usr/lib/virtualbox/VirtualBox.so
+ usr/lib/virtualbox/VBoxOGLhosterrorspu.so
+ usr/lib/virtualbox/components/VBoxC.so
+ usr/lib/virtualbox/components/VBoxSVCM.so
+ usr/lib/virtualbox/components/VBoxDDU.so
+ usr/lib/virtualbox/components/VBoxRT.so
+ usr/lib/virtualbox/components/VBoxREM.so
+ usr/lib/virtualbox/components/VBoxVMM.so
+ usr/lib/virtualbox/VBoxREM32.so
+ usr/lib/virtualbox/VBoxPython2_4.so
+ usr/lib/virtualbox/VBoxPython2_5.so
+ usr/lib/virtualbox/VBoxPython2_6.so
+ usr/lib/virtualbox/VBoxPython2_7.so
+ usr/lib/virtualbox/VBoxXPCOMC.so
+ usr/lib/virtualbox/VBoxOGLhostcrutil.so
+ usr/lib/virtualbox/VBoxNetDHCP.so"
+
+REQUIRED_USE="java? ( sdk ) python? ( sdk )"
+
+pkg_setup() {
+ if built_with_use sys-devel/gcc hardened && gcc-config -c | grep -qv -E "hardenednopie|vanilla"; then
+ eerror "The PIE feature provided by the \"hardened\" compiler is incompatible with ${PF}."
+ eerror "You must use gcc-config to select a profile without this feature. You may"
+ eerror "choose either \"hardenednopie\", \"hardenednopiessp\" or \"vanilla\" profile;"
+ eerror "however, \"hardenednopie\" is preferred because it gives the most hardening."
+ eerror "Remember to run \"source /etc/profile\" before continuing. See bug #339914."
+ die
+ fi
+
+ if ! use headless && ! use qt4 ; then
+ einfo "No USE=\"qt4\" selected, this build will not include"
+ einfo "any Qt frontend."
+ elif use headless && use qt4 ; then
+ einfo "You selected USE=\"headless qt4\", defaulting to"
+ einfo "USE=\"headless\", this build will not include any X11/Qt frontend."
+ fi
+
+ if ! use opengl ; then
+ einfo "No USE=\"opengl\" selected, this build will lack"
+ einfo "the OpenGL feature."
+ fi
+ java-pkg-opt-2_pkg_setup
+}
+
+src_prepare() {
+ # Remove shipped binaries (kBuild,yasm), see bug #232775
+ rm -rf kBuild/bin tools
+
+ # Disable things unused or split into separate ebuilds
+ sed -e "s/MY_LIBDIR/$(get_libdir)/" \
+ "${FILESDIR}"/${PN}-4-localconfig > LocalConfig.kmk || die
+
+ # unset useless/problematic checks in configure
+ epatch "${FILESDIR}/${PN}-ose-3.2.8-mesa-check.patch" \
+ "${FILESDIR}/${PN}-4-makeself-check.patch" \
+ "${FILESDIR}/${PN}-4-mkisofs-check.patch"
+
+ # fix build with --as-needed (bug #249295 and bug #350907)
+ epatch "${FILESDIR}/${PN}-4-asneeded.patch"
+
+ # Respect LDFLAGS
+ sed -e "s/_LDFLAGS\.${ARCH}*.*=/& ${LDFLAGS}/g" \
+ -i Config.kmk src/libs/xpcom18a4/Config.kmk || die
+
+ # We still want to use ${HOME}/.VirtualBox/Machines as machines dir.
+ epatch "${FILESDIR}/${PN}-4.0.2-restore_old_machines_dir.patch"
+
+ # add correct java path
+ if use java ; then
+ sed "s:/usr/lib/jvm/java-6-sun:$(java-config -O):" \
+ -i "${S}"/Config.kmk || die
+ fi
+ java-pkg-opt-2_src_prepare
+}
+
+src_configure() {
+ local myconf
+ use alsa || myconf+=" --disable-alsa"
+ use opengl || myconf+=" --disable-opengl"
+ use pulseaudio || myconf+=" --disable-pulse"
+ use python || myconf+=" --disable-python"
+ use java || myconf+=" --disable-java"
+ use vboxwebsrv && myconf+=" --enable-webservice"
+ use vnc && myconf+=" --enable-vnc"
+ use doc || myconf+=" --disable-docs"
+ if ! use headless ; then
+ use qt4 || myconf+=" --disable-qt4"
+ else
+ myconf+=" --build-headless --disable-opengl"
+ fi
+ # not an autoconf script
+ ./configure \
+ --with-gcc="$(tc-getCC)" \
+ --with-g++="$(tc-getCXX)" \
+ --disable-kmods \
+ --disable-dbus \
+ ${myconf} \
+ || die "configure failed"
+}
+
+src_compile() {
+ source ./env.sh
+
+ # Force kBuild to respect C[XX]FLAGS and MAKEOPTS (bug #178529)
+ # and strip all flags
+ # strip-flags
+
+ MAKE="kmk" emake \
+ VBOX_VERSION_STRING='$(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)'-Gentoo \
+ TOOL_GCC3_CC="$(tc-getCC)" TOOL_GCC3_CXX="$(tc-getCXX)" \
+ TOOL_GCC3_AS="$(tc-getCC)" TOOL_GCC3_AR="$(tc-getAR)" \
+ TOOL_GCC3_LD="$(tc-getCXX)" TOOL_GCC3_LD_SYSMOD="$(tc-getLD)" \
+ TOOL_GCC3_CFLAGS="${CFLAGS}" TOOL_GCC3_CXXFLAGS="${CXXFLAGS}" \
+ VBOX_GCC_OPT="${CXXFLAGS}" \
+ TOOL_YASM_AS=yasm KBUILD_PATH="${S}/kBuild" \
+ all || die "kmk failed"
+}
+
+src_install() {
+ cd "${S}"/out/linux.${ARCH}/release/bin || die
+
+ # Create configuration files
+ insinto /etc/vbox
+ newins "${FILESDIR}/${PN}-4-config" vbox.cfg
+
+ # Set the right libdir
+ sed -i \
+ -e "s/MY_LIBDIR/$(get_libdir)/" \
+ "${D}"/etc/vbox/vbox.cfg || die "vbox.cfg sed failed"
+
+ # Symlink binaries to the shipped wrapper
+ exeinto /usr/$(get_libdir)/${PN}
+ newexe "${FILESDIR}/${PN}-ose-3-wrapper" "VBox" || die
+ fowners root:vboxusers /usr/$(get_libdir)/${PN}/VBox
+ fperms 0750 /usr/$(get_libdir)/${PN}/VBox
+
+ dosym /usr/$(get_libdir)/${PN}/VBox /usr/bin/VBoxManage
+ dosym /usr/$(get_libdir)/${PN}/VBox /usr/bin/VBoxVRDP
+ dosym /usr/$(get_libdir)/${PN}/VBox /usr/bin/VBoxHeadless
+ dosym /usr/$(get_libdir)/${PN}/VBoxTunctl /usr/bin/VBoxTunctl
+
+ # Install binaries and libraries
+ insinto /usr/$(get_libdir)/${PN}
+ doins -r components || die
+
+ if use sdk ; then
+ doins -r sdk || die
+ fi
+
+ if use vboxwebsrv ; then
+ doins vboxwebsrv || die
+ fowners root:vboxusers /usr/$(get_libdir)/${PN}/vboxwebsrv
+ fperms 0750 /usr/$(get_libdir)/${PN}/vboxwebsrv
+ dosym /usr/$(get_libdir)/${PN}/VBox /usr/bin/vboxwebsrv
+ newinitd "${FILESDIR}"/vboxwebsrv-initd vboxwebsrv
+ newconfd "${FILESDIR}"/vboxwebsrv-confd vboxwebsrv
+ fi
+
+ for each in VBox{Manage,SVC,XPCOMIPCD,Tunctl,NetAdpCtl,NetDHCP,ExtPackHelperApp} *so *r0 *gc ; do
+ doins $each || die
+ fowners root:vboxusers /usr/$(get_libdir)/${PN}/${each}
+ fperms 0750 /usr/$(get_libdir)/${PN}/${each}
+ done
+ # VBoxNetAdpCtl and VBoxNetDHCP binaries need to be suid root in any case..
+ fperms 4750 /usr/$(get_libdir)/${PN}/VBoxNetAdpCtl
+ fperms 4750 /usr/$(get_libdir)/${PN}/VBoxNetDHCP
+
+ if ! use headless ; then
+ for each in VBox{SDL,Headless} ; do
+ doins $each || die
+ fowners root:vboxusers /usr/$(get_libdir)/${PN}/${each}
+ fperms 4750 /usr/$(get_libdir)/${PN}/${each}
+ pax-mark -m "${D}"/usr/$(get_libdir)/${PN}/${each}
+ done
+
+ if use opengl && use qt4 ; then
+ doins VBoxTestOGL || die
+ fowners root:vboxusers /usr/$(get_libdir)/${PN}/VBoxTestOGL
+ fperms 0750 /usr/$(get_libdir)/${PN}/VBoxTestOGL
+ fi
+
+ dosym /usr/$(get_libdir)/${PN}/VBox /usr/bin/VBoxSDL
+
+ if use qt4 ; then
+ doins VirtualBox || die
+ fowners root:vboxusers /usr/$(get_libdir)/${PN}/VirtualBox
+ fperms 4750 /usr/$(get_libdir)/${PN}/VirtualBox
+ pax-mark -m "${D}"/usr/$(get_libdir)/${PN}/VirtualBox
+
+ dosym /usr/$(get_libdir)/${PN}/VBox /usr/bin/VirtualBox
+
+ newmenu "${FILESDIR}"/${PN}-ose.desktop-2 ${PN}.desktop
+ fi
+
+ newicon "${S}"/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_32px.png ${PN}.png
+ else
+ doins VBoxHeadless || die
+ fowners root:vboxusers /usr/$(get_libdir)/${PN}/VBoxHeadless
+ fperms 4750 /usr/$(get_libdir)/${PN}/VBoxHeadless
+ pax-mark -m "${D}"/usr/$(get_libdir)/${PN}/VBoxHeadless
+ fi
+
+ # Install EFI Firmware files (bug #320757)
+ pushd "${S}"/src/VBox/Devices/EFI/FirmwareBin &>/dev/null || die
+ for fwfile in VBoxEFI{32,64}.fd ; do
+ doins ${fwfile} || die
+ fowners root:vboxusers /usr/$(get_libdir)/${PN}/${fwfile} || die
+ done
+ popd &>/dev/null || die
+
+ # New way of handling USB device nodes for VBox (bug #356215)
+ insinto /lib/udev
+ doins VBoxCreateUSBNode.sh
+ fowners root:vboxusers /lib/udev/VBoxCreateUSBNode.sh
+ fperms 0750 /lib/udev/VBoxCreateUSBNode.sh
+ insinto /lib/udev/rules.d
+ doins "${FILESDIR}"/10-virtualbox.rules
+
+ insinto /usr/share/${PN}
+ if ! use headless && use qt4 ; then
+ doins -r nls
+ fi
+
+ # VRDPAuth only works with this (bug #351949)
+ dosym VBoxAuth.so /usr/$(get_libdir)/${PN}/VRDPAuth.so
+
+ # set an env-variable for 3rd party tools
+ echo -n "VBOX_APP_HOME=/usr/$(get_libdir)/${PN}" > "${T}/90virtualbox"
+ doenvd "${T}/90virtualbox"
+
+ if use java ; then
+ java-pkg_regjar "${D}/usr/$(get_libdir)/${PN}/sdk/bindings/xpcom/java/vboxjxpcom.jar"
+ java-pkg_regso "${D}/usr/$(get_libdir)/${PN}/libvboxjxpcom.so"
+ fi
+}
+
+pkg_postinst() {
+ fdo-mime_desktop_database_update
+
+ udevadm control --reload-rules && udevadm trigger --subsystem-match=usb
+
+ if ! use headless && use qt4 ; then
+ elog "To launch VirtualBox just type: \"VirtualBox\"."
+ fi
+ elog "You must be in the vboxusers group to use VirtualBox."
+ elog ""
+ elog "The latest user manual is available for download at:"
+ elog "http://download.virtualbox.org/virtualbox/${PV}/UserManual.pdf"
+ elog ""
+ elog "For advanced networking setups you should emerge:"
+ elog "net-misc/bridge-utils and sys-apps/usermode-utilities"
+ elog ""
+ elog "IMPORTANT!"
+ elog "If you upgrade from app-emulation/virtualbox-ose make sure to run"
+ elog "\"env-update\" as root and logout and relogin as the user you wish"
+ elog "to run ${PN} as."
+ elog ""
+ elog "Starting with version 4.0.0, ${PN} has USB-1 support."
+ elog "For USB-2 support, PXE-boot ability and VRDP support please emerge"
+ elog " app-emulation/virtualbox-extpack-oracle"
+ elog "package."
+ 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
+}