Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Jun 2023 12:02:07 GMT
From:      Vladimir Druzenko <vvd@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 23eed6a75321 - main - emulators/virtualbox-ose{,-legacy}: sort out options
Message-ID:  <202306281202.35SC27I0091345@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by vvd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=23eed6a75321443d7c6c45b92b28ff0e314e0496

commit 23eed6a75321443d7c6c45b92b28ff0e314e0496
Author:     Vladimir Druzenko <vvd@FreeBSD.org>
AuthorDate: 2023-06-28 11:57:14 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2023-06-28 12:02:00 +0000

    emulators/virtualbox-ose{,-legacy}: sort out options
    
    Sort out options: order (portlint), convert to OPTION_*.
    Add entry in "Troubleshooting" about "VERR_NO_MEMORY".
    Force devel/llvm15 for emulators/virtualbox-ose-legacy on recent 14 with
    llvm16 in base.
    
    PR:                     200764 252227
    Approved by:            arrowd (mentor)
    Differential Revision:  https://reviews.freebsd.org/D40751
---
 emulators/virtualbox-ose-legacy/Makefile           | 98 ++++++++++------------
 .../virtualbox-ose-legacy/files/patch-configure    | 26 ++++--
 emulators/virtualbox-ose-legacy/pkg-message        | 30 ++++++-
 emulators/virtualbox-ose/Makefile                  | 91 +++++++++-----------
 emulators/virtualbox-ose/files/patch-configure     | 26 ++++--
 emulators/virtualbox-ose/files/pkg-message.in      | 32 ++++++-
 6 files changed, 176 insertions(+), 127 deletions(-)

diff --git a/emulators/virtualbox-ose-legacy/Makefile b/emulators/virtualbox-ose-legacy/Makefile
index be9897e5f61a..63d777d9f90e 100644
--- a/emulators/virtualbox-ose-legacy/Makefile
+++ b/emulators/virtualbox-ose-legacy/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	virtualbox-ose
 PORTVERSION=	5.2.44
-PORTREVISION=	14
+PORTREVISION=	15
 CATEGORIES=	emulators
 MASTER_SITES=	https://download.oracle.com/virtualbox/${PORTVERSION}/
 PKGNAMESUFFIX?=	-legacy
@@ -14,24 +14,24 @@ WWW=		https://www.virtualbox.org/
 LICENSE=	GPLv2
 LICENSE_FILE=	${WRKSRC}/COPYING
 
+ONLY_FOR_ARCHS=	amd64 i386
+
 PATCH_DEPENDS+=	${LOCALBASE}/share/kBuild/tools/GXX3.kmk:devel/kBuild
-BUILD_DEPENDS=	yasm:devel/yasm \
-		xsltproc:textproc/libxslt \
+BUILD_DEPENDS=	gtar:archivers/gtar \
 		kmk:devel/kBuild \
-		gtar:archivers/gtar
+		libIDL-config-2:devel/libIDL \
+		yasm:devel/yasm \
+		xsltproc:textproc/libxslt
 LIB_DEPENDS=	libpng.so:graphics/png \
-		libxslt.so:textproc/libxslt \
 		libcurl.so:ftp/curl
 RUN_DEPENDS=	${LOCALBASE}/etc/rc.d/vboxnet:emulators/virtualbox-ose-kmod-legacy
 
+USES=		compiler:c++14-lang cpe gnome iconv pkgconfig ssl tar:bzip2
+USE_GNOME=	libxml2
+
 CPE_VENDOR=	oracle
 CPE_PRODUCT=	vm_virtualbox
 
-WRKSRC=		${WRKDIR}/VirtualBox-${PORTVERSION}
-ONLY_FOR_ARCHS=	i386 amd64
-USES=		compiler:c++14-lang cpe gnome iconv pkgconfig ssl tar:bzip2
-USE_GNOME=	libidl libxml2
-
 HAS_CONFIGURE=	yes
 CONFIGURE_ARGS=	--disable-java --passive-mesa
 CONFIGURE_ARGS+=	--with-gcc="${CC}" --with-g++="${CXX}"
@@ -41,9 +41,9 @@ CONFLICTS_INSTALL=	virtualbox-ose-additions-* \
 			virtualbox-ose \
 			virtualbox-ose-lite
 
-PORTSCOUT=	limit:^5\.
+WRKSRC=		${WRKDIR}/VirtualBox-${PORTVERSION}
 
-LDFLAGS=	-lpthread
+PORTSCOUT=	limit:^5\.
 
 VBOXUSER?=	vboxusers
 VBOXWSUSER?=	vboxusers
@@ -59,20 +59,20 @@ VBOX_PROGS=	VBoxAutostart VBoxBalloonCtrl VBoxBugReport VBoxHeadless \
 VBOX_UTILS=	VBoxExtPackHelperApp VBoxNetAdpCtl VBoxNetDHCP VBoxNetNAT \
 		VBoxSVC VBoxXPCOMIPCD
 
-OPTIONS_DEFINE=	ALSA DBUS DEBUG DOCS GUESTADDITIONS NLS PULSEAUDIO \
-		PYTHON QT5 R0LOGGING UDPTUNNEL VDE VNC WEBSERVICE VPX X11
+OPTIONS_DEFINE=		ALSA DBUS DEBUG DOCS GUESTADDITIONS NLS PULSEAUDIO \
+			PYTHON QT5 R0LOGGING UDPTUNNEL VDE VNC WEBSERVICE VPX X11
 OPTIONS_DEFAULT=	DBUS QT5 UDPTUNNEL VNC WEBSERVICE X11
-OPTIONS_SUB=	yes
+OPTIONS_SUB=		yes
 
-DEBUG_DESC=	Debug symbols, additional logs and assertions
+DEBUG_DESC=		Debug symbols, additional logs and assertions
 GUESTADDITIONS_DESC=	Build with Guest Additions
-NLS_DESC=	Native language support (requires QT5)
-QT5_DESC=	Build with QT5 frontend (requires X11)
-R0LOGGING_DESC=	Enable R0 logging (requires DEBUG)
-UDPTUNNEL_DESC=	Build with UDP tunnel support
-VDE_DESC=	Build with VDE support
-VNC_DESC=	Build with VNC support
-VPX_DESC=	Use libvpx for video recording
+NLS_DESC=		Native language support (requires QT5)
+QT5_DESC=		Build with QT5 frontend (requires X11)
+R0LOGGING_DESC=		Enable R0 logging (requires DEBUG)
+UDPTUNNEL_DESC=		Build with UDP tunnel support
+VDE_DESC=		Build with VDE support
+VNC_DESC=		Build with VNC support
+VPX_DESC=		Use libvpx for video recording
 WEBSERVICE_DESC=	Build Webservice
 
 ALSA_CONFIGURE_OFF=	--disable-alsa
@@ -80,12 +80,25 @@ ALSA_LIB_DEPENDS=	libasound.so:audio/alsa-lib
 DBUS_CONFIGURE_OFF=	--disable-dbus
 DBUS_LIB_DEPENDS=	libdbus-1.so:devel/dbus
 DEBUG_CONFIGURE_ON=	--build-debug
+DOCS_USES=		tex
+DOCS_USE=		TEX=dvipsk:build,formats:build
 DOCS_BUILD_DEPENDS=	${LOCALBASE}/share/xml/docbook/4.4/docbookx.dtd:textproc/docbook-xml
 DOCS_CONFIGURE_OFF=	--disable-docs
+DOCS_VARS=		dbkxmldir=${LOCALBASE}/share/xml/docbook/4.4 \
+			dbkxsldir=${LOCALBASE}/share/xsl/docbook
 NLS_IMPLIES=		QT5
 PULSEAUDIO_CONFIGURE_OFF=	--disable-pulse
 PULSEAUDIO_LIB_DEPENDS=	libpulse.so:audio/pulseaudio
+PYTHON_USES=		python
+PYTHON_USES_OFF=	python:build
+PYTHON_USE=		PYTHON=distutils,noegginfo,noflavors
 PYTHON_CONFIGURE_OFF=	--disable-python
+PYTHON_VARS=		pydistutils_pkgname=vboxapi pydistutils_pkgversion=1.0
+QT5_USES=		gl qmake:no_env qt:5 xorg
+QT5_USE=		QT=buildtools:build,core,dbus,gui,linguisttools:build,opengl \
+			QT=printsupport,widgets,x11extras XORG=xcb GL=gl
+QT5_CONFIGURE_ON=	--enable-qt5
+QT5_CONFIGURE_OFF=	--disable-qt
 QT5_IMPLIES=		X11
 R0LOGGING_IMPLIES=	DEBUG
 UDPTUNNEL_CONFIGURE_OFF=	--disable-udptunnel
@@ -95,6 +108,9 @@ VNC_CONFIGURE_ON=	--enable-vnc
 VNC_LIB_DEPENDS=	libvncserver.so:net/libvncserver
 VPX_CONFIGURE_OFF=	--disable-libvpx
 VPX_LIB_DEPENDS=	libvpx.so:multimedia/libvpx
+WEBSERVICE_BUILD_DEPENDS=	soapcpp2:devel/gsoap
+X11_USES=		sdl xorg
+X11_USE=		SDL=sdl XORG=x11,xcursor,xext,xinerama,xmu,xorgproto,xt
 X11_CONFIGURE_OFF=	--build-headless
 
 ENV=
@@ -119,7 +135,7 @@ CONFLICTS_INSTALL+=	virtualbox-ose
 .endif
 
 .if ${ARCH} == "amd64"
-_ELF32!=	kldstat -q -m elf32 && echo yes || echo no
+_ELF32!=	kldstat -q -m elf32 && ${ECHO_CMD} yes || ${ECHO_CMD} no
 .endif
 
 .if ${PORT_OPTIONS:MDEBUG}
@@ -138,49 +154,22 @@ LICENSE_PERMS_Additions=	auto-accept
 LICENSE_DISTFILES_Additions=	${GUESTADDITIONS}
 .endif
 
-.if ${PORT_OPTIONS:MDOCS}
-DBKXMLDIR=	${LOCALBASE}/share/xml/docbook/4.4
-DBKXSLDIR=	${LOCALBASE}/share/xsl/docbook
-USES+=		tex
-USE_TEX=	dvipsk:build formats:build
-.endif
-
-.if ${PORT_OPTIONS:MPYTHON}
-USES+=		python
-USE_PYTHON=	distutils noegginfo noflavors
-PYDISTUTILS_PKGNAME=	vboxapi
-PYDISTUTILS_PKGVERSION=	1.0
-.else
-USES+=		python:build
-.endif
-
 .if ${PORT_OPTIONS:MQT5}
-CONFIGURE_ARGS+=	--enable-qt5
 PLIST_SUB+=	QT=""
-USES+=		gl qmake:no_env qt:5 xorg
-USE_GL=		gl glu
-USE_QT=		buildtools:build core dbus gui linguisttools:build opengl
-USE_QT+=	printsupport widgets x11extras
-USE_XORG=	xcb
 VBOX_PROGS+=	VirtualBox
 VBOX_UTILS+=	VBoxTestOGL
 VBOX_WITH_QT=	1
 .else
-CONFIGURE_ARGS+=	--disable-qt
 PLIST_SUB+=	QT="@comment "
 .endif
 
 .if ${PORT_OPTIONS:MWEBSERVICE}
-BUILD_DEPENDS+=	soapcpp2:devel/gsoap
 USE_RC_SUBR+=	vboxwebsrv
 VBOX_LINKS+=	vboxwebsrv
 VBOX_UTILS+=	vboxwebsrv webtest
 .endif
 
 .if ${PORT_OPTIONS:MX11}
-USES+=		sdl
-USE_SDL=	sdl
-USE_XORG+=	xorgproto x11 xcursor xext xinerama xmu xt
 VBOX_PROGS+=	VBoxSDL
 .endif
 
@@ -207,10 +196,11 @@ KMK_FLAGS+=	-j${MAKE_JOBS_NUMBER}
 .include <bsd.port.pre.mk>
 
 .if ${CHOSEN_COMPILER_TYPE} == clang && ${OPSYS} == FreeBSD && \
-    (${OSVERSION} < 1302505 || (${OSVERSION} >= 1400000 && ${OSVERSION} < 1400079))
-# llvm 13 and 14 included in FreeBSD fails to compile this legacy version of
+    (${OSVERSION} < 1302505 || (${OSVERSION} >= 1400000 && ${OSVERSION} < 1400079) || \
+    ${OSVERSION} >= 1400091)
+# llvm 13, 14 and 16 included in FreeBSD fails to compile this legacy version of
 # virtualbox-ose, force llvm 15 on all versions of the FreeBSD except lastest 13
-# and 14 where the llvm 15 is included: PR#265539.
+# and several versions of 14 where the llvm 15 is included: PR#265539.
 # Keep possibility to define different llvm via VBOX_LLVM_VER in make.conf.
 BUILD_DEPENDS+=	clang${VBOX_LLVM_VER}:devel/llvm${VBOX_LLVM_VER}
 CC=		clang${VBOX_LLVM_VER}
diff --git a/emulators/virtualbox-ose-legacy/files/patch-configure b/emulators/virtualbox-ose-legacy/files/patch-configure
index 31d4bd082fe3..2615fdf98164 100644
--- a/emulators/virtualbox-ose-legacy/files/patch-configure
+++ b/emulators/virtualbox-ose-legacy/files/patch-configure
@@ -25,7 +25,17 @@
        elif [ $cc_maj -lt 4 \
               -o \( $cc_maj -eq 4 -a $cc_min -lt 4 -a "$OS" != "darwin" \) \
               -o \( $cc_maj -eq 4 -a $cc_min -lt 2 -a "$OS"  = "darwin" \) ]; then
-@@ -1208,7 +1215,7 @@ extern "C" int main(void)
+@@ -1114,6 +1116,9 @@ extern "C" int main(int argc, char** arg
+   printf("found version %d.%d.%d",
+          SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
+ #if SDL_VERSION_ATLEAST(1,2,7)
++#if !defined(SDL_VIDEO_DRIVER_X11)
++#error SDL must be compiled with X11 support
++#endif
+   printf(", OK.\n");
+   return 0;
+ #else
+@@ -1208,7 +1218,7 @@ extern "C" int main(void)
  #endif
  }
  EOF
@@ -34,7 +44,7 @@
      test_execute
    fi
  }
-@@ -1508,8 +1515,7 @@ EOF
+@@ -1508,8 +1518,7 @@ EOF
          if [ $? -eq 0 ]; then
            echo "(Qt5 from pkg-config)" >> $LOG
            FLGQT5=`pkg-config Qt5Core --cflags`
@@ -44,7 +54,7 @@
            INCQT5=`strip_I "$FLGQT5"`
            LIBDIR5=`pkg-config Qt5Core --variable=libdir`
            LIBQT5=`pkg-config Qt5Core --libs`
-@@ -1648,7 +1654,7 @@ check_libopus()
+@@ -1648,7 +1657,7 @@ check_libopus()
        fi
        cat > $ODIR.tmp_src.cc << EOF
  #include <cstdio>
@@ -53,7 +63,7 @@
  extern "C" int main(void)
  {
    OpusEncoder *test;
-@@ -1980,8 +1986,8 @@ EOF
+@@ -1980,8 +1989,8 @@ EOF
          echo "compiling the following source file:" >> $LOG
          cat $ODIR.tmp_src.cc >> $LOG
          echo "using the following command line:" >> $LOG
@@ -64,7 +74,7 @@
          if [ $? -eq 0 ]; then
            found=1
            break
-@@ -2453,7 +2459,7 @@ for option in "$@"; do
+@@ -2453,7 +2462,7 @@ for option in "$@"; do
      --with-openssl-dir=*)
        OPENSSLDIR=`echo $option | cut -d'=' -f2`
        INCCRYPTO="-I${OPENSSLDIR}/include"
@@ -73,7 +83,7 @@
        ;;
      --with-ow-dir=*)
        WATCOM=`echo $option | cut -d'=' -f2`
-@@ -2767,7 +2773,7 @@ if [ $ONLY_ADDITIONS -eq 0 ]; then
+@@ -2767,7 +2776,7 @@ if [ $ONLY_ADDITIONS -eq 0 ]; then
    check_ssl
    check_curl
    [ $WITH_LIBVPX -eq 1 ] && check_vpx
@@ -82,7 +92,7 @@
   [ "$OS" != "darwin"  ] && check_z
    [ "$OS" != "darwin"  ] && check_png
    [ $OSE -eq 0 -a "$OS" = "linux" ] && check_pam
-@@ -2788,13 +2794,20 @@ if [ $ONLY_ADDITIONS -eq 0 ]; then
+@@ -2788,13 +2797,20 @@ if [ $ONLY_ADDITIONS -eq 0 ]; then
    [ $WITH_PYTHON -eq 1 ] && check_python
    [ $WITH_JAVA   -eq 1 ] && check_java
  
@@ -104,7 +114,7 @@
   fi
  fi
  
-@@ -2810,14 +2823,6 @@ if [ "$OS" = "linux" ]; then
+@@ -2810,14 +2826,6 @@ if [ "$OS" = "linux" ]; then
      cnf_append "VBOX_WITHOUT_LINUX_TEST_BUILDS" "1"
    fi
    if [ $ONLY_ADDITIONS -eq 0 ]; then
diff --git a/emulators/virtualbox-ose-legacy/pkg-message b/emulators/virtualbox-ose-legacy/pkg-message
index 0cf6996bbefa..f84973069c19 100644
--- a/emulators/virtualbox-ose-legacy/pkg-message
+++ b/emulators/virtualbox-ose-legacy/pkg-message
@@ -53,15 +53,39 @@ NS_ERROR_FACTORY_NOT_REGISTERED. In this case delete /tmp/.vbox-*-ipc file.
 If you experience "Network: write Failed: Cannot allocate memory" errors
 try to increase net.graph.maxdata in /boot/loader.conf
 
-If you are using AIO, then increase these limits (PR#168298):
+If you are using AIO, then increase these limits (https://bugs.freebsd.org/168298):
 vfs.aio.max_buf_aio=8192
 vfs.aio.max_aio_queue_per_proc=65536
 vfs.aio.max_aio_per_proc=8192
 vfs.aio.max_aio_queue=65536
 To check if AIO is used use: kldstat -v | grep aio
 
-Check wiki page for known issues and troubleshooting:
-http://wiki.freebsd.org/VirtualBox
+If you are experiencing VMs freezes with an error in VBox.log such as:
+"
+00:01:29.590192 AssertLogRel /usr/ports/emulators/virtualbox-ose-legacy/work/VirtualBox-5.2.44
+/src/VBox/VMM/VMMR3/PGMPhys.cpp(5148) int PGMR3PhysAllocateHandyPages(PVM): RT_SUCCESS(rc)
+00:01:29.590221 87/128: idPage=0x3d400 HCPhysGCPhys=000000027eaed000 rc=VERR_NO_MEMORY
+00:01:29.590247 Changing the VM state from 'RUNNING' to 'GURU_MEDITATION'
+00:01:29.590261 Console: Machine state changed to 'GuruMeditation'
+00:01:29.590695 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+00:01:29.590696 !!
+00:01:29.590697 !!         VCPU0: Guru Meditation -8 (VERR_NO_MEMORY)
+"
+and see a lot of free RAM, then increase sysctl vm.max_user_wired
+(https://bugs.freebsd.org/252227).
+For dedicated VM servers, a good start is:
+("RAM in GB" - max(1, "RAM in GB" / 32)) * 1024*1024*1024 / PAGE_SIZE
+PAGE_SIZE on x86 is 4096.
+Examples with different RAM sizes in GB:
+ 16: ( 16-max(1, 16/32)*1024*1024*1024/4096 = 3932160  =>  15GB
+ 32: ( 32-max(1, 32/32)*1024*1024*1024/4096 = 8126464  =>  31GB
+ 48: ( 48-max(1, 48/32)*1024*1024*1024/4096 = 12189696 =>  46.5GB
+ 64: ( 64-max(1, 64/32)*1024*1024*1024/4096 = 16252928 =>  62GB
+128: (128-max(1,128/32)*1024*1024*1024/4096 = 32505856 => 124GB
+256: (256-max(1,256/32)*1024*1024*1024/4096 = 65011712 => 248GB
+
+Check the wiki page for known issues and troubleshooting:
+https://wiki.freebsd.org/VirtualBox
 
 Please report any problems to emulation@. Thanks!
 EOM
diff --git a/emulators/virtualbox-ose/Makefile b/emulators/virtualbox-ose/Makefile
index cf5b211e33f5..0a55dc1a5999 100644
--- a/emulators/virtualbox-ose/Makefile
+++ b/emulators/virtualbox-ose/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	virtualbox-ose
 PORTVERSION=	6.1.44
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	emulators
 MASTER_SITES=	https://download.virtualbox.org/virtualbox/${PORTVERSION}/
 DISTFILES=	VirtualBox-${PORTVERSION}${EXTRACT_SUFX} ${GUESTADDITIONS}
@@ -13,23 +13,23 @@ WWW=		https://www.virtualbox.org/
 LICENSE=	GPLv2
 LICENSE_FILE=	${WRKSRC}/COPYING
 
-BUILD_DEPENDS=	yasm:devel/yasm \
-		xsltproc:textproc/libxslt \
+ONLY_FOR_ARCHS=	amd64
+
+BUILD_DEPENDS=	gtar:archivers/gtar \
 		kmk:devel/kBuild \
-		gtar:archivers/gtar
+		libIDL-config-2:devel/libIDL \
+		yasm:devel/yasm \
+		xsltproc:textproc/libxslt
 LIB_DEPENDS=	libpng.so:graphics/png \
-		libxslt.so:textproc/libxslt \
 		libcurl.so:ftp/curl
 RUN_DEPENDS=	${LOCALBASE}/etc/rc.d/vboxnet:emulators/virtualbox-ose-kmod
 
+USES=		compiler:c++14-lang cpe gnome iconv pkgconfig ssl tar:bzip2
+USE_GNOME=	libxml2
+
 CPE_VENDOR=	oracle
 CPE_PRODUCT=	vm_virtualbox
 
-WRKSRC=		${WRKDIR}/VirtualBox-${PORTVERSION}
-ONLY_FOR_ARCHS=	amd64
-USES=		compiler:c++14-lang cpe gnome iconv pkgconfig ssl tar:bzip2
-USE_GNOME=	libidl libxml2
-
 HAS_CONFIGURE=	yes
 CONFIGURE_ARGS=	--disable-java --passive-mesa
 CONFIGURE_ARGS+=	--with-gcc="${CC}" --with-g++="${CXX}"
@@ -39,6 +39,8 @@ CONFLICTS_INSTALL=	virtualbox-ose-additions-* \
 			virtualbox-ose-legacy \
 			virtualbox-ose-lite
 
+WRKSRC=		${WRKDIR}/VirtualBox-${PORTVERSION}
+
 VBOXUSER?=	vboxusers
 VBOXWSUSER?=	vboxusers
 VBOXGROUP?=	vboxusers
@@ -55,25 +57,25 @@ VBOX_UTILS=	VBoxExtPackHelperApp VBoxNetAdpCtl VBoxNetDHCP VBoxNetNAT \
 
 SUB_FILES=	pkg-message
 
-OPTIONS_DEFINE=	AIO ALSA DBUS DEBUG DOCS GUESTADDITIONS NLS OPUS PULSEAUDIO \
-		PYTHON QT5 R0LOGGING UDPTUNNEL VDE VNC WEBSERVICE VPX X11
+OPTIONS_DEFINE=		AIO ALSA DBUS DEBUG DOCS GUESTADDITIONS NLS OPUS PULSEAUDIO \
+			PYTHON QT5 R0LOGGING UDPTUNNEL VDE VNC WEBSERVICE VPX X11
 OPTIONS_DEFAULT=	AIO DBUS QT5 UDPTUNNEL VNC WEBSERVICE X11
 # Since version 6.1.24 pulseaudio is broken at runtime, preventing
 # virtual machines from starting if configured to use it.
 OPTIONS_EXCLUDE+=	PULSEAUDIO
-OPTIONS_SUB=	yes
+OPTIONS_SUB=		yes
 
-AIO_DESC=	Enable Asyncronous IO support (check pkg-message)
-DEBUG_DESC=	Debug symbols, additional logs and assertions
+AIO_DESC=		Enable Asyncronous IO support (check pkg-message)
+DEBUG_DESC=		Debug symbols, additional logs and assertions
 GUESTADDITIONS_DESC=	Build with Guest Additions
-NLS_DESC=	Native language support (requires QT5)
-OPUS_DESC=	Use libvpx for audio recording (requires VPX)
-QT5_DESC=	Build with QT5 frontend (requires X11)
-R0LOGGING_DESC=	Enable R0 logging (requires DEBUG)
-UDPTUNNEL_DESC=	Build with UDP tunnel support
-VDE_DESC=	Build with VDE support
-VNC_DESC=	Build with VNC support
-VPX_DESC=	Use libvpx for video recording
+NLS_DESC=		Native language support (requires QT5)
+OPUS_DESC=		Use libvpx for audio recording (requires VPX)
+QT5_DESC=		Build with QT5 frontend (requires X11)
+R0LOGGING_DESC=		Enable R0 logging (requires DEBUG)
+UDPTUNNEL_DESC=		Build with UDP tunnel support
+VDE_DESC=		Build with VDE support
+VNC_DESC=		Build with VNC support
+VPX_DESC=		Use libvpx for video recording
 WEBSERVICE_DESC=	Build Webservice
 
 ALSA_CONFIGURE_OFF=	--disable-alsa
@@ -81,15 +83,28 @@ ALSA_LIB_DEPENDS=	libasound.so:audio/alsa-lib
 DBUS_CONFIGURE_OFF=	--disable-dbus
 DBUS_LIB_DEPENDS=	libdbus-1.so:devel/dbus
 DEBUG_CONFIGURE_ON=	--build-debug
+DOCS_USES=		tex
+DOCS_USE=		TEX=dvipsk:build,formats:build
 DOCS_BUILD_DEPENDS=	${LOCALBASE}/share/xml/docbook/4.4/docbookx.dtd:textproc/docbook-xml
 DOCS_CONFIGURE_OFF=	--disable-docs
+DOCS_VARS=		dbkxmldir=${LOCALBASE}/share/xml/docbook/4.4 \
+			dbkxsldir=${LOCALBASE}/share/xsl/docbook
 NLS_IMPLIES=		QT5
 OPUS_CONFIGURE_OFF=	--disable-libopus
 OPUS_LIB_DEPENDS=	libopus.so:audio/opus
 OPUS_IMPLIES=		VPX
 PULSEAUDIO_CONFIGURE_OFF=	--disable-pulse
 PULSEAUDIO_LIB_DEPENDS=	libpulse.so:audio/pulseaudio
+PYTHON_USES=		python
+PYTHON_USES_OFF=	python:build
+PYTHON_USE=		PYTHON=distutils,noegginfo,noflavors
 PYTHON_CONFIGURE_OFF=	--disable-python
+PYTHON_VARS=		pydistutils_pkgname=vboxapi pydistutils_pkgversion=1.0
+QT5_USES=		gl qmake:no_env qt:5 xorg
+QT5_USE=		QT=buildtools:build,core,dbus,gui,linguisttools:build,opengl \
+			QT=printsupport,widgets,x11extras XORG=xcb GL=gl
+QT5_CONFIGURE_ON=	--enable-qt5
+QT5_CONFIGURE_OFF=	--disable-qt
 QT5_IMPLIES=		X11
 R0LOGGING_IMPLIES=	DEBUG
 UDPTUNNEL_CONFIGURE_OFF=	--disable-udptunnel
@@ -99,6 +114,9 @@ VNC_CONFIGURE_ON=	--enable-vnc
 VNC_LIB_DEPENDS=	libvncserver.so:net/libvncserver
 VPX_CONFIGURE_OFF=	--disable-libvpx
 VPX_LIB_DEPENDS=	libvpx.so:multimedia/libvpx
+WEBSERVICE_BUILD_DEPENDS=	soapcpp2:devel/gsoap
+X11_USES=		sdl xorg
+X11_USE=		SDL=sdl XORG=x11,xcursor,xext,xinerama,xmu,xorgproto,xt
 X11_CONFIGURE_OFF=	--build-headless
 
 ENV=
@@ -140,49 +158,22 @@ LICENSE_PERMS_Additions=	auto-accept
 LICENSE_DISTFILES_Additions=	${GUESTADDITIONS}
 .endif
 
-.if ${PORT_OPTIONS:MDOCS}
-DBKXMLDIR=	${LOCALBASE}/share/xml/docbook/4.4
-DBKXSLDIR=	${LOCALBASE}/share/xsl/docbook
-USES+=		tex
-USE_TEX=	dvipsk:build formats:build
-.endif
-
-.if ${PORT_OPTIONS:MPYTHON}
-USES+=		python
-USE_PYTHON=	distutils noegginfo noflavors
-PYDISTUTILS_PKGNAME=	vboxapi
-PYDISTUTILS_PKGVERSION=	1.0
-.else
-USES+=		python:build
-.endif
-
 .if ${PORT_OPTIONS:MQT5}
-CONFIGURE_ARGS+=	--enable-qt5
 PLIST_SUB+=	QT=""
-USES+=		gl qmake:no_env qt:5 xorg
-USE_GL=		gl glu
-USE_QT=		buildtools:build core dbus gui linguisttools:build opengl
-USE_QT+=	printsupport widgets x11extras
-USE_XORG=	xcb
 VBOX_PROGS+=	VirtualBox VirtualBoxVM
 VBOX_UTILS+=	VBoxTestOGL
 VBOX_WITH_QT=	1
 .else
-CONFIGURE_ARGS+=	--disable-qt
 PLIST_SUB+=	QT="@comment "
 .endif
 
 .if ${PORT_OPTIONS:MWEBSERVICE}
-BUILD_DEPENDS+=	soapcpp2:devel/gsoap
 USE_RC_SUBR+=	vboxwebsrv
 VBOX_LINKS+=	vboxwebsrv
 VBOX_UTILS+=	vboxwebsrv webtest
 .endif
 
 .if ${PORT_OPTIONS:MX11}
-USES+=		sdl xorg
-USE_SDL=	sdl
-USE_XORG+=	xorgproto x11 xcursor xext xinerama xmu xt
 VBOX_PROGS+=	VBoxSDL
 .endif
 
diff --git a/emulators/virtualbox-ose/files/patch-configure b/emulators/virtualbox-ose/files/patch-configure
index 3880fbe51577..25015e642bc1 100644
--- a/emulators/virtualbox-ose/files/patch-configure
+++ b/emulators/virtualbox-ose/files/patch-configure
@@ -15,7 +15,17 @@
  else
    INCCURL=""
    LIBCURL="-lcurl"
-@@ -1257,7 +1261,7 @@ extern "C" int main(void)
+@@ -1173,6 +1177,9 @@ extern "C" int main(int argc, char** arg
+   printf("found version %d.%d.%d",
+          SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
+ #if SDL_VERSION_ATLEAST(1,2,7)
++#if !defined(SDL_VIDEO_DRIVER_X11)
++#error SDL must be compiled with X11 support
++#endif
+   printf(", OK.\n");
+   return 0;
+ #else
+@@ -1257,7 +1264,7 @@ extern "C" int main(void)
  #endif
  }
  EOF
@@ -24,7 +34,7 @@
      test_execute
    fi
  }
-@@ -1564,6 +1568,7 @@ EOF
+@@ -1564,6 +1571,7 @@ EOF
            FLGQT5=`pkg-config Qt5Core --cflags`
            # gcc 4.8 is able to compile with C++11 (see also VBOX_GCC_std in Config.kmk)
            [ $(($cc_maj * 100 + $cc_min)) -ge 408 ] && FLGQT5="$FLGQT5 -std=c++11"
@@ -32,7 +42,7 @@
            INCQT5=`strip_I "$FLGQT5"`
            LIBDIR5=`pkg-config Qt5Core --variable=libdir`
            LIBQT5=`pkg-config Qt5Core Qt5Gui --libs`
-@@ -1702,7 +1707,7 @@ check_libopus()
+@@ -1702,7 +1710,7 @@ check_libopus()
        fi
        cat > $ODIR.tmp_src.cc << EOF
  #include <cstdio>
@@ -41,7 +51,7 @@
  extern "C" int main(void)
  {
    OpusEncoder *test;
-@@ -2034,8 +2039,8 @@ EOF
+@@ -2034,8 +2042,8 @@ EOF
          echo "compiling the following source file:" >> $LOG
          cat $ODIR.tmp_src.cc >> $LOG
          echo "using the following command line:" >> $LOG
@@ -52,7 +62,7 @@
          if [ $? -eq 0 ]; then
            found=1
            break
-@@ -2151,7 +2156,7 @@ check_gsoap()
+@@ -2151,7 +2159,7 @@ check_gsoap()
          else
            cnf_append "VBOX_GSOAP_CXX_SOURCES" ""
          fi
@@ -61,7 +71,7 @@
          gsoap_version=`pkg-config gsoapssl++ --modversion`
          log_success "found version $gsoap_version"
          return
-@@ -2519,7 +2524,7 @@ for option in "$@"; do
+@@ -2519,7 +2527,7 @@ for option in "$@"; do
      --with-openssl-dir=*)
        OPENSSLDIR=`echo $option | cut -d'=' -f2`
        INCCRYPTO="-I${OPENSSLDIR}/include"
@@ -70,7 +80,7 @@
        # On Linux static OpenSSL typically needs a few additional libraries.
        [ "$OS" = "linux" ] && LIBCRYPTO="-ldl $LIBPTHREAD -lm"
        ;;
-@@ -2865,12 +2870,22 @@ if [ $ONLY_ADDITIONS -eq 0 ]; then
+@@ -2865,12 +2873,22 @@ if [ $ONLY_ADDITIONS -eq 0 ]; then
    [ $WITH_JAVA   -eq 1 ] && check_java
  
    # PulseAudio
@@ -99,7 +109,7 @@
    fi
  fi
  
-@@ -2886,14 +2901,6 @@ if [ "$OS" = "linux" ]; then
+@@ -2886,14 +2904,6 @@ if [ "$OS" = "linux" ]; then
      cnf_append "VBOX_WITHOUT_LINUX_TEST_BUILDS" "1"
    fi
    if [ $ONLY_ADDITIONS -eq 0 ]; then
diff --git a/emulators/virtualbox-ose/files/pkg-message.in b/emulators/virtualbox-ose/files/pkg-message.in
index 8fd6062977da..27c14e0a2e2a 100644
--- a/emulators/virtualbox-ose/files/pkg-message.in
+++ b/emulators/virtualbox-ose/files/pkg-message.in
@@ -53,19 +53,43 @@ NS_ERROR_FACTORY_NOT_REGISTERED. In this case delete /tmp/.vbox-*-ipc file.
 If you experience "Network: write Failed: Cannot allocate memory" errors
 try to increase net.graph.maxdata in /boot/loader.conf
 
-If you are using AIO, then increase these limits (PR#168298):
+If you are using AIO, then increase these limits (https://bugs.freebsd.org/168298):
 vfs.aio.max_buf_aio=8192
 vfs.aio.max_aio_queue_per_proc=65536
 vfs.aio.max_aio_per_proc=8192
 vfs.aio.max_aio_queue=65536
 To check if AIO is used use: kldstat -v | grep aio
 
+If you are experiencing VMs freezes with an error in VBox.log such as:
+"
+00:01:29.590192 AssertLogRel /usr/ports/emulators/virtualbox-ose/work/VirtualBox-6.1.44
+/src/VBox/VMM/VMMR3/PGMPhys.cpp(5148) int PGMR3PhysAllocateHandyPages(PVM): RT_SUCCESS(rc)
+00:01:29.590221 87/128: idPage=0x3d400 HCPhysGCPhys=000000027eaed000 rc=VERR_NO_MEMORY
+00:01:29.590247 Changing the VM state from 'RUNNING' to 'GURU_MEDITATION'
+00:01:29.590261 Console: Machine state changed to 'GuruMeditation'
+00:01:29.590695 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+00:01:29.590696 !!
+00:01:29.590697 !!         VCPU0: Guru Meditation -8 (VERR_NO_MEMORY)
+"
+and see a lot of free RAM, then increase sysctl vm.max_user_wired
+(https://bugs.freebsd.org/252227).
+For dedicated VM servers, a good start is:
+("RAM in GB" - max(1, "RAM in GB" / 32)) * 1024*1024*1024 / PAGE_SIZE
+PAGE_SIZE on x86 is 4096.
+Examples with different RAM sizes in GB:
+ 16: ( 16-max(1, 16/32)*1024*1024*1024/4096 = 3932160  =>  15GB
+ 32: ( 32-max(1, 32/32)*1024*1024*1024/4096 = 8126464  =>  31GB
+ 48: ( 48-max(1, 48/32)*1024*1024*1024/4096 = 12189696 =>  46.5GB
+ 64: ( 64-max(1, 64/32)*1024*1024*1024/4096 = 16252928 =>  62GB
+128: (128-max(1,128/32)*1024*1024*1024/4096 = 32505856 => 124GB
+256: (256-max(1,256/32)*1024*1024*1024/4096 = 65011712 => 248GB
+
 When assigning IP addresses in host-only mode from ranges outside
 of VirtualBox's defaults, the respective ranges need to be listed
-in %%VBOX_ETC%%/networks.conf (PR#259399).
+in %%VBOX_ETC%%/networks.conf (https://bugs.freebsd.org/259399).
 
-Check wiki page for known issues and troubleshooting:
-http://wiki.freebsd.org/VirtualBox
+Check the wiki page for known issues and troubleshooting:
+https://wiki.freebsd.org/VirtualBox
 
 Please report any problems to emulation@. Thanks!
 EOM



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202306281202.35SC27I0091345>