summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViorel Munteanu <ceamac.paragon@gmail.com>2022-10-11 21:37:58 +0300
committerViorel Munteanu <ceamac@gentoo.org>2022-11-02 08:39:42 +0200
commit9616b251f6c74d1b6d7688d5e4cca40df855da93 (patch)
treeb5f2bc93c084621e3fd3ef00f37eea1a9e9492c6
parentapp-emulation/virtualbox-modules: add 7.0.2 (diff)
downloadgentoo-9616b251.tar.gz
gentoo-9616b251.tar.bz2
gentoo-9616b251.zip
app-emulation/virtualbox: add 7.0.2
Signed-off-by: Viorel Munteanu <ceamac.paragon@gmail.com> Signed-off-by: Viorel Munteanu <ceamac@gentoo.org>
-rw-r--r--app-emulation/virtualbox/Manifest1
-rw-r--r--app-emulation/virtualbox/files/virtualbox-7.0.0-fix-compilation-clang.patch44
-rw-r--r--app-emulation/virtualbox/files/virtualbox-7.0.0-fix-compilation.patch56
-rw-r--r--app-emulation/virtualbox/files/virtualbox-7.0.0-python3_11.patch90
-rw-r--r--app-emulation/virtualbox/virtualbox-7.0.2.ebuild685
5 files changed, 876 insertions, 0 deletions
diff --git a/app-emulation/virtualbox/Manifest b/app-emulation/virtualbox/Manifest
index c3288f9542c0..7223bc1b6af8 100644
--- a/app-emulation/virtualbox/Manifest
+++ b/app-emulation/virtualbox/Manifest
@@ -1,4 +1,5 @@
DIST VirtualBox-6.1.36.tar.bz2 165685382 BLAKE2B 98dbb06450b9df650cb72493bcdea4b88fa9dd21f76d723fdc0bb2c1ab8266f67e972a7222dc9b5bd0d43754911710664bddace753995be025cf6bcc05a24ae5 SHA512 cc3b984a7da40c9bf14831808a2bc2bf7bf6821e53c25fa11cb4b4275feb1d4b0cb4a47d8a360b90c89e5a4038481efe8fe28ee22996dbefb6446761e88a8dec
DIST VirtualBox-6.1.38.tar.bz2 165761175 BLAKE2B decda6e7a595f79e6ace6f8f6b8a7829223ac1422c3d280b6287a40ef942e773ad473f4fa4640a76f8fb825ebd8561c646f1b3d87922b1af55c138298b4c8f4f SHA512 7a4f2dc80e3251b1da6d29d3c6f6b802527decc70497b1a1d1008c0ab3109c2039d131c587d6ec4786aea619546757655337c2ec3456243336ca13c6f6748116
DIST VirtualBox-6.1.40.tar.bz2 165769795 BLAKE2B 5c216f23422be3fc4f7760881c666c57a516d12726ed8ef040bbdf918f1af53c69d204b22949e25f751cbe788b00c810c49c27b7c51c1837fd1c503a3eff202c SHA512 0dace071fe58500d0912fe4da4751de6840752375039554a56c8c753a0880a419c4a1ed7f1b0ebc51230f7099ca3f5d987dc7b91ad4d98dbd75bf63e3c27e096
+DIST VirtualBox-7.0.2.tar.bz2 199461536 BLAKE2B 94f7c2961c13530b6086bf4576f243b5b260f43ec445c8a2e411205989a9db229715502f2b76b8f3cb45a49ff565410701be90f1e850f069aae5579c0796b503 SHA512 c79d6365f83e1fde356a7f4a6ccd23bc7306d1b5b4be669634c575f08ba53338caca684758c9409ecef2b05ab6f9ad37dfa6075ad6afbc5d7909d46ee6794927
DIST virtualbox-patches-6.1.36.tar.bz2 2733 BLAKE2B dcfebfeca4873d382441515d48b4dfee9343bc7c83ea3cbb5002dbf7975143a79fae9a701b67dc35505e9ca03ff1b6293cb7c3279c4fdfda8ad21ba5fb9b7e87 SHA512 1bed5cdefbf8e7c4b0d9092ba4961ecf2262f27f35c71a91ef6f2e8fe8a1d92ed74f06bafbf58d70ba7165d933997f58073f4d4f4051e3ba5c0339b729066f57
diff --git a/app-emulation/virtualbox/files/virtualbox-7.0.0-fix-compilation-clang.patch b/app-emulation/virtualbox/files/virtualbox-7.0.0-fix-compilation-clang.patch
new file mode 100644
index 000000000000..c3e34f875acd
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-7.0.0-fix-compilation-clang.patch
@@ -0,0 +1,44 @@
+clang does not have syslimits.h, it is gcc specific
+and it is useless anyway since <limits.h> is already included
+so just remove it
+
+Cannot use PFNRT here on clang because of the exception specification
+
+--- a/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceLibCWrappers.h
++++ b/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceLibCWrappers.h
+@@ -34,8 +34,6 @@
+ # include <limits.h> /* Workaround for syslimit.h bug in gcc 4.8.3 on gentoo. */
+ # ifdef RT_OS_DARWIN
+ # include <sys/syslimits.h> /* PATH_MAX */
+-# elif !defined(RT_OS_SOLARIS) && !defined(RT_OS_FREEBSD)
+-# include <syslimits.h> /* PATH_MAX */
+ # endif
+ # include <libgen.h> /* basename */
+ # include <unistd.h>
+--- a/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.h
++++ b/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.h
+@@ -97,7 +97,11 @@
+ /** Load OpenGL library and initialize function pointers. */
+ int glLdrInit(PPDMDEVINS pDevIns);
+ /** Resolve an OpenGL function name. */
++#ifdef __clang__
++void* glLdrGetProcAddress(const char *pszSymbol);
++#else // !__clang__
+ PFNRT glLdrGetProcAddress(const char *pszSymbol);
++#endif // !__clang__
+ /** Get pointers to extension function. They are available on Windows only when OpenGL context is set. */
+ int glLdrGetExtFunctions(PPDMDEVINS pDevIns);
+
+--- a/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.cpp
++++ b/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.cpp
+@@ -35,6 +35,10 @@
+ #include <iprt/ldr.h>
+ #include <iprt/log.h>
+
++#ifdef __clang__
++# define PFNRT void*
++#endif
++
+ #ifdef RT_OS_WINDOWS
+ # define OGLGETPROCADDRESS MyWinGetProcAddress
+ DECLINLINE(PFNRT) MyWinGetProcAddress(const char *pszSymbol)
diff --git a/app-emulation/virtualbox/files/virtualbox-7.0.0-fix-compilation.patch b/app-emulation/virtualbox/files/virtualbox-7.0.0-fix-compilation.patch
new file mode 100644
index 000000000000..362e792c9cb9
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-7.0.0-fix-compilation.patch
@@ -0,0 +1,56 @@
+Fix compilation if VBOX_WITH_AUDIO_OSS is defined while VBOX_WITH_AUDIO_PULSE and VBOX_WITH_AUDIO_ALSA are not
+
+Fix compilation if VBOX_WITH_AUDIO_RECORDING is not defined
+
+--- a/src/VBox/Main/xml/Settings.cpp
++++ b/src/VBox/Main/xml/Settings.cpp
+@@ -8931,6 +8931,9 @@
+ RTCLock lock(s_mtx);
+ if (s_enmLinuxDriver == AudioDriverType_Null)
+ {
++# ifdef VBOX_WITH_AUDIO_OSS
++ s_enmLinuxDriver = AudioDriverType_OSS;
++# endif /* VBOX_WITH_AUDIO_OSS */
+ # ifdef VBOX_WITH_AUDIO_PULSE
+ /* Check for the pulse library & that the pulse audio daemon is running. */
+ if (RTProcIsRunningByName("pulseaudio") &&
+@@ -8943,10 +8946,7 @@
+ if (RTLdrIsLoadable("libasound.so.2"))
+ s_enmLinuxDriver = AudioDriverType_ALSA;
+ # endif /* VBOX_WITH_AUDIO_ALSA */
+-# ifdef VBOX_WITH_AUDIO_OSS
+- else
+- s_enmLinuxDriver = AudioDriverType_OSS;
+-# endif /* VBOX_WITH_AUDIO_OSS */
++ ;
+ }
+ return s_enmLinuxDriver;
+
+--- a/src/VBox/Main/src-client/RecordingInternals.cpp
++++ b/src/VBox/Main/src-client/RecordingInternals.cpp
+@@ -139,7 +139,9 @@
+ switch (pFrame->enmType)
+ {
+ case RECORDINGFRAME_TYPE_AUDIO:
++#ifdef VBOX_WITH_AUDIO_RECORDING
+ recordingAudioFrameDestroy(&pFrame->Audio);
++#endif // VBOX_WITH_AUDIO_RECORDING
+ break;
+
+ case RECORDINGFRAME_TYPE_VIDEO:
+--- a/src/VBox/Main/src-client/Recording.cpp
++++ b/src/VBox/Main/src-client/Recording.cpp
+@@ -836,11 +836,13 @@
+
+ if (m_enmState == RECORDINGSTS_STARTED)
+ {
++#ifdef VBOX_WITH_AUDIO_RECORDING
+ if ( recordingCodecIsInitialized(&m_CodecAudio)
+ && recordingCodecGetWritable(&m_CodecAudio, msTimestamp) > 0)
+ {
+ fNeedsUpdate = true;
+ }
++#endif // VBOX_WITH_AUDIO_RECORDING
+
+ if (!fNeedsUpdate)
+ {
diff --git a/app-emulation/virtualbox/files/virtualbox-7.0.0-python3_11.patch b/app-emulation/virtualbox/files/virtualbox-7.0.0-python3_11.patch
new file mode 100644
index 000000000000..cbdc1e1e2ad1
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-7.0.0-python3_11.patch
@@ -0,0 +1,90 @@
+Add support for python 3.11
+
+Virtualbox 7.0.0 will only build a lib named VBoxPython3.so, regardless of the
+actual python version used when compiling. Remove VBoxPython3m.so, we don't
+use it.
+
+--- a/src/libs/xpcom18a4/python/Makefile.kmk
++++ b/src/libs/xpcom18a4/python/Makefile.kmk
+@@ -30,7 +30,7 @@
+
+ #
+ # List of supported Python versions, defining a number of
+-# VBOX_PYTHON[26|27|31|32|32M|33|33M|34|34M|35|35M|36|36M|37|37M|38|38M|39|39M|310|310M|DEF]_[INC|LIB] variables
++# VBOX_PYTHON[26|27|31|32|32M|33|33M|34|34M|35|35M|36|36M|37|37M|38|38M|39|39M|310|310M|311|311M|DEF]_[INC|LIB] variables
+ # which get picked up below.
+ #
+ ifeq ($(KBUILD_TARGET),darwin) # Relatively predictable, don't script.
+@@ -702,6 +702,52 @@
+ endif
+ endif
+
++ifdef VBOX_PYTHON311_INC
++#
++# Python 3.11 version
++#
++DLLS += VBoxPython3_11
++VBoxPython3_11_EXTENDS = VBoxPythonBase
++VBoxPython3_11_EXTENDS_BY = appending
++VBoxPython3_11_TEMPLATE = XPCOM
++VBoxPython3_11_INCS = $(VBOX_PYTHON311_INC)
++VBoxPython3_11_LIBS = $(VBOX_PYTHON311_LIB)
++
++ ifdef VBOX_WITH_32_ON_64_MAIN_API
++ ifdef VBOX_PYTHON311_LIB_X86
++DLLS += VBoxPython3_11_x86
++VBoxPython3_11_x86_EXTENDS = VBoxPythonBase_x86
++VBoxPython3_11_x86_EXTENDS_BY = appending
++VBoxPython3_11_x86_TEMPLATE = XPCOM
++VBoxPython3_11_x86_INCS = $(VBOX_PYTHON311_INC)
++VBoxPython3_11_x86_LIBS = $(VBOX_PYTHON311_LIB_X86)
++ endif
++ endif
++endif
++
++ifdef VBOX_PYTHON311M_INC
++#
++# Python 3.11 version with pymalloc
++#
++DLLS += VBoxPython3_11m
++VBoxPython3_11m_EXTENDS = VBoxPythonBase_m
++VBoxPython3_11m_EXTENDS_BY = appending
++VBoxPython3_11m_TEMPLATE = XPCOM
++VBoxPython3_11m_INCS = $(VBOX_PYTHON311M_INC)
++VBoxPython3_11m_LIBS = $(VBOX_PYTHON311M_LIB)
++
++ ifdef VBOX_WITH_32_ON_64_MAIN_API
++ ifdef VBOX_PYTHON311M_LIB_X86
++DLLS += VBoxPython3_11m_x86
++VBoxPython3_11m_x86_EXTENDS = VBoxPythonBase_x86_m
++VBoxPython3_11m_x86_EXTENDS_BY = appending
++VBoxPython3_11m_x86_TEMPLATE_ = XPCOM
++VBoxPython3_11m_x86_INCS = $(VBOX_PYTHON311M_INC)
++VBoxPython3_11m_x86_LIBS = $(VBOX_PYTHON311M_LIB_X86)
++ endif
++ endif
++endif
++
+ ifdef VBOX_PYTHONDEF_INC
+ #
+ # Python without versioning
+@@ -744,18 +790,13 @@
+ # TODO: ASSUMING that we don't need a different headers for pymalloc
+ # ('m' builds < 3.8) and CRT malloc.
+ #
+-VBOX_PYTHON_LIMITED_API_VER := $(firstword $(foreach ver, 35 36 38 39 310 34 33 \
++VBOX_PYTHON_LIMITED_API_VER := $(firstword $(foreach ver, 35 36 38 39 310 311 34 33 \
+ ,$(if-expr defined(VBOX_PYTHON$(ver)_INC),$(ver),)$(if-expr defined(VBOX_PYTHON$(ver)M_INC),$(ver)M,)))
+ ifneq ($(VBOX_PYTHON_LIMITED_API_VER),)
+ DLLS += VBoxPython3
+ VBoxPython3_EXTENDS = VBoxPythonBase
+ VBoxPython3_DEFS = $(filter-out VBOX_PYXPCOM_VERSIONED,$(VBoxPythonBase_DEFS)) Py_LIMITED_API=0x03030000
+ VBoxPython3_INCS = $(VBoxPythonBase_INCS) $(VBOX_PYTHON$(VBOX_PYTHON_LIMITED_API_VER)_INC)
+-
+-DLLS += VBoxPython3m
+-VBoxPython3m_EXTENDS = VBoxPythonBase_m
+-VBoxPython3m_DEFS = $(filter-out VBOX_PYXPCOM_VERSIONED,$(VBoxPythonBase_m_DEFS)) Py_LIMITED_API=0x03030000
+-VBoxPython3m_INCS = $(VBoxPythonBase_m_INCS) $(VBOX_PYTHON$(VBOX_PYTHON_LIMITED_API_VER)_INC)
+ endif
+ endif # VBOX_WITH_PYTHON_LIMITED_API
+
diff --git a/app-emulation/virtualbox/virtualbox-7.0.2.ebuild b/app-emulation/virtualbox/virtualbox-7.0.2.ebuild
new file mode 100644
index 000000000000..4a23f2b624d2
--- /dev/null
+++ b/app-emulation/virtualbox/virtualbox-7.0.2.ebuild
@@ -0,0 +1,685 @@
+# Copyright 2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# To add a new Python here:
+# 1. Patch src/libs/xpcom18a4/python/Makefile.kmk (copy the previous impl's logic)
+# Do NOT skip this part. It'll end up silently not-building the Python extension
+# or otherwise misbehaving if you do.
+#
+# 2. Then update PYTHON_COMPAT & set PYTHON_SINGLE_TARGET for testing w/ USE=python.
+#
+# May need to look at other distros (e.g. Arch Linux) to find patches for newer
+# Python versions as upstream tends to lag. Upstream may have patches on their
+# trunk branch but not release branch.
+#
+# See bug #785835, bug #856121.
+PYTHON_COMPAT=( python3_{8..11} )
+
+inherit desktop edo flag-o-matic java-pkg-opt-2 linux-info multilib optfeature pax-utils python-single-r1 tmpfiles toolchain-funcs udev xdg
+
+MY_PN="VirtualBox"
+MY_P=${MY_PN}-${PV}
+
+DESCRIPTION="Family of powerful x86 virtualization products for enterprise and home use"
+HOMEPAGE="https://www.virtualbox.org/"
+SRC_URI="https://download.virtualbox.org/virtualbox/${PV}/${MY_P}.tar.bz2
+ https://gitweb.gentoo.org/proj/virtualbox-patches.git/snapshot/virtualbox-patches-6.1.36.tar.bz2"
+S="${WORKDIR}/${MY_PN}-${PV}"
+
+LICENSE="GPL-2+ GPL-3 LGPL-2.1 MIT dtrace? ( CDDL )"
+SLOT="0/$(ver_cut 1-2)"
+KEYWORDS="~amd64"
+IUSE="alsa dbus debug doc dtrace headless java lvm +opus pam pax-kernel pch pulseaudio +opengl python +qt5 +sdk +sdl +udev vboxwebsrv vnc"
+
+unset WATCOM #856769
+
+COMMON_DEPEND="
+ ${PYTHON_DEPS}
+ acct-group/vboxusers
+ ~app-emulation/virtualbox-modules-${PV}
+ dev-libs/libxml2
+ dev-libs/openssl:0=
+ media-libs/libpng:0=
+ media-libs/libvpx:0=
+ net-misc/curl
+ sys-libs/zlib
+ dbus? ( sys-apps/dbus )
+ !headless? (
+ x11-libs/libX11
+ x11-libs/libXt
+ opengl? (
+ media-libs/libglvnd[X]
+ )
+ qt5? (
+ dev-qt/qtcore:5
+ dev-qt/qtdbus:5
+ dev-qt/qtgui:5
+ dev-qt/qthelp:5
+ dev-qt/qtprintsupport:5
+ dev-qt/qtwidgets:5
+ dev-qt/qtx11extras:5
+ dev-qt/qtxml:5
+ opengl? ( dev-qt/qtopengl:5 )
+ )
+ sdl? (
+ media-libs/libsdl:0[X,video]
+ x11-libs/libXcursor
+ )
+ )
+ lvm? ( sys-fs/lvm2 )
+ pam? ( sys-libs/pam )
+ vboxwebsrv? ( net-libs/gsoap[-gnutls(-)] )
+ vnc? ( >=net-libs/libvncserver-0.9.9 )
+"
+# We're stuck on JDK (and JRE, I guess?) 1.8 because of need for wsimport
+# with USE="vboxwebsrv java". Note that we have to put things in DEPEND,
+# not (only, anyway) BDEPEND, as the eclass magic to set the environment variables
+# based on *DEPEND doesn't work for BDEPEND at least right now.
+#
+# There's a comment in Config.kmk about it
+# ("With Java 11 wsimport was removed, usually part of a separate install now.")
+# but it needs more investigation.
+#
+# See bug #878299 to track this issue.
+DEPEND="
+ ${COMMON_DEPEND}
+ >=dev-libs/libxslt-1.1.19
+ virtual/libcrypt:=
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ opengl? ( virtual/glu )
+ !headless? (
+ x11-libs/libXcursor
+ x11-libs/libXext
+ x11-libs/libXinerama
+ x11-libs/libXmu
+ x11-libs/libxcb:=
+ x11-libs/libXrandr
+ opengl? ( virtual/opengl )
+ )
+ java? ( virtual/jdk:1.8 )
+ opus? ( media-libs/opus )
+ pax-kernel? ( sys-apps/elfix )
+ pulseaudio? ( media-sound/pulseaudio )
+ qt5? ( x11-libs/libXinerama )
+ udev? ( >=virtual/udev-171 )
+"
+RDEPEND="
+ ${COMMON_DEPEND}
+ java? ( virtual/jre:1.8 )
+ qt5? ( x11-libs/libxcb:= )
+"
+BDEPEND="
+ ${PYTHON_DEPS}
+ >=dev-lang/yasm-0.6.2
+ dev-libs/libIDL
+ dev-qt/linguist-tools:5
+ dev-util/glslang
+ >=dev-util/kbuild-0.1.9998.3127
+ sys-apps/which
+ sys-devel/bin86
+ sys-libs/libcap
+ sys-power/iasl
+ virtual/pkgconfig
+ doc? (
+ app-text/docbook-sgml-dtd:4.4
+ app-text/docbook-xsl-ns-stylesheets
+ 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.8 )
+"
+
+QA_FLAGS_IGNORED="
+ usr/lib64/virtualbox/VBoxDDR0.r0
+ usr/lib64/virtualbox/VMMR0.r0
+ usr/lib64/virtualbox/ExtensionPacks/Oracle_VBoxDTrace_Extension_Pack/linux.amd64/VBoxDTraceR0.r0
+ usr/lib64/virtualbox/ExtensionPacks/Oracle_VBoxDTrace_Extension_Pack/linux.amd64/VBoxDTraceR0.debug
+"
+
+QA_TEXTRELS="
+ usr/lib64/virtualbox/VMMR0.r0
+ usr/lib64/virtualbox/ExtensionPacks/Oracle_VBoxDTrace_Extension_Pack/linux.amd64/VBoxDTraceR0.r0
+"
+
+QA_EXECSTACK="
+ usr/lib64/virtualbox/iPxeBaseBin
+ usr/lib64/virtualbox/VMMR0.r0
+ usr/lib64/virtualbox/VBoxDDR0.r0
+ usr/lib64/virtualbox/ExtensionPacks/Oracle_VBoxDTrace_Extension_Pack/linux.amd64/VBoxDTraceR0.r0
+ usr/lib64/virtualbox/ExtensionPacks/Oracle_VBoxDTrace_Extension_Pack/linux.amd64/VBoxDTraceR0.debug
+"
+
+QA_WX_LOAD="
+ usr/lib64/virtualbox/iPxeBaseBin
+"
+
+QA_PRESTRIPPED="
+ usr/lib64/virtualbox/VMMR0.r0
+ usr/lib64/virtualbox/VBoxDDR0.r0
+ usr/lib64/virtualbox/ExtensionPacks/Oracle_VBoxDTrace_Extension_Pack/linux.amd64/VBoxDTraceR0.r0
+"
+
+REQUIRED_USE="
+ java? ( sdk )
+ python? ( sdk )
+ vboxwebsrv? ( java )
+ ${PYTHON_REQUIRED_USE}
+"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-6.1.26-configure-include-qt5-path.patch # bug #805365
+
+ # This patch is needed to avoid automagic detection based on a hardcoded
+ # list of Pythons in configure. It's necessary but not sufficient
+ # (see the rest of the ebuild's logic for the remainder) to handle
+ # proper Python selection.
+ "${FILESDIR}"/${PN}-6.1.34-r3-python.patch
+
+ # 865361
+ "${FILESDIR}"/${PN}-6.1.36-fcf-protection.patch
+
+ "${FILESDIR}"/${PN}-7.0.0-fix-compilation.patch
+ "${FILESDIR}"/${PN}-7.0.0-fix-compilation-clang.patch
+ "${FILESDIR}"/${PN}-7.0.0-python3_11.patch
+
+ # Downloaded patchset
+ "${WORKDIR}"/virtualbox-patches-6.1.36/patches
+)
+
+pkg_pretend() {
+ if ! use headless && ! use qt5; then
+ einfo "No USE=\"qt5\" selected, this build will not include any Qt frontend."
+ elif use headless && use qt5; then
+ einfo "You selected USE=\"headless qt5\", 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
+ if ! use python; then
+ einfo "You have disabled the \"python\" USE flag. This will only"
+ einfo "disable the python bindings being installed."
+ fi
+
+ # 749273
+ local d=${ROOT}
+ for i in usr "$(get_libdir)"; do
+ d="${d}/$i"
+ if [[ "$(stat -L -c "%g %u" "${d}")" != "0 0" ]]; then
+ die "${d} should be owned by root, VirtualBox will not start otherwise"
+ fi
+ done
+}
+
+pkg_setup() {
+ java-pkg-opt-2_pkg_setup
+ python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ default
+
+ # Only add nopie patch when we're on hardened
+ if gcc-specs-pie; then
+ eapply "${FILESDIR}"/050_virtualbox-5.2.8-nopie.patch
+ fi
+
+ # Only add paxmark patch when we're on pax-kernel
+ if use pax-kernel; then
+ eapply "${FILESDIR}"/virtualbox-5.2.8-paxmark-bldprogs.patch
+ fi
+
+ # Remove shipped binaries (kBuild, yasm) and tools, see bug #232775
+ rm -r kBuild/bin || die
+ # Remove everything in tools except kBuildUnits
+ find tools -mindepth 1 -maxdepth 1 -name kBuildUnits -prune -o -exec rm -r {} \+ || die
+
+ # Disable things unused or split into separate ebuilds
+ sed -e "s@MY_LIBDIR@$(get_libdir)@" \
+ "${FILESDIR}"/${PN}-5-localconfig > LocalConfig.kmk || die
+
+ if ! use pch; then
+ # bug #753323
+ printf '\n%s\n' "VBOX_WITHOUT_PRECOMPILED_HEADERS=1" \
+ >> LocalConfig.kmk || die
+ fi
+
+ # Respect LDFLAGS
+ sed -e "s@_LDFLAGS\.${ARCH}*.*=@& ${LDFLAGS}@g" \
+ -i Config.kmk src/libs/xpcom18a4/Config.kmk || die
+
+ # Do not use hard-coded ld (related to bug #488176)
+ sed -e '/QUIET)ld /s@ld @$(LD) @' \
+ -i src/VBox/Devices/PC/ipxe/Makefile.kmk || die
+
+ # Use PAM only when pam USE flag is enbaled (bug #376531)
+ if ! use pam; then
+ einfo "Disabling PAM removes the possibility to use the VRDP features."
+ sed -i 's@^.*VBOX_WITH_PAM@#VBOX_WITH_PAM@' Config.kmk || die
+ sed -i 's@\(.*/auth/Makefile.kmk.*\)@#\1@' \
+ src/VBox/HostServices/Makefile.kmk || die
+ fi
+
+ # add correct java path
+ if use java; then
+ sed "s@/usr/lib/jvm/java-6-sun@$(java-config -O)@" \
+ -i "${S}"/Config.kmk || die
+ java-pkg-opt-2_src_prepare
+ fi
+
+ #856811 #864274
+ # cannot filter out only one flag, some combinations of these flags produce buggy executables
+ for i in abm avx avx2 bmi bmi2 fma fma4 popcnt; do
+ append-cflags $(test-flags-CC -mno-$i)
+ append-cxxflags $(test-flags-CXX -mno-$i)
+ done
+
+ # bug #843437
+ cat >> LocalConfig.kmk <<-EOF || die
+ CXXFLAGS=${CXXFLAGS}
+ CFLAGS=${CFLAGS}
+ EOF
+
+ if use sdl; then
+ echo -e "\nVBOX_WITH_VBOXSDL=1" >> LocalConfig.kmk || die
+ fi
+
+ # clang assembler chokes on comments starting with /
+ if tc-is-clang; then
+ sed -i -e '/^\//d' src/libs/xpcom18a4/nsprpub/pr/src/md/unix/os_Linux_x86_64.s || die
+ fi
+
+ # fix doc generation
+ echo -e "\nVBOX_PATH_DOCBOOK=/usr/share/sgml/docbook/xsl-ns-stylesheets" >> LocalConfig.kmk || die
+ # replace xhtml names with numeric equivalents
+ find doc/manual -name \*.xml -exec sed -i \
+ -e 's/&nbsp;/\&#160;/g' \
+ -e 's/&ndash;/\&#8211;/g' \
+ -e 's/&larr;/\&#8592;/g' \
+ -e 's/&rarr;/\&#8594;/g' \
+ -e 's/&harr;/\&#8596;/g' {} \+ || die
+}
+
+src_configure() {
+ tc-ld-disable-gold # bug #488176
+
+ tc-export AR CC CXX LD RANLIB
+ export HOST_CC="$(tc-getBUILD_CC)"
+
+ local myconf=(
+ --with-gcc="$(tc-getCC)"
+ --with-g++="$(tc-getCXX)"
+
+ --disable-kmods
+
+ $(usex alsa '' --disable-alsa)
+ $(usex dbus '' --disable-dbus)
+ $(usex debug --build-debug '')
+ $(usex doc '' --disable-docs)
+ $(usex java '' --disable-java)
+ $(usex lvm '' --disable-devmapper)
+ $(usex opus '' --disable-libopus)
+ $(usex pulseaudio '' --disable-pulse)
+ $(usex python '' --disable-python)
+ $(usex vboxwebsrv --enable-webservice '')
+ $(usex vnc --enable-vnc '')
+ )
+
+ if ! use headless; then
+ myconf+=(
+ $(usex opengl '' --disable-opengl)
+ $(usex qt5 '' --disable-qt)
+ $(usex sdl '' --disable-sdl)
+ )
+ else
+ myconf+=(
+ --build-headless
+ --disable-opengl
+ )
+ fi
+
+ if use amd64 && ! has_multilib_profile; then
+ myconf+=( --disable-vmmraw )
+ fi
+
+ # not an autoconf script
+ edo ./configure "${myconf[@]}"
+
+ # Force usage of chosen Python implementation
+ # bug #856121, bug #785835
+ sed -i \
+ -e '/VBOX_WITH_PYTHON.*=/d' \
+ -e '/VBOX_PATH_PYTHON_INC.*=/d' \
+ -e '/VBOX_LIB_PYTHON.*=/d' \
+ AutoConfig.kmk || die
+
+ cat >> AutoConfig.kmk <<-EOF || die
+ VBOX_WITH_PYTHON=$(usev python 1)
+ VBOX_PATH_PYTHON_INC=$(python_get_includedir)
+ VBOX_LIB_PYTHON=$(python_get_library_path)
+ EOF
+
+ if use python; then
+ local mangled_python="${EPYTHON#python}"
+ mangled_python="${mangled_python/.}"
+
+ # Stub out the script which defines what the Makefile ends up
+ # building for. gen_python_deps.py gets called by the Makefile
+ # with some args and it spits out a bunch of paths for a hardcoded
+ # list of Pythons. We just override it with what we're actually using.
+ # This minimises the amount of patching we have to do for new Pythons.
+ cat > src/libs/xpcom18a4/python/gen_python_deps.py <<-EOF || die
+ print("VBOX_PYTHON${mangled_python}_INC=$(python_get_includedir)")
+ print("VBOX_PYTHON${mangled_python}_LIB=$(python_get_library_path)")
+ print("VBOX_PYTHONDEF_INC=$(python_get_includedir)")
+ print("VBOX_PYTHONDEF_LIB=$(python_get_library_path)")
+ EOF
+
+ chmod +x src/libs/xpcom18a4/python/gen_python_deps.py || die
+ fi
+}
+
+src_compile() {
+ source ./env.sh || die
+
+ # Force kBuild to respect C[XX]FLAGS and MAKEOPTS (bug #178529)
+ MAKEJOBS=$(grep -Eo '(\-j|\-\-jobs)(=?|[[:space:]]*)[[:digit:]]+' <<< ${MAKEOPTS})
+ MAKELOAD=$(grep -Eo '(\-l|\-\-load-average)(=?|[[:space:]]*)[[:digit:]]+' <<< ${MAKEOPTS})
+ MAKEOPTS="${MAKEJOBS} ${MAKELOAD}"
+
+ local myemakeargs=(
+ VBOX_BUILD_PUBLISHER=_Gentoo
+ VBOX_WITH_VBOXIMGMOUNT=1
+
+ KBUILD_VERBOSE=2
+
+ AS="$(tc-getCC)"
+ CC="$(tc-getCC)"
+ CXX="$(tc-getCXX)"
+
+ TOOL_GCC3_CC="$(tc-getCC)"
+ TOOL_GCC3_LD="$(tc-getCC)"
+ TOOL_GCC3_AS="$(tc-getCC)"
+ TOOL_GCC3_AR="$(tc-getAR)"
+ TOOL_GCC3_OBJCOPY="$(tc-getOBJCOPY)"
+
+ TOOL_GXX3_CC="$(tc-getCC)"
+ TOOL_GXX3_CXX="$(tc-getCXX)"
+ TOOL_GXX3_LD="$(tc-getCXX)"
+ TOOL_GXX3_AS="$(tc-getCXX)"
+ TOOL_GXX3_AR="$(tc-getAR)"
+ TOOL_GXX3_OBJCOPY="$(tc-getOBJCOPY)"
+
+ TOOL_GCC3_CFLAGS="${CFLAGS}"
+ TOOL_GCC3_CXXFLAGS="${CXXFLAGS}"
+ VBOX_GCC_OPT="${CXXFLAGS}"
+ VBOX_NM="$(tc-getNM)"
+
+ TOOL_YASM_AS=yasm
+ )
+
+ if use amd64 && has_multilib_profile; then
+ myemakeargs+=(
+ CC32="$(tc-getCC) -m32"
+ CXX32="$(tc-getCXX) -m32"
+
+ TOOL_GCC32_CC="$(tc-getCC) -m32"
+ TOOL_GCC32_CXX="$(tc-getCXX) -m32"
+ TOOL_GCC32_LD="$(tc-getCC) -m32"
+ TOOL_GCC32_AS="$(tc-getCC) -m32"
+ TOOL_GCC32_AR="$(tc-getAR)"
+ TOOL_GCC32_OBJCOPY="$(tc-getOBJCOPY)"
+
+ TOOL_GXX32_CC="$(tc-getCC) -m32"
+ TOOL_GXX32_CXX="$(tc-getCXX) -m32"
+ TOOL_GXX32_LD="$(tc-getCXX) -m32"
+ TOOL_GXX32_AS="$(tc-getCXX) -m32"
+ TOOL_GXX32_AR="$(tc-getAR)"
+ TOOL_GXX32_OBJCOPY="$(tc-getOBJCOPY)"
+ )
+ fi
+
+ MAKE="kmk" emake "${myemakeargs[@]}" all
+}
+
+src_install() {
+ cd "${S}"/out/linux.${ARCH}/$(usex debug debug release)/bin || die
+
+ local vbox_inst_path="/usr/$(get_libdir)/${PN}" each size ico icofile
+
+ vbox_inst() {
+ local binary="${1}"
+ local perms="${2:-0750}"
+ local path="${3:-${vbox_inst_path}}"
+
+ [[ -n "${binary}" ]] || die "vbox_inst: No binary given!"
+ [[ ${perms} =~ ^[[:digit:]]+{4}$ ]] || die "vbox_inst: perms must consist of four digits."
+
+ insinto ${path}
+ doins ${binary}
+ fowners root:vboxusers ${path}/${binary}
+ fperms ${perms} ${path}/${binary}
+ }
+
+ # Create configuration files
+ insinto /etc/vbox
+ newins "${FILESDIR}/${PN}-4-config" vbox.cfg
+
+ # Set the correct libdir
+ sed \
+ -e "s@MY_LIBDIR@$(get_libdir)@" \
+ -i "${ED}"/etc/vbox/vbox.cfg || die "vbox.cfg sed failed"
+
+ # Install the wrapper script
+ exeinto ${vbox_inst_path}
+ newexe "${FILESDIR}/${PN}-ose-6-wrapper" "VBox"
+ fowners root:vboxusers ${vbox_inst_path}/VBox
+ fperms 0750 ${vbox_inst_path}/VBox
+
+ # Install binaries and libraries
+ insinto ${vbox_inst_path}
+ doins -r components
+
+ for each in VBox{Autostart,BalloonCtrl,BugReport,CpuReport,ExtPackHelperApp,Manage,SVC,VMMPreload,XPCOMIPCD} vboximg-mount *so *r0; do
+ vbox_inst ${each}
+ done
+
+ # These binaries need to be suid root.
+ for each in VBox{Headless,Net{AdpCtl,DHCP,NAT}} ; do
+ vbox_inst ${each} 4750
+ done
+
+ # Install EFI Firmware files (bug #320757)
+ for each in VBoxEFI{32,64}.fd ; do
+ vbox_inst ${each} 0644
+ done
+
+ # VBoxSVC and VBoxManage need to be pax-marked (bug #403453)
+ # VBoxXPCOMIPCD (bug #524202)
+ for each in VBox{Headless,Manage,SVC,XPCOMIPCD} ; do
+ pax-mark -m "${ED}"${vbox_inst_path}/${each}
+ done
+
+ # Symlink binaries to the shipped wrapper
+ for each in vbox{autostart,balloonctrl,bugreport,headless,manage} VBox{Autostart,BalloonCtrl,BugReport,Headless,Manage,VRDP} ; do
+ dosym ${vbox_inst_path}/VBox /usr/bin/${each}
+ done
+ dosym ${vbox_inst_path}/vboximg-mount /usr/bin/vboximg-mount
+
+ if use pam; then
+ # VRDPAuth only works with this (bug #351949)
+ dosym VBoxAuth.so ${vbox_inst_path}/VRDPAuth.so
+ fi
+
+ # set an env-variable for 3rd party tools
+ echo -n "VBOX_APP_HOME=${vbox_inst_path}" > "${T}/90virtualbox"
+ doenvd "${T}/90virtualbox"
+
+ if ! use headless; then
+ if use sdl; then
+ vbox_inst VBoxSDL 4750
+ pax-mark -m "${ED}"${vbox_inst_path}/VBoxSDL
+
+ for each in vboxsdl VBoxSDL ; do
+ dosym ${vbox_inst_path}/VBox /usr/bin/${each}
+ done
+ fi
+
+ if use qt5; then
+ vbox_inst VirtualBox
+ vbox_inst VirtualBoxVM 4750
+ for each in VirtualBox{,VM} ; do
+ pax-mark -m "${ED}"${vbox_inst_path}/${each}
+ done
+
+ if use opengl; then
+ vbox_inst VBoxTestOGL
+ pax-mark -m "${ED}"${vbox_inst_path}/VBoxTestOGL
+ fi
+
+ for each in virtualbox{,vm} VirtualBox{,VM} ; do
+ dosym ${vbox_inst_path}/VBox /usr/bin/${each}
+ done
+
+ insinto /usr/share/${PN}
+ doins -r nls
+ doins -r UnattendedTemplates
+
+ domenu ${PN}.desktop
+ fi
+
+ pushd "${S}"/src/VBox/Artwork/OSE &>/dev/null || die
+ for size in 16 32 48 64 128 ; do
+ newicon -s ${size} ${PN}-${size}px.png ${PN}.png
+ done
+ newicon ${PN}-48px.png ${PN}.png
+ doicon -s scalable ${PN}.svg
+ popd &>/dev/null || die
+ pushd "${S}"/src/VBox/Artwork/other &>/dev/null || die
+ for size in 16 24 32 48 64 72 96 128 256 512 ; do
+ for ico in hdd ova ovf vbox{,-extpack} vdi vdh vmdk ; do
+ icofile="${PN}-${ico}-${size}px.png"
+ if [[ -f "${icofile}" ]]; then
+ newicon -s ${size} ${icofile} ${PN}-${ico}.png
+ fi
+ done
+ done
+ popd &>/dev/null || die
+ fi
+
+ if use lvm; then
+ vbox_inst VBoxVolInfo 4750
+ dosym ${vbox_inst_path}/VBoxVolInfo /usr/bin/VBoxVolInfo
+ fi
+
+ if use sdk; then
+ insinto ${vbox_inst_path}
+ doins -r sdk
+
+ if use java; then
+ java-pkg_regjar "${ED}/${vbox_inst_path}/sdk/bindings/xpcom/java/vboxjxpcom.jar"
+ java-pkg_regso "${ED}/${vbox_inst_path}/libvboxjxpcom.so"
+ fi
+ fi
+
+ if use udev; then
+ local udevdir="$(get_udevdir)"
+ local udev_file="VBoxCreateUSBNode.sh"
+ local rules_file="10-virtualbox.rules"
+
+ insinto ${udevdir}
+ doins ${udev_file}
+ fowners root:vboxusers ${udevdir}/${udev_file}
+ fperms 0750 ${udevdir}/${udev_file}
+
+ insinto ${udevdir}/rules.d
+ sed "s@%UDEVDIR%@${udevdir}@" "${FILESDIR}"/${rules_file} \
+ > "${T}"/${rules_file} || die
+ doins "${T}"/${rules_file}
+ fi
+
+ if use vboxwebsrv; then
+ vbox_inst vboxwebsrv
+ dosym ${vbox_inst_path}/VBox /usr/bin/vboxwebsrv
+ newinitd "${FILESDIR}"/vboxwebsrv-initd vboxwebsrv
+ newconfd "${FILESDIR}"/vboxwebsrv-confd vboxwebsrv
+ fi
+
+ # Remove dead symlinks (bug #715338)
+ find "${ED}"/usr/$(get_libdir)/${PN} -xtype l -delete || die
+
+ # Fix version string in extensions or else they don't get accepted
+ # by the virtualbox host process (see bug #438930)
+ find ExtensionPacks -type f -name "ExtPack.xml" -exec sed -i '/Version/s@_Gentoo@@' {} \+ || die
+
+ local extensions_dir="${vbox_inst_path}/ExtensionPacks"
+
+ if use vnc; then
+ insinto ${extensions_dir}
+ doins -r ExtensionPacks/VNC
+ fi
+
+ if use dtrace; then
+ insinto ${extensions_dir}
+ doins -r ExtensionPacks/Oracle_VBoxDTrace_Extension_Pack
+ fi
+
+ if use doc; then
+ dodoc UserManual.pdf
+ fi
+
+ if use python; then
+ local python_path_ext="${ED}/usr/$(get_libdir)/virtualbox/VBoxPython3.so"
+ if [[ ! -x "${python_path_ext}" ]]; then
+ eerror "Couldn't find ${python_path_ext}! Bindings were requested with USE=python"
+ eerror "but none were installed. This may happen if support for a Python target"
+ eerror "(listed in PYTHON_COMPAT in the ebuild) is incomplete within the Makefiles."
+ die "Incomplete installation of Python bindings! File a bug with Gentoo!"
+ fi
+ fi
+
+ newtmpfiles "${FILESDIR}"/${PN}-vboxusb_tmpfilesd ${PN}-vboxusb.conf
+}
+
+pkg_postinst() {
+ xdg_pkg_postinst
+
+ if use udev; then
+ udev_reload
+ udevadm trigger --subsystem-match=usb
+ fi
+
+ tmpfiles_process virtualbox-vboxusb.conf
+
+ if ! use headless && use qt5; 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 "https://download.virtualbox.org/virtualbox/${PV}/UserManual.pdf"
+ elog ""
+
+ optfeature "Advanced networking setups" net-misc/bridge-utils sys-apps/usermode-utilities
+ optfeature "USB2, USB3, PXE boot, and VRDP support" app-emulation/virtualbox-extpack-oracle
+ optfeature "Guest additions ISO" app-emulation/virtualbox-additions
+
+ if ! use udev; then
+ ewarn "Without USE=udev, USB devices will likely not work in ${PN}."
+ fi
+}
+
+pkg_postrm() {
+ xdg_pkg_postrm
+
+ use udev && udev_reload
+}