aboutsummaryrefslogtreecommitdiff
path: root/emulators
diff options
context:
space:
mode:
authorBernhard Froehlich <decke@FreeBSD.org>2012-02-21 12:43:15 +0000
committerBernhard Froehlich <decke@FreeBSD.org>2012-02-21 12:43:15 +0000
commitf3865a976c842403ea1aedb3c3785a1b01d97f69 (patch)
tree8a0b4b41e451928d3354db68bd19b5abd9be91cd /emulators
parentc59600683f0ba4ad5afeae4cf73846ee416f65bf (diff)
downloadports-f3865a976c842403ea1aedb3c3785a1b01d97f69.tar.gz
ports-f3865a976c842403ea1aedb3c3785a1b01d97f69.zip
Notes
Diffstat (limited to 'emulators')
-rw-r--r--emulators/virtualbox-ose-kmod-legacy/Makefile16
-rw-r--r--emulators/virtualbox-ose-kmod-legacy/distinfo4
-rw-r--r--emulators/virtualbox-ose-kmod-legacy/files/patch-include-iprt-types.h19
-rw-r--r--emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-HostDrivers-Support-freebsd-SUPDrv-freebsd.c31
-rw-r--r--emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c45
-rw-r--r--emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-Runtime-r0drv-freebsd-mp-r0drv-freebsd.c16
-rw-r--r--emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-Runtime-r0drv-freebsd-thread-r0drv-freebsd.c16
-rw-r--r--emulators/virtualbox-ose-legacy/Makefile21
-rw-r--r--emulators/virtualbox-ose-legacy/distinfo8
-rw-r--r--emulators/virtualbox-ose-legacy/files/patch-src-VBox-Devices-Makefile.kmk22
-rw-r--r--emulators/virtualbox-ose-legacy/files/patch-src-VBox-Devices-Storage-DrvHostDVD.cpp14
-rw-r--r--emulators/virtualbox-ose-legacy/files/patch-src-VBox-Frontends-VBoxManage-VBoxInternalManage.cpp48
-rw-r--r--emulators/virtualbox-ose-legacy/files/patch-src-VBox-Frontends-VirtualBox-src-settings-vm-VBoxVMSettingsHD.h11
-rw-r--r--emulators/virtualbox-ose-legacy/files/patch-src-VBox-Main-freebsd-NetIf-freebsd.cpp30
-rw-r--r--emulators/virtualbox-ose-legacy/files/patch-src-VBox-Main-src-server-freebsd-HostHardwareFreeBSD.cpp (renamed from emulators/virtualbox-ose-legacy/files/patch-src-VBox-Main-freebsd-HostHardwareFreeBSD.cpp)4
-rw-r--r--emulators/virtualbox-ose-legacy/files/patch-src-VBox-Runtime-r3-freebsd-fileaio-freebsd.c16
-rw-r--r--emulators/virtualbox-ose-legacy/files/patch-src-VBox-VMM-VMMR3-CPUM.cpp12
-rw-r--r--emulators/virtualbox-ose-legacy/pkg-message36
-rw-r--r--emulators/virtualbox-ose-legacy/pkg-plist5
19 files changed, 209 insertions, 165 deletions
diff --git a/emulators/virtualbox-ose-kmod-legacy/Makefile b/emulators/virtualbox-ose-kmod-legacy/Makefile
index ad14b5105274..9c1ab3d3243f 100644
--- a/emulators/virtualbox-ose-kmod-legacy/Makefile
+++ b/emulators/virtualbox-ose-kmod-legacy/Makefile
@@ -6,14 +6,13 @@
#
PORTNAME= virtualbox-ose
-DISTVERSION= 3.2.12
-PORTREVISION= 3
+DISTVERSION= 4.0.16
CATEGORIES= emulators kld
MASTER_SITES= http://tmp.chruetertee.ch/ \
http://freebsd.unixfreunde.de/sources/ \
http://disasterarea.chruetertee.ch/
PKGNAMESUFFIX= -kmod-legacy
-DISTNAME= VirtualBox-${DISTVERSION}-OSE
+DISTNAME= VirtualBox-${DISTVERSION}
MAINTAINER= vbox@FreeBSD.org
COMMENT= VirtualBox kernel module for FreeBSD
@@ -38,9 +37,11 @@ CONFIGURE_ARGS+=--with-gcc="${CC}" --with-g++="${CXX}" --nofatal \
--build-headless
CONFLICTS= bcc-[0-9]*
+CONFLICTS_BUILD= kBuild-devel-[0-9]*
CONFLICTS_INSTALL= virtualbox-ose-kmod-[3,4]* virtualbox-ose-kmod-devel-[3,4]*
-OPTIONS= DEBUG "Build with debugging symbols" off
+OPTIONS= DEBUG "Build with debugging symbols" off \
+ VIMAGE "VIMAGE virtual networking support" off
.include <bsd.port.options.mk>
@@ -72,11 +73,18 @@ IGNORE= requires kernel sources
.include <bsd.port.pre.mk>
+.if ${OSVERSION} < 800500 && defined(WITH_VIMAGE)
+IGNORE= newer kernel is required to build with VIMAGE
+.endif
+
post-patch:
@${ECHO} 'VBOX_WITH_VBOXDRV = 1' > ${WRKSRC}/LocalConfig.kmk
@${ECHO} 'VBOX_WITH_NETFLT = 1' >> ${WRKSRC}/LocalConfig.kmk
@${ECHO} 'VBOX_WITH_NETADP = 1' >> ${WRKSRC}/LocalConfig.kmk
@${ECHO} 'VBOX_WITH_ADDITIONS =' >> ${WRKSRC}/LocalConfig.kmk
+.if defined(WITH_VIMAGE)
+ @${ECHO} 'VBOX_WITH_NETFLT_VIMAGE = 1' >> ${WRKSRC}/LocalConfig.kmk
+.endif
@${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g' \
${WRKSRC}/Config.kmk \
${WRKSRC}/configure
diff --git a/emulators/virtualbox-ose-kmod-legacy/distinfo b/emulators/virtualbox-ose-kmod-legacy/distinfo
index 8a9c1e15c918..c43dcee8c56e 100644
--- a/emulators/virtualbox-ose-kmod-legacy/distinfo
+++ b/emulators/virtualbox-ose-kmod-legacy/distinfo
@@ -1,2 +1,2 @@
-SHA256 (VirtualBox-3.2.12-OSE.tar.bz2) = 064eb382e5b752a3f9189c930734393765125e70b5f99679a63ff4eb6186e261
-SIZE (VirtualBox-3.2.12-OSE.tar.bz2) = 58239733
+SHA256 (VirtualBox-4.0.16.tar.bz2) = d6c165cc41063cb8eb8283606b712904cae180000171fb1f833b7eaada633c77
+SIZE (VirtualBox-4.0.16.tar.bz2) = 70042175
diff --git a/emulators/virtualbox-ose-kmod-legacy/files/patch-include-iprt-types.h b/emulators/virtualbox-ose-kmod-legacy/files/patch-include-iprt-types.h
new file mode 100644
index 000000000000..afa28bbb1461
--- /dev/null
+++ b/emulators/virtualbox-ose-kmod-legacy/files/patch-include-iprt-types.h
@@ -0,0 +1,19 @@
+- Fix build failure on FreeBSD 10-CURRENT after r228444
+
+include/iprt/types.h:174: error: redefinition of typedef 'bool'
+@/sys/types.h:271: error: previous declaration of 'bool' was here
+
+Submitted by: Daichi GOTO <daichi@freebsd.org>
+--- include/iprt/types.h.orig 2011-10-28 16:29:51.000000000 +0200
++++ include/iprt/types.h 2011-12-22 10:17:16.000000000 +0100
+@@ -167,6 +167,10 @@
+ # if defined(__GNUC__)
+ # if defined(RT_OS_LINUX) && __GNUC__ < 3
+ typedef uint8_t bool;
++# elif defined(RT_OS_FREEBSD)
++# ifndef __bool_true_false_are_defined
++typedef _Bool bool;
++# endif
+ # else
+ # if defined(RT_OS_DARWIN) && defined(_STDBOOL_H)
+ # undef bool
diff --git a/emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-HostDrivers-Support-freebsd-SUPDrv-freebsd.c b/emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-HostDrivers-Support-freebsd-SUPDrv-freebsd.c
new file mode 100644
index 000000000000..8bc13932892d
--- /dev/null
+++ b/emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-HostDrivers-Support-freebsd-SUPDrv-freebsd.c
@@ -0,0 +1,31 @@
+- Fix compile error: 'D_PSEUDO' undeclared here on 10-CURRENT
+
+Submitted by: Jung-uk Kim <jkim@FreeBSD.org>
+
+- Fix check that kernel module can not be unloaded when there
+are running VMs
+
+Submitted by: aeichner
+Reported by: avg
+--- src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c.orig 2011-11-04 12:19:39.000000000 +0100
++++ src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c 2011-12-13 12:22:44.325251163 +0100
+@@ -100,7 +100,9 @@
+ static struct cdevsw g_VBoxDrvFreeBSDChrDevSW =
+ {
+ .d_version = D_VERSION,
+-#if __FreeBSD_version > 800061
++#if __FreeBSD_version >= 1000000
++ .d_flags = D_TRACKCLOSE | D_NEEDMINOR,
++#elif __FreeBSD_version > 800061
+ .d_flags = D_PSEUDO | D_TRACKCLOSE | D_NEEDMINOR,
+ #else
+ .d_flags = D_PSEUDO | D_TRACKCLOSE,
+@@ -205,7 +207,7 @@
+ Log(("VBoxDrvFreeBSDUnload:\n"));
+
+ if (g_cUsers > 0)
+- return EBUSY;
++ return VERR_RESOURCE_BUSY;
+
+ /*
+ * Reserve what we did in VBoxDrvFreeBSDInit.
diff --git a/emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c b/emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c
index fd376f9b528b..91bacd4eef20 100644
--- a/emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c
+++ b/emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c
@@ -5,9 +5,13 @@ to VPO_UNMANAGED for an additional assert.
Reviewed by: kib
See: http://svnweb.freebsd.org/base?view=revision&revision=224746
---- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2011-04-05 14:34:09.000000000 +0200
-+++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2011-08-11 15:06:46.000000000 +0200
-@@ -394,9 +394,13 @@
+--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2011-11-04 07:19:54.000000000 -0400
++++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2011-11-29 18:13:32.000000000 -0500
+@@ -391,12 +391,18 @@
+
+ static void rtR0MemObjFreeBSDPhysPageInit(vm_page_t pPage, vm_pindex_t iPage)
+ {
++#if __FreeBSD_version <= 1000000
pPage->wire_count = 1;
pPage->pindex = iPage;
pPage->act_count = 0;
@@ -20,6 +24,41 @@ See: http://svnweb.freebsd.org/base?view=revision&revision=224746
+#else
+ Assert(pPage->flags & PG_UNMANAGED != 0);
+#endif
++#endif
}
+@@ -408,6 +414,9 @@
+ int rc = VINF_SUCCESS;
+ uint32_t cPages = cb >> PAGE_SHIFT;
+ vm_paddr_t VmPhysAddrHigh;
++#if __FreeBSD_version >= 1000001
++ int pFlags = VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED;
++#endif
+
+ /* create the object. */
+ PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJFREEBSD, u.Phys.apPages[cPages]),
+@@ -424,7 +433,11 @@
+
+ if (fContiguous)
+ {
++#if __FreeBSD_version >= 1000001
++ vm_page_t pPage = vm_page_alloc_contig(NULL, 0, pFlags, cPages, 0, VmPhysAddrHigh, uAlignment, 0, VM_MEMATTR_DEFAULT);
++#else
+ vm_page_t pPage = vm_phys_alloc_contig(cPages, 0, VmPhysAddrHigh, uAlignment, 0);
++#endif
+
+ if (pPage)
+ for (uint32_t iPage = 0; iPage < cPages; iPage++)
+@@ -440,7 +453,11 @@
+ /* Allocate page by page */
+ for (uint32_t iPage = 0; iPage < cPages; iPage++)
+ {
++#if __FreeBSD_version >= 1000001
++ vm_page_t pPage = vm_page_alloc_contig(NULL, iPage, pFlags, 1, 0, VmPhysAddrHigh, uAlignment, 0, VM_MEMATTR_DEFAULT);
++#else
+ vm_page_t pPage = vm_phys_alloc_contig(1, 0, VmPhysAddrHigh, uAlignment, 0);
++#endif
+
+ if (!pPage)
+ {
diff --git a/emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-Runtime-r0drv-freebsd-mp-r0drv-freebsd.c b/emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-Runtime-r0drv-freebsd-mp-r0drv-freebsd.c
index b089715a27ec..c298f52fd501 100644
--- a/emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-Runtime-r0drv-freebsd-mp-r0drv-freebsd.c
+++ b/emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-Runtime-r0drv-freebsd-mp-r0drv-freebsd.c
@@ -1,7 +1,7 @@
---- src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c.orig 2010-12-01 18:09:43.000000000 +0100
-+++ src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c 2011-06-27 16:13:16.000000000 +0200
-@@ -163,17 +163,26 @@
- /* Will panic if no rendezvouing cpus, so check up front. */
+--- src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c.orig 2011-05-16 12:33:52.000000000 -0400
++++ src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c 2011-06-24 13:57:31.000000000 -0400
+@@ -163,17 +163,26 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER p
+ /* Will panic if no rendezvousing cpus, so check up front. */
if (RTMpGetOnlineCount() > 1)
{
-#if __FreeBSD_version >= 700000
@@ -30,7 +30,7 @@
smp_rendezvous_cpus(Mask, NULL, rtmpOnOthersFreeBSDWrapper, smp_no_rendevous_barrier, &Args);
#else
smp_rendezvous(NULL, rtmpOnOthersFreeBSDWrapper, NULL, &Args);
-@@ -203,8 +212,10 @@
+@@ -203,8 +212,10 @@ static void rtmpOnSpecificFreeBSDWrapper
RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
{
@@ -43,7 +43,7 @@
#endif
RTMPARGS Args;
-@@ -218,7 +229,11 @@
+@@ -218,7 +229,11 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu
Args.idCpu = idCpu;
Args.cHits = 0;
#if __FreeBSD_version >= 700000
@@ -55,7 +55,7 @@
smp_rendezvous_cpus(Mask, NULL, rtmpOnSpecificFreeBSDWrapper, smp_no_rendevous_barrier, &Args);
#else
smp_rendezvous(NULL, rtmpOnSpecificFreeBSDWrapper, NULL, &Args);
-@@ -242,13 +257,21 @@
+@@ -242,13 +257,21 @@ static void rtmpFreeBSDPokeCallback(void
RTDECL(int) RTMpPokeCpu(RTCPUID idCpu)
{
@@ -65,7 +65,7 @@
cpumask_t Mask;
+#endif
- /* Will panic if no rendezvouing cpus, so make sure the cpu is online. */
+ /* Will panic if no rendezvousing cpus, so make sure the cpu is online. */
if (!RTMpIsCpuOnline(idCpu))
return VERR_CPU_NOT_FOUND;
diff --git a/emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-Runtime-r0drv-freebsd-thread-r0drv-freebsd.c b/emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-Runtime-r0drv-freebsd-thread-r0drv-freebsd.c
deleted file mode 100644
index e379ac172b4a..000000000000
--- a/emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-Runtime-r0drv-freebsd-thread-r0drv-freebsd.c
+++ /dev/null
@@ -1,16 +0,0 @@
-*** ./src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c~ Wed Dec 1 12:09:43 2010
---- ./src/VBox/Runtime/r0drv/freebsd/thread-r0drv-freebsd.c Wed Feb 9 13:44:28 2011
-***************
-*** 101,107 ****
---- 101,111 ----
-
- RTDECL(bool) RTThreadYield(void)
- {
-+ #if (__FreeBSD_version >= 900032)
-+ kern_yield(curthread->td_user_pri);
-+ #else
- uio_yield();
-+ #endif
- return false; /** @todo figure this one ... */
- }
-
diff --git a/emulators/virtualbox-ose-legacy/Makefile b/emulators/virtualbox-ose-legacy/Makefile
index 3d22fecee6c4..6830445b954b 100644
--- a/emulators/virtualbox-ose-legacy/Makefile
+++ b/emulators/virtualbox-ose-legacy/Makefile
@@ -6,16 +6,15 @@
#
PORTNAME= virtualbox-ose
-DISTVERSION= 3.2.12
-PORTREVISION= 4
+DISTVERSION= 4.0.16
CATEGORIES= emulators
MASTER_SITES= http://tmp.chruetertee.ch/ \
http://freebsd.unixfreunde.de/sources/ \
http://disasterarea.chruetertee.ch/ \
http://dlc.sun.com/virtualbox/${VBOX_GUEST_VER}/:guestadditions
PKGNAMESUFFIX= -legacy
-DISTFILES= VirtualBox-${DISTVERSION}-OSE${EXTRACT_SUFX} ${GADISTFILES}
-EXTRACT_ONLY= VirtualBox-${DISTVERSION}-OSE${EXTRACT_SUFX}
+DISTFILES= VirtualBox-${DISTVERSION}${EXTRACT_SUFX} ${GADISTFILES}
+EXTRACT_ONLY= VirtualBox-${DISTVERSION}${EXTRACT_SUFX}
#for discussion please use emulation@FreeBSD.org
MAINTAINER= vbox@FreeBSD.org
@@ -35,6 +34,7 @@ LICENSE_FILE= ${WRKSRC}/COPYING
WRKSRC= ${WRKDIR}/VirtualBox-${PORTVERSION}_OSE
ONLY_FOR_ARCHS= i386 amd64
+USE_CDRTOOLS= yes
USE_GNOME= libidl
USE_BZIP2= yes
USE_PYTHON= yes
@@ -48,6 +48,7 @@ CONFIGURE_ARGS+=--with-gcc="${CC}" --with-g++="${CXX}" --passive-mesa
USE_LDCONFIG= ${PREFIX}/lib/virtualbox
CONFLICTS= bcc-[0-9]*
+CONFLICTS_BUILD= kBuild-devel-[0-9]*
CONFLICTS_INSTALL= virtualbox-ose-[3,4]* virtualbox-ose-devel-[3,4]* virtualbox-ose-additions-[3,4]* virtualbox-ose-additions-devel-[3,4]*
VBOXUSER?= vboxusers
@@ -185,7 +186,7 @@ EXTRA_PATCHES+= ${FILESDIR}/extrapatch-src-VBox-Devices-PC-vbox.dsl
pre-everything::
.if ${ARCH} == "amd64"
-.if !exists(/usr/lib32)
+.if !exists(/usr/lib32/libc.so)
@${ECHO} 'Requires 32-bit libraries installed under /usr/lib32.'
@${ECHO} 'Do: cd /usr/src; make build32 install32; /etc/rc.d/ldconfig restart'
@${FALSE}
@@ -211,6 +212,9 @@ post-patch:
.if defined(WITH_VNC)
@${ECHO} 'VBOX_WITH_VNC = 1' >> ${WRKSRC}/LocalConfig.kmk
.endif
+.if ${OSVERSION} < 800069
+ @${ECHO} 'VBOX_WITH_USB=' >> ${WRKSRC}/LocalConfig.kmk
+.endif
.if defined(WITH_WEBSERVICE)
@${ECHO} 'VBOX_WITH_WEBSERVICES = 1' >> ${WRKSRC}/LocalConfig.kmk
@${ECHO} 'VBOX_GSOAP_INSTALLED = 1' >> ${WRKSRC}/LocalConfig.kmk
@@ -241,7 +245,7 @@ do-install:
(cd ${WRKSRC}/out/${KMK_ARCH}/${KMK_BUILDTYPE}/bin/sdk/bindings/xpcom/include && ${COPYTREE_SHARE} "*" ${PREFIX}/include/virtualbox)
${MKDIR} ${PREFIX}/lib/virtualbox
- (cd ${WRKSRC}/out/${KMK_ARCH}/${KMK_BUILDTYPE}/bin && ${COPYTREE_SHARE} "*.so *.gc *.r0 *.fd components" ${PREFIX}/lib/virtualbox)
+ (cd ${WRKSRC}/out/${KMK_ARCH}/${KMK_BUILDTYPE}/bin && ${COPYTREE_SHARE} "*.so *.gc *.r0 *.fd components VBoxExtPackHelperApp" ${PREFIX}/lib/virtualbox)
.if !defined(WITHOUT_NLS)
${MKDIR} ${DATADIR}/nls
@@ -258,7 +262,7 @@ do-install:
${CHMOD} 4511 ${PREFIX}/lib/virtualbox/${f}
.endfor
-.for f in VBoxManage VBoxSVC VBoxXPCOMIPCD
+.for f in VBoxManage VBoxSVC VBoxXPCOMIPCD VBoxExtPackHelperApp
${CHMOD} 0711 ${PREFIX}/lib/virtualbox/${f}
.endfor
@@ -283,7 +287,7 @@ do-install:
${PYTHON_CMD} -mcompileall ${PYTHON_SITELIBDIR}/xpcom/
post-install:
-.for f in VBoxManage VBoxNetDHCP VBoxSVC VBoxXPCOMIPCD ${VBOX_FRONTENDS}
+.for f in VBoxManage VBoxNetDHCP VBoxSVC VBoxXPCOMIPCD VBoxExtPackHelperApp ${VBOX_FRONTENDS}
${CHOWN} root:${VBOXGROUP} ${PREFIX}/lib/virtualbox/${f}
.endfor
@@ -300,3 +304,4 @@ post-install:
@${CAT} ${PKGMESSAGE}
.include <bsd.port.post.mk>
+
diff --git a/emulators/virtualbox-ose-legacy/distinfo b/emulators/virtualbox-ose-legacy/distinfo
index a04a6e98292d..31b4828107ac 100644
--- a/emulators/virtualbox-ose-legacy/distinfo
+++ b/emulators/virtualbox-ose-legacy/distinfo
@@ -1,4 +1,4 @@
-SHA256 (VirtualBox-3.2.12-OSE.tar.bz2) = 064eb382e5b752a3f9189c930734393765125e70b5f99679a63ff4eb6186e261
-SIZE (VirtualBox-3.2.12-OSE.tar.bz2) = 58239733
-SHA256 (VBoxGuestAdditions_3.2.12.iso) = cae0d7c7d3844188caf01973dc97a722a70b2ba18ff189c9b8e82afb771de436
-SIZE (VBoxGuestAdditions_3.2.12.iso) = 33146880
+SHA256 (VirtualBox-4.0.16.tar.bz2) = d6c165cc41063cb8eb8283606b712904cae180000171fb1f833b7eaada633c77
+SIZE (VirtualBox-4.0.16.tar.bz2) = 70042175
+SHA256 (VBoxGuestAdditions_4.0.16.iso) = 778c7c020b853f999317bd017e2f3e2badc6deebfbec33ae89d7710826fb404e
+SIZE (VBoxGuestAdditions_4.0.16.iso) = 41639936
diff --git a/emulators/virtualbox-ose-legacy/files/patch-src-VBox-Devices-Makefile.kmk b/emulators/virtualbox-ose-legacy/files/patch-src-VBox-Devices-Makefile.kmk
index 098410d5ff94..2cdf6521b3db 100644
--- a/emulators/virtualbox-ose-legacy/files/patch-src-VBox-Devices-Makefile.kmk
+++ b/emulators/virtualbox-ose-legacy/files/patch-src-VBox-Devices-Makefile.kmk
@@ -1,15 +1,13 @@
---- src/VBox/Devices/Makefile.kmk.orig 2009-12-17 15:27:43.000000000 +0100
-+++ src/VBox/Devices/Makefile.kmk 2009-12-21 14:29:56.000000000 +0100
-@@ -31,8 +31,10 @@
- include $(PATH_SUB_CURRENT)/PC/VMI/Makefile.kmk
- endif
- include $(PATH_SUB_CURRENT)/Graphics/BIOS/Makefile.kmk
+--- src/VBox/Devices/Makefile.kmk.orig 2010-12-06 22:42:36.000000000 +0100
++++ src/VBox/Devices/Makefile.kmk 2010-12-06 22:42:59.000000000 +0100
+@@ -22,7 +22,9 @@
+ VBOX_PATH_DEVICES_SRC := $(PATH_SUB_CURRENT)
+
+ # Include sub-makefiles.
-include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
--include $(PATH_SUB_CURRENT)/Storage/testcase/Makefile.kmk
+ifdef VBOX_WITH_TESTCASES
-+ include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
-+ include $(PATH_SUB_CURRENT)/Storage/testcase/Makefile.kmk
++ include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
+endif
- ifndef VBOX_OSE
- include $(PATH_SUB_CURRENT)/Storage/VBoxHDDFormats/Makefile.kmk
- endif
+ if defined(VBOX_WITH_INTEL_PXE) || defined(VBOX_ONLY_EXTPACKS)
+ include $(PATH_SUB_CURRENT)/PC/PXE/Makefile.kmk
+ else ifndef VBOX_WITHOUT_ETHERBOOT
diff --git a/emulators/virtualbox-ose-legacy/files/patch-src-VBox-Devices-Storage-DrvHostDVD.cpp b/emulators/virtualbox-ose-legacy/files/patch-src-VBox-Devices-Storage-DrvHostDVD.cpp
deleted file mode 100644
index 97f764a71d12..000000000000
--- a/emulators/virtualbox-ose-legacy/files/patch-src-VBox-Devices-Storage-DrvHostDVD.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-
---- src/VBox/Devices/Storage/DrvHostDVD.cpp.orig 2010-05-20 10:28:06.000000000 +0300
-+++ src/VBox/Devices/Storage/DrvHostDVD.cpp 2010-05-20 10:37:47.000000000 +0300
-@@ -224,7 +224,7 @@
- */
- static DECLCALLBACK(int) drvHostDvdDoLock(PDRVHOSTBASE pThis, bool fLock)
- {
--#ifdef RT_OS_DARWIN
-+#if defined(RT_OS_FREEBSD) || defined(RT_OS_DARWIN)
- uint8_t abCmd[16] =
- {
- SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL, 0, 0, 0, fLock, 0,
-
-
diff --git a/emulators/virtualbox-ose-legacy/files/patch-src-VBox-Frontends-VBoxManage-VBoxInternalManage.cpp b/emulators/virtualbox-ose-legacy/files/patch-src-VBox-Frontends-VBoxManage-VBoxInternalManage.cpp
deleted file mode 100644
index fdffb0aab896..000000000000
--- a/emulators/virtualbox-ose-legacy/files/patch-src-VBox-Frontends-VBoxManage-VBoxInternalManage.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
---- src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp.orig 2010-12-01 18:09:24.000000000 +0100
-+++ src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp 2011-03-16 10:58:37.000000000 +0100
-@@ -178,8 +178,9 @@
- " (the partitioning information in the MBR file is ignored).\n"
- " The diskname is on Linux e.g. /dev/sda, and on Windows e.g.\n"
- " \\\\.\\PhysicalDrive0).\n"
-- " On Linux host the parameter -relative causes a VMDK file to be created\n"
-- " which refers to individual partitions instead to the entire disk.\n"
-+ " On Linux or FreeBSD host the parameter -relative causes a VMDK file to\n"
-+ " be created which refers to individual partitions instead to the entire\n"
-+ " disk.\n"
- " Optionally the created image can be immediately registered.\n"
- " The necessary partition numbers can be queried with\n"
- " VBoxManage internalcommands listpartitions\n"
-@@ -926,12 +927,12 @@
- {
- fRegister = true;
- }
--#ifdef RT_OS_LINUX
-+#if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
- else if (strcmp(argv[i], "-relative") == 0)
- {
- fRelative = true;
- }
--#endif /* RT_OS_LINUX */
-+#endif /* RT_OS_LINUX || RT_OS_FREEBSD */
- else
- {
- return errorSyntax(USAGE_CREATERAWVMDK, "Invalid parameter '%s'", Utf8Str(argv[i]).raw());
-@@ -1280,10 +1281,16 @@
- {
- if (fRelative)
- {
--#ifdef RT_OS_LINUX
-+#if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
- /* Refer to the correct partition and use offset 0. */
- char *psz;
-- vrc = RTStrAPrintf(&psz, "%s%u", rawdisk.raw(),
-+ vrc = RTStrAPrintf(&psz,
-+#if defined(RT_OS_LINUX)
-+ "%s%u",
-+#elif defined(RT_OS_FREEBSD)
-+ "%ss%u",
-+#endif
-+ rawdisk.raw(),
- partitions.aPartitions[i].uIndex);
- if (RT_FAILURE(vrc))
- {
diff --git a/emulators/virtualbox-ose-legacy/files/patch-src-VBox-Frontends-VirtualBox-src-settings-vm-VBoxVMSettingsHD.h b/emulators/virtualbox-ose-legacy/files/patch-src-VBox-Frontends-VirtualBox-src-settings-vm-VBoxVMSettingsHD.h
deleted file mode 100644
index 6b347df656ca..000000000000
--- a/emulators/virtualbox-ose-legacy/files/patch-src-VBox-Frontends-VirtualBox-src-settings-vm-VBoxVMSettingsHD.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsHD.h.orig 2010-06-04 10:43:02.000000000 +0200
-+++ src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsHD.h 2010-06-04 10:33:40.000000000 +0200
-@@ -20,7 +20,7 @@
- #define __VBoxVMSettingsHD_h__
-
- /* Global includes */
--#include <qglobal.h> /* for Q_WS_MAC */
-+#include <QtGlobal> /* for Q_WS_MAC */
- #ifdef Q_WS_MAC
- /* Somewhere Carbon.h includes AssertMacros.h which defines the macro "check".
- * In QItemDelegate a class method is called "check" also. As we not used the
diff --git a/emulators/virtualbox-ose-legacy/files/patch-src-VBox-Main-freebsd-NetIf-freebsd.cpp b/emulators/virtualbox-ose-legacy/files/patch-src-VBox-Main-freebsd-NetIf-freebsd.cpp
deleted file mode 100644
index 8e706db41fd3..000000000000
--- a/emulators/virtualbox-ose-legacy/files/patch-src-VBox-Main-freebsd-NetIf-freebsd.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
---- src/VBox/Main/freebsd/NetIf-freebsd.cpp.orig 2010-06-07 15:34:44.000000000 +0300
-+++ src/VBox/Main/freebsd/NetIf-freebsd.cpp 2010-06-18 16:45:31.000000000 +0300
-@@ -180,11 +180,16 @@
- char *pBuf, *pNext;
- int aiMib[6];
- unsigned short u16DefaultIface;
-+ int haveDefaultIface;
-
- /* Get the index of the interface associated with default route. */
- rc = getDefaultIfaceIndex(&u16DefaultIface, PF_INET);
-- if (RT_FAILURE(rc))
-- return rc;
-+ haveDefaultIface = 1;
-+ if (RT_FAILURE(rc)) {
-+ Log(("NetIfList: Failed to get default route interface\n"));
-+ haveDefaultIface = 0;
-+ rc = VINF_SUCCESS;
-+ }
-
- aiMib[0] = CTL_NET;
- aiMib[1] = PF_ROUTE;
-@@ -286,7 +291,7 @@
- IfObj.createObject();
- if (SUCCEEDED(IfObj->init(Bstr(pNew->szName), enmType, pNew)))
- /* Make sure the default interface gets to the beginning. */
-- if (pIfMsg->ifm_index == u16DefaultIface)
-+ if (haveDefaultIface == 1 && pIfMsg->ifm_index == u16DefaultIface)
- list.push_front(IfObj);
- else
- list.push_back(IfObj);
diff --git a/emulators/virtualbox-ose-legacy/files/patch-src-VBox-Main-freebsd-HostHardwareFreeBSD.cpp b/emulators/virtualbox-ose-legacy/files/patch-src-VBox-Main-src-server-freebsd-HostHardwareFreeBSD.cpp
index 673526554ff4..69d6260ac6ff 100644
--- a/emulators/virtualbox-ose-legacy/files/patch-src-VBox-Main-freebsd-HostHardwareFreeBSD.cpp
+++ b/emulators/virtualbox-ose-legacy/files/patch-src-VBox-Main-src-server-freebsd-HostHardwareFreeBSD.cpp
@@ -1,5 +1,5 @@
---- src/VBox/Main/freebsd/HostHardwareFreeBSD.cpp.cpp.orig 2011-05-16 12:33:46.000000000 -0400
-+++ src/VBox/Main/freebsd/HostHardwareFreeBSD.cpp 2011-06-24 16:03:37.000000000 -0400
+--- src/VBox/Main/src-server/freebsd/HostHardwareFreeBSD.cpp.orig 2011-05-16 12:33:46.000000000 -0400
++++ src/VBox/Main/src-server/freebsd/HostHardwareFreeBSD.cpp 2011-06-24 16:03:37.000000000 -0400
@@ -35,6 +35,7 @@
#include <iprt/string.h>
diff --git a/emulators/virtualbox-ose-legacy/files/patch-src-VBox-Runtime-r3-freebsd-fileaio-freebsd.c b/emulators/virtualbox-ose-legacy/files/patch-src-VBox-Runtime-r3-freebsd-fileaio-freebsd.c
new file mode 100644
index 000000000000..671bb5552189
--- /dev/null
+++ b/emulators/virtualbox-ose-legacy/files/patch-src-VBox-Runtime-r3-freebsd-fileaio-freebsd.c
@@ -0,0 +1,16 @@
+Runtime/fileaio-freebsd: Fix error check for aio_error
+
+Obtained-from: https://www.virtualbox.org/changeset/38332
+
+--- src/VBox/Runtime/r3/freebsd/fileaio-freebsd.cpp.orig 2011-07-15 17:34:34.000000000 +0200
++++ src/VBox/Runtime/r3/freebsd/fileaio-freebsd.cpp 2011-11-21 09:33:26.155092865 +0100
+@@ -416,7 +416,8 @@
+ {
+ pReqInt = pahReqs[i];
+ rcBSD = aio_error(&pReqInt->AioCB);
+- if (rcBSD == EINVAL || rcBSD == EAGAIN)
++ if ( rcBSD == -1
++ && errno == EINVAL)
+ {
+ /* Was not submitted. */
+ RTFILEAIOREQ_SET_STATE(pReqInt, PREPARED);
diff --git a/emulators/virtualbox-ose-legacy/files/patch-src-VBox-VMM-VMMR3-CPUM.cpp b/emulators/virtualbox-ose-legacy/files/patch-src-VBox-VMM-VMMR3-CPUM.cpp
new file mode 100644
index 000000000000..5bb1888abe18
--- /dev/null
+++ b/emulators/virtualbox-ose-legacy/files/patch-src-VBox-VMM-VMMR3-CPUM.cpp
@@ -0,0 +1,12 @@
+--- src/VBox/VMM/VMMR3/CPUM.cpp (Revision 71439)
++++ src/VBox/VMM/VMMR3/CPUM.cpp (Revision 71440)
+@@ -999,7 +999,8 @@
+ */
+ if (!fHWVirtExEnabled)
+ {
+- Assert(pVM->cpum.s.aGuestCpuIdStd[4].eax == 0);
++ Assert( pVM->cpum.s.aGuestCpuIdStd[4].eax == 0
++ || pVM->cpum.s.aGuestCpuIdStd[0].eax < 0x4);
+ pVM->cpum.s.aGuestCpuIdStd[4].eax = 0;
+ }
+ }
diff --git a/emulators/virtualbox-ose-legacy/pkg-message b/emulators/virtualbox-ose-legacy/pkg-message
index a5c046c48a13..93aa94f86927 100644
--- a/emulators/virtualbox-ose-legacy/pkg-message
+++ b/emulators/virtualbox-ose-legacy/pkg-message
@@ -6,15 +6,45 @@ You need to load the vboxdrv kernel module via /boot/loader.conf:
vboxdrv_load="YES"
+You also have to add all users to your vboxusers group in order to use vbox.
+
+% pw groupmod vboxusers -m jerry
+
+Reboot the machine to load the needed kernel modules.
+
+
+Bridging Support:
+=================
+
For bridged networking please add the following line to your /etc/rc.conf:
vboxnet_enable="YES"
-Reboot the machine to load the needed kernel modules.
-You also have to add all users to your vboxusers group in order to use vbox.
+USB Support:
+============
-% pw groupmod vboxusers -m jerry
+For USB support your user needs to be in the operator group and needs read
+and write permissions to the USB device.
+
+% pw groupmod operator -m jerry
+
+Add the following to /etc/devfs.rules (create if it doesn't exist):
+
+[system=10]
+add path 'usb/*' mode 0660 group operator
+
+To load these new rule add the following to /etc/rc.conf:
+
+devfs_system_ruleset="system"
+
+Then restart devfs to load the new rules:
+
+% /etc/rc.d/devfs restart
+
+
+Troubleshooting:
+================
Running VirtualBox as non-root user may fail with a fatal error
NS_ERROR_FACTORY_NOT_REGISTERED. In this case delete /tmp/.vbox-*-ipc file.
diff --git a/emulators/virtualbox-ose-legacy/pkg-plist b/emulators/virtualbox-ose-legacy/pkg-plist
index 6335f59569a9..740c84ec3c9c 100644
--- a/emulators/virtualbox-ose-legacy/pkg-plist
+++ b/emulators/virtualbox-ose-legacy/pkg-plist
@@ -12,11 +12,16 @@ bin/VBoxXPCOMIPCD
%%WEB%%bin/webtest
%%X11%%lib/virtualbox/VBoxBFE
%%X11%%lib/virtualbox/VBoxBFE.so
+lib/virtualbox/DBGCPlugInDiggers.so
+lib/virtualbox/VBoxAuth.so
+lib/virtualbox/VBoxAuthSimple.so
+%%QT4%%lib/virtualbox/VBoxDbg.so
lib/virtualbox/VBoxDD.so
lib/virtualbox/VBoxDD2.so
lib/virtualbox/VBoxDDU.so
lib/virtualbox/VBoxEFI32.fd
lib/virtualbox/VBoxEFI64.fd
+lib/virtualbox/VBoxExtPackHelperApp
lib/virtualbox/VBoxGuestControlSvc.so
lib/virtualbox/VBoxGuestPropSvc.so
lib/virtualbox/VBoxHeadless