summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-emulation/virtualbox')
-rw-r--r--app-emulation/virtualbox/Manifest13
-rw-r--r--app-emulation/virtualbox/files/virtualbox-5.2.8-paxmark-bldprogs.patch59
-rw-r--r--app-emulation/virtualbox/files/virtualbox-6.1.34-r3-python.patch14
-rw-r--r--app-emulation/virtualbox/files/virtualbox-6.1.34-vboxr0.patch20
-rw-r--r--app-emulation/virtualbox/files/virtualbox-6.1.36-fcf-protection.patch16
-rw-r--r--app-emulation/virtualbox/files/virtualbox-6.1.44-fix-libxml2.patch25
-rw-r--r--app-emulation/virtualbox/files/virtualbox-7.0.14-libxml2-2.12.patch43
-rw-r--r--app-emulation/virtualbox/files/virtualbox-7.0.8-disable-rebuild-iPxeBiosBin.patch18
-rw-r--r--app-emulation/virtualbox/files/virtualbox-ose-6-wrapper2
-rw-r--r--app-emulation/virtualbox/metadata.xml21
-rw-r--r--app-emulation/virtualbox/virtualbox-6.1.32-r1.ebuild514
-rw-r--r--app-emulation/virtualbox/virtualbox-6.1.50-r2.ebuild (renamed from app-emulation/virtualbox/virtualbox-6.1.34.ebuild)384
-rw-r--r--app-emulation/virtualbox/virtualbox-7.0.14-r2.ebuild740
-rw-r--r--app-emulation/virtualbox/virtualbox-7.0.18.ebuild741
-rw-r--r--app-emulation/virtualbox/virtualbox-9999.ebuild769
15 files changed, 2668 insertions, 711 deletions
diff --git a/app-emulation/virtualbox/Manifest b/app-emulation/virtualbox/Manifest
index 7c756f072fe3..05788a2aa308 100644
--- a/app-emulation/virtualbox/Manifest
+++ b/app-emulation/virtualbox/Manifest
@@ -1,3 +1,10 @@
-DIST VirtualBox-6.1.32.tar.bz2 165758238 BLAKE2B 24873d7cc8bd306ea3552fe75379fbe7be767c85406042344eb047ed31184c3357aea07dda5e15c275f5036ae63106ef1d2e6524b143bc645a6b5ba0016f1391 SHA512 8bf7af6b8b4d3ba90f0e91589cf26400648436eb9da6d31c1a760460bfe5eb7311ac3220b4c9a98ac50e559641d3d5f559134be65288821038255de1c2c7ce1e
-DIST VirtualBox-6.1.34.tar.bz2 165761216 BLAKE2B d3c8f7d3d6f408e4c4275c2b2815e92819c871359501ec4fa7212bf7cdc852613e2e4703d8650371097a5bc805efa04ea75bb03ab83d24a869a677555f6e22d5 SHA512 46d63a9fd9df76af654af59fab5cf555858bc2c4b5dc34e2378d85ae784e6380b6def4aab06909a9b5e114a7297269f90cfb2c3d8d6529b423d703afbad18c64
-DIST virtualbox-6.1.12-patches-01.tar.xz 2528 BLAKE2B a5d7cde0daea41bee2e40e46569c725769927a31865d99d13b8b13c4903e59b4097f85da15dc592b9c7e8baf8ff805397af827620f107ba09a468b4d1198ecab SHA512 f71d10a9fbce99c3f631ef30bcfa9d0e017e702ac509541b039e08ccbcd024beb93fde09c43d90af5d9d28f6842a7947f20e7950d3897da3e6d57859657e1123
+DIST VirtualBox-6.1.50.tar.bz2 165959648 BLAKE2B e244c4fa2ffe86216664104473e27e8ddbad86aae3bc26612d18204a4e67cece91d1fa3aa9e70f1c39f915bf5e4a1e6a14bbb19162c3ae2ff554373df95bce51 SHA512 ee2ec352e020f07262bf2120278d0d9807c501cd7c4d621d4e12ce18a821b134d48eb852bc7136008cfa77ed709703d3c2835b7a7177c325d989e8f433aff73f
+DIST VirtualBox-7.0.14.tar.bz2 175654864 BLAKE2B 99f4942b864ce481d69983af31393d763452c5b55697ab642b43c155f5fbc2a9963fbe1b7744baef620d0b351e1ac73c1ef978698b9a7e77897bb9cbc18dc17c SHA512 6a82933bbf51ff255d17cb61ae6ddfb791a2200e3dff705f181cd06c6031b48cf15faa5e8202a65daef0fb20b7fd9e33d40dbd0f9cc3f49af49fff04a1cb0a73
+DIST VirtualBox-7.0.18.tar.bz2 173295159 BLAKE2B 1371d54d648aafbad3814d55d495836ce7a6f9ca955aeb71e24c57a27ed8acae8c020b8094ca7386d341d5e7460b9b0823cc01e7e69dd3cdadaadee1bc608bd1 SHA512 e78a18fa808152cbdc1d407751acf3f57a8202bf238ad3432c4f0b0f97ab203e915a6cd11619e64f4aca5b907eb72be67bab146869af0e73414144addf0d76b4
+DIST virtualbox-help-7.0.14.tar.xz 3944832 BLAKE2B 95079e4da8c960c41cee799142779a6c2587e0e8af7956ca551cb5a4c0f36f313189dfe08afba83a0c32886866a7f9903b5e370008d6b3ce6283fb2288866b06 SHA512 e2f1acdd7577a93047e220300b1996d2855ddef20053c01294f8295fde0840645c41b75632d71dd2fc276219084fe4105fd057623f39375542358796425a2d03
+DIST virtualbox-help-7.0.16.tar.xz 3948696 BLAKE2B 5c5937313ea0e5cb4764b8a61fd1587e88a4afc965ef00862c5a265a15253929d35e0635231b6be5656f26f600bc4b70a2fa2ebc0f33b35d35c184b57e5acef8 SHA512 b9baca57118a82e3489c8445f0988671f16f75de60cc2d929d5e3b0c4c9e3ceacd796a72a81bba88d69eb4b4559835a13775c18d7782ae7dbe8ad202e247db0c
+DIST virtualbox-help-7.0.18.tar.xz 3948116 BLAKE2B 5715a7e609297387b5fccce0951c62e5969fd68adeecb869712e69f5e90daef97384bd3ff3c39de40903a1fabe7ac6d2f8ecdbb40de16abe955d40e49b962eec SHA512 ec0f915b7221bc40d02f5f1675eb0defb5506b2f2bd96c063a96a9346e1c82428ccdda8b3adac43238c451ae185ac31af4a186da17ffe091469e14e696388b3a
+DIST virtualbox-patches-6.1.36.tar.bz2 2733 BLAKE2B dcfebfeca4873d382441515d48b4dfee9343bc7c83ea3cbb5002dbf7975143a79fae9a701b67dc35505e9ca03ff1b6293cb7c3279c4fdfda8ad21ba5fb9b7e87 SHA512 1bed5cdefbf8e7c4b0d9092ba4961ecf2262f27f35c71a91ef6f2e8fe8a1d92ed74f06bafbf58d70ba7165d933997f58073f4d4f4051e3ba5c0339b729066f57
+DIST virtualbox-patches-7.0.14.tar.bz2 6937 BLAKE2B da5f18efbba2a8f4701b3d29dc00784e4e80e18a18b029e5dce8c142eb4dc97637069bfc5081422064a7dc59dfacf503ebbdc3421caa96430dc53fa72988aa20 SHA512 57cc34b92e4626de5c445e34ae025da7ec0d752a60618c619a55c28bf7d6b1cc9dc81ea059b949b0f3e625568207e8084f9462faf487ca0daf2794e7f1feac36
+DIST virtualbox-patches-7.0.16.tar.bz2 6808 BLAKE2B d15fa2ca306375142c3e25d4759d2790b2bb9eb69e333a8773ad500b29dd127b401943abf59ca59d01858a3ed5551fb3a6c93c4c893c8de971a714ce5306d577 SHA512 a488cbc6660fe8637c44cd79d87156609af089988239a7e76fea8a3c7e6319512c574bef2e942b354b14ce671a8e75ab8b2160abf7c40963795ee8a545ecd992
+DIST virtualbox-patches-7.1.0_pre20240419.tar.bz2 5316 BLAKE2B 1a890b7d19cb252c7801b68c299676e2cd7a209a57a03cb39025e1a969a1c73142eb96154dae8469405f93d61969154428ea0fe3950a00d8a0a69dc8aefb4fc9 SHA512 ce4f850ce87652ef4eab039332048333949c94f0627bec8eb00d9689d7f8edcce372e2185ef8bbda9aef97781a2008b7c6464468cc38f3454dee862efc0ecdc9
diff --git a/app-emulation/virtualbox/files/virtualbox-5.2.8-paxmark-bldprogs.patch b/app-emulation/virtualbox/files/virtualbox-5.2.8-paxmark-bldprogs.patch
deleted file mode 100644
index 7eb1e1793a7f..000000000000
--- a/app-emulation/virtualbox/files/virtualbox-5.2.8-paxmark-bldprogs.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-2017-02-20 Quentin Minster <quentin@minster.io>
-
- #https://bugs.gentoo.org/show_bug.cgi?id=591582
- * Config.kmk: add paxmark befor VBOX_VBOXTPG get run.
- * src/VBox/VMM/Makefile.kmk: add paxmark befor VBOX_VBOXCPP get run.
- * src/VBox/Main/Makefile.kmk: add paxmark befor USBIdDatabaseGenerator_1_TARGET get run.
-
---- a/Config.kmk
-+++ b/Config.kmk 2016-09-21 02:22:28
-@@ -3719,11 +3719,13 @@
- $(if-expr $(intersects $(KBUILD_TARGET_ARCH),$(KBUILD_ARCHES_64)),-64,-32) \
- -h --host-$(VBOX_HC_ARCH_BITS)-bit #-vvv
- define TOOL_VBoxTpG_DTRACE_HDR_CMDS
-+ $(QUIET)paxmark.sh -m "$(VBOX_VBOXTPG)"
- $(QUIET)$(VBOX_VBOXTPG) $(flags) -o "$(out)" -s "$(source)"
- endef
- TOOL_VBoxTpG_DTRACE_OBJ_NOT_NEEDED :=
- TOOL_VBoxTpG_DTRACE_OBJ_FLAGS := -G --host-$(VBOX_HC_ARCH_BITS)-bit #-vvv
- define TOOL_VBoxTpG_DTRACE_OBJ_CMDS
-+ $(QUIET)paxmark.sh -m "$(VBOX_VBOXTPG)"
- $(QUIET)$(VBOX_VBOXTPG) \
- $(if-expr $(intersects $(bld_trg_arch),$(KBUILD_ARCHES_64)),-64,-32) \
- $(flags) \
-@@ -3738,6 +3740,7 @@
- TOOL_VBoxTpG-Disabled_DTRACE_DEPORD = $(VBOX_VBOXTPG)
- TOOL_VBoxTpG-Disabled_DTRACE_HDR_FLAGS := -h
- define TOOL_VBoxTpG-Disabled_DTRACE_HDR_CMDS
-+ $(QUIET)paxmark.sh -m "$(VBOX_VBOXTPG)"
- $(QUIET)$(VBOX_VBOXTPG) $(flags) -o "$(out)" -s "$(source)"
- endef
- TOOL_VBoxTpG-Disabled_DTRACE_OBJ_NOT_NEEDED := $(KBUILD_OSES)
-@@ -3752,6 +3755,7 @@
- TOOL_DTraceAndVBoxTpG_DTRACE_HDR_CMDS =
- define TOOL_DTraceAndVBoxTpG_DTRACE_HDR_CMDS
- $(TOOL_StandardDTrace_DTRACE_HDR_CMDS)
-+ $(QUIET)paxmark.sh -m "$(VBOX_VBOXTPG)"
- $(QUIET)$(VBOX_VBOXTPG) --generate-wrapper-header --host-$(VBOX_HC_ARCH_BITS)-bit --ring-3-context \
- $(filter-out -C, $(filter-out -h,$(flags))) \
- -o "$(out).tmp" -s "$(source)"
---- a/src/VBox/VMM/Makefile.kmk 2018-04-10 15:26:24.622867735 +0300
-+++ b/src/VBox/VMM/Makefile.kmk 2018-04-10 15:24:35.901998796 +0300
-@@ -896,6 +896,7 @@
- $$(VMMLibDTrace_0_OUTDIR)/$1: $2 $$(VBOX_VBOXCPP) | $$$$(dir $$$$@)
- $$(call KB_FN_AUTO_CMD_DEPS_COMMANDS)
- $$(QUIET)$$(call MSG_GENERATE,VMMLibDTrace,$$@,$2)
-+ $$(QUIET)paxmark.sh -m "$(VBOX_VBOXCPP)"
- $$(QUIET)$(VBOX_VBOXCPP) -d \
- -D VBOX_FOR_DTRACE_LIB \
- -D VBOX_FOR_DTRACE_LIB_$(toupper $(KBUILD_TARGET_ARCH)) \
---- a/src/VBox/Main/Makefile.kmk 2018-04-10 15:26:15.292793067 +0300
-+++ b/src/VBox/Main/Makefile.kmk 2018-04-10 15:25:14.042303341 +0300
-@@ -607,6 +607,7 @@
- $(PATH_SUB_CURRENT)/src-server/usb.ids $(PATH_SUB_CURRENT)/src-server/custom.ids | $$(dir $$@)
- $(call KB_FN_AUTO_CMD_DEPS_COMMANDS)
- $(call MSG_GENERATE,USBIdDatabase,$@,$(USBIdDatabaseGenerator_1_TARGET))
-+ $(QUIET)paxmark.sh -m "$(USBIdDatabaseGenerator_1_TARGET)"
- $(QUIET)$(USBIdDatabaseGenerator_1_TARGET) -o "$@" $(filter %.ids,$^)
-
- BLDPROGS += USBIdDatabaseGenerator
diff --git a/app-emulation/virtualbox/files/virtualbox-6.1.34-r3-python.patch b/app-emulation/virtualbox/files/virtualbox-6.1.34-r3-python.patch
new file mode 100644
index 000000000000..3a6da1f681c1
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-6.1.34-r3-python.patch
@@ -0,0 +1,14 @@
+diff --git a/configure b/configure
+index fd2e296..695f6a7 100755
+--- a/configure
++++ b/configure
+@@ -1987,6 +1987,9 @@ check_python()
+ {
+ test_header "Python support"
+
++ # We force the right implementation in the ebuild instead
++ return
++
+ # On darwin this is a on/off decision only
+ if [ "$OS" = "darwin" ]; then
+ echo "enabled"
diff --git a/app-emulation/virtualbox/files/virtualbox-6.1.34-vboxr0.patch b/app-emulation/virtualbox/files/virtualbox-6.1.34-vboxr0.patch
deleted file mode 100644
index 8d8105edee9a..000000000000
--- a/app-emulation/virtualbox/files/virtualbox-6.1.34-vboxr0.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-https://www.virtualbox.org/ticket/20904
-
---- VirtualBox-6.1.34/Config.kmk
-+++ VirtualBox-6.1.34/Config.kmk
-@@ -4502,11 +4502,14 @@
- TEMPLATE_VBoxR0_TOOL = $(VBOX_GCC_TOOL)
- TEMPLATE_VBoxR0_CFLAGS = -fno-pie -nostdinc -g $(VBOX_GCC_pipe) $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_C) \
- $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fno-exceptions \
-- $(VBOX_GCC_fno-stack-protector) -fno-common $(VBOX_GCC_fvisibility-hidden) -std=gnu99 $(VBOX_GCC_IPRT_FMT_CHECK)
-+ $(VBOX_GCC_fno-stack-protector) -fno-common -ffreestanding $(VBOX_GCC_fvisibility-hidden) -std=gnu99 $(VBOX_GCC_IPRT_FMT_CHECK)
- TEMPLATE_VBoxR0_CXXFLAGS = -fno-pie -nostdinc -g $(VBOX_GCC_pipe) $(VBOX_GCC_WERR) $(VBOX_GCC_PEDANTIC_CXX) \
- $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fno-exceptions \
- $(VBOX_GCC_fno-stack-protector) -fno-common $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden) \
- -fno-rtti $(VBOX_GCC_IPRT_FMT_CHECK)
-+ if $(VBOX_GCC_VERSION_CC) >= 40500 # 4.1.2 complains, 4.5.2 is okay, didn't check which version inbetween made it okay with g++.
-+TEMPLATE_VBoxR0_CXXFLAGS += -ffreestanding
-+ endif
- TEMPLATE_VBoxR0_CFLAGS.amd64 = -m64 -mno-red-zone -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fasynchronous-unwind-tables -ffreestanding
- TEMPLATE_VBoxR0_CXXFLAGS.amd64 = -m64 -mno-red-zone -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -fasynchronous-unwind-tables
- TEMPLATE_VBoxR0_CXXFLAGS.freebsd = -ffreestanding
diff --git a/app-emulation/virtualbox/files/virtualbox-6.1.36-fcf-protection.patch b/app-emulation/virtualbox/files/virtualbox-6.1.36-fcf-protection.patch
new file mode 100644
index 000000000000..14b11f734c71
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-6.1.36-fcf-protection.patch
@@ -0,0 +1,16 @@
+Bug https://bugs.gentoo.org/865361
+
+gcc does not support -fcf-protection for i386 (needs i686+),
+so disable it when building iPxeBaseBin.
+
+--- a/src/VBox/Devices/PC/ipxe/Makefile.kmk
++++ b/src/VBox/Devices/PC/ipxe/Makefile.kmk
+@@ -176,6 +177,8 @@
+
+ iPxeBaseBin_TEMPLATE = iPxe
+
++ iPxeBaseBin_CFLAGS = -fcf-protection=none
++
+ iPxeBaseBin_INCS = \
+ src \
+ src/include \
diff --git a/app-emulation/virtualbox/files/virtualbox-6.1.44-fix-libxml2.patch b/app-emulation/virtualbox/files/virtualbox-6.1.44-fix-libxml2.patch
new file mode 100644
index 000000000000..c3e76e58c3f2
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-6.1.44-fix-libxml2.patch
@@ -0,0 +1,25 @@
+With dev-libs/libxml2-2.11, xi:include errors out if it can't find a file, so add an empty fallback.
+Used to work with dev-libs/libxml2-2.10.
+
+See also: https://bugs.gentoo.org/906309
+
+--- a/doc/manual/en_US/user_Frontends.xml
++++ b/doc/manual/en_US/user_Frontends.xml
+@@ -1205,6 +1205,6 @@
+
+ </sect1>
+
+- <xi:include href="user_man_VBoxHeadless.xml" xpointer="element(/1)" xmlns:xi="http://www.w3.org/2001/XInclude" />
++ <xi:include href="user_man_VBoxHeadless.xml" xpointer="element(/1)" xmlns:xi="http://www.w3.org/2001/XInclude" ><xi:fallback/></xi:include>
+
+ </chapter>
+--- b/doc/manual/en_US/user_VBoxManage.xml
++++ a/doc/manual/en_US/user_VBoxManage.xml
+@@ -8975,6 +8975,6 @@
+ <!-- TODO: Figure out how we can handle other manpages. The xml is bolted to
+ sect1, so it's not possible to have them "in place" -->
+
+- <xi:include href="user_man_vboximg-mount.xml" xpointer="element(/1)" xmlns:xi="http://www.w3.org/2001/XInclude" />
++ <xi:include href="user_man_vboximg-mount.xml" xpointer="element(/1)" xmlns:xi="http://www.w3.org/2001/XInclude" ><xi:fallback/></xi:include>
+
+ </chapter>
diff --git a/app-emulation/virtualbox/files/virtualbox-7.0.14-libxml2-2.12.patch b/app-emulation/virtualbox/files/virtualbox-7.0.14-libxml2-2.12.patch
new file mode 100644
index 000000000000..a523bad41a30
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-7.0.14-libxml2-2.12.patch
@@ -0,0 +1,43 @@
+Bug: https://bugs.gentoo.org/922445
+
+The change in libxml2 is not backwards compatibe.
+A patch like the one in arch does not work with 2.11, so just cast the argument to maintain compatibility with both.
+
+The upstream change is in include/libxml/xmlerror.h:
+
+ typedef xmlError *xmlErrorPtr;
+
+-typedef void (*xmlStructuredErrorFunc) (void *userData, xmlErrorPtr error);
++typedef void (*xmlStructuredErrorFunc) (void *userData, const xmlError *error);
+
+See also: https://gitlab.archlinux.org/archlinux/packaging/packages/virtualbox/-/blob/main/019-libxml-2-12.patch?ref_type=heads
+
+--- a/src/VBox/Runtime/r3/xml.cpp
++++ b/src/VBox/Runtime/r3/xml.cpp
+@@ -1870,7 +1870,7 @@
+ throw std::bad_alloc();
+ /* per-thread so it must be here */
+ xmlSetGenericErrorFunc(NULL, xmlParserBaseGenericError);
+- xmlSetStructuredErrorFunc(NULL, xmlParserBaseStructuredError);
++ xmlSetStructuredErrorFunc(NULL, (xmlStructuredErrorFunc)xmlParserBaseStructuredError);
+ }
+
+ XmlParserBase::~XmlParserBase()
+@@ -1931,7 +1931,7 @@
+ pcszFilename,
+ NULL, // encoding = auto
+ options)))
+- throw XmlError(xmlCtxtGetLastError(m_ctxt));
++ throw XmlError((xmlErrorPtr)xmlCtxtGetLastError(m_ctxt));
+
+ doc.refreshInternals();
+ }
+@@ -2191,7 +2191,7 @@
+ pcszFilename,
+ NULL, // encoding = auto
+ options)))
+- throw XmlError(xmlCtxtGetLastError(m_ctxt));
++ throw XmlError((xmlErrorPtr)xmlCtxtGetLastError(m_ctxt));
+
+ doc.refreshInternals();
+ }
diff --git a/app-emulation/virtualbox/files/virtualbox-7.0.8-disable-rebuild-iPxeBiosBin.patch b/app-emulation/virtualbox/files/virtualbox-7.0.8-disable-rebuild-iPxeBiosBin.patch
new file mode 100644
index 000000000000..29ec3aee72c1
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-7.0.8-disable-rebuild-iPxeBiosBin.patch
@@ -0,0 +1,18 @@
+When compiling with clang we get:
+
+src/VBox/Devices/PC/ipxe/src/core/settings.c:310:8: error: fields must have a constant size: 'variable length array in structure' extension will never be supported
+
+Apply this patch conditionally to disable rebuilding iPxeBiosBin.rom when using clang.
+
+--- a/src/VBox/Devices/PC/ipxe/Makefile.kmk
++++ b/src/VBox/Devices/PC/ipxe/Makefile.kmk
+@@ -45,7 +45,8 @@
+ iPxeBiosBin_CLEAN = \
+ $(iPxeBiosBin_0_OUTDIR)/iPxeBiosBin.c \
+
+-if1of ($(KBUILD_TARGET), darwin os2 solaris win)
++# Disable building on Linux if using clang
++if1of ($(KBUILD_TARGET), darwin os2 solaris win linux)
+ $$(iPxeBiosBin_0_OUTDIR)/iPxeBiosBin.c: $(PATH_SUB_CURRENT)/iPxeBiosBin.rom $(VBOX_BIN2C) | $$(dir $$@)
+ $(call MSG_TOOL,bin2c,iPxeBiosBin,$<,$@)
+ $(QUIET)$(VBOX_BIN2C) -min 32 -max 56 -mask 0x1ff -export NetBiosBinary $< $@
diff --git a/app-emulation/virtualbox/files/virtualbox-ose-6-wrapper b/app-emulation/virtualbox/files/virtualbox-ose-6-wrapper
index af8090dd09af..57b15cc93eba 100644
--- a/app-emulation/virtualbox/files/virtualbox-ose-6-wrapper
+++ b/app-emulation/virtualbox/files/virtualbox-ose-6-wrapper
@@ -60,7 +60,7 @@ WARNING: The character device /dev/vboxdrv does not exist.
EOF
fi
-SERVER_PID=`ps -U \`whoami\` | grep VBoxSVC | awk '{ print $1 }'`
+SERVER_PID=$(ps -U ${LOGNAME:-$USER} | grep VBoxSVC | awk '{ print $1 }')
if [ -z "$SERVER_PID" ]; then
# Server not running yet/anymore, cleanup socket path.
# See IPC_GetDefaultSocketPath()!
diff --git a/app-emulation/virtualbox/metadata.xml b/app-emulation/virtualbox/metadata.xml
index 3b96b5b36a19..0a281e0f998b 100644
--- a/app-emulation/virtualbox/metadata.xml
+++ b/app-emulation/virtualbox/metadata.xml
@@ -2,16 +2,17 @@
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
- <email>polynomial-c@gentoo.org</email>
- <name>Lars Wendler</name>
+ <email>ceamac@gentoo.org</email>
+ <name>Viorel Munteanu</name>
</maintainer>
<use>
- <flag name="dtrace">Install dtrace Extension Pack</flag>
- <flag name="headless">Build without any graphic frontend</flag>
- <flag name="lvm">Build VBoxVolInfo that needs devicemapper from <pkg>sys-fs/lvm2</pkg>.</flag>
- <flag name="pax-kernel">Apply patch needed for pax enabled kernels.</flag>
- <flag name="sdk">Enable building of SDK</flag>
- <flag name="udev">Controls installation of special USB udev rules.</flag>
- <flag name="vboxwebsrv">Build and install the VirtualBox webservice</flag>
-</use>
+ <flag name="dtrace">Install dtrace Extension Pack</flag>
+ <flag name="headless">Build without any graphic frontend</flag>
+ <flag name="lvm">Build VBoxVolInfo that needs devicemapper from <pkg>sys-fs/lvm2</pkg>.</flag>
+ <flag name="pax-kernel">Apply patch needed for pax enabled kernels.</flag>
+ <flag name="sdk">Enable building of SDK</flag>
+ <flag name="udev">Controls installation of special USB udev rules.</flag>
+ <flag name="vboxwebsrv">Build and install the VirtualBox webservice</flag>
+ <flag name="vde">Support for VDE networking via <pkg>net-misc/vde</pkg></flag>
+ </use>
</pkgmetadata>
diff --git a/app-emulation/virtualbox/virtualbox-6.1.32-r1.ebuild b/app-emulation/virtualbox/virtualbox-6.1.32-r1.ebuild
deleted file mode 100644
index 96494cca02e5..000000000000
--- a/app-emulation/virtualbox/virtualbox-6.1.32-r1.ebuild
+++ /dev/null
@@ -1,514 +0,0 @@
-# Copyright 2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{8..10} )
-inherit desktop flag-o-matic java-pkg-opt-2 linux-info pax-utils python-single-r1 tmpfiles toolchain-funcs udev xdg
-
-MY_PN="VirtualBox"
-MY_PV="${PV/beta/BETA}"
-MY_PV="${MY_PV/rc/RC}"
-MY_P=${MY_PN}-${MY_PV}
-[[ "${PV}" == *a ]] && DIR_PV="$(ver_cut 1-3)"
-
-DESCRIPTION="Family of powerful x86 virtualization products for enterprise and home use"
-HOMEPAGE="https://www.virtualbox.org/"
-SRC_URI="https://download.virtualbox.org/virtualbox/${DIR_PV:-${MY_PV}}/${MY_P}.tar.bz2
- https://dev.gentoo.org/~polynomial-c/${PN}/patchsets/${PN}-6.1.12-patches-01.tar.xz"
-
-LICENSE="GPL-2 dtrace? ( CDDL )"
-SLOT="0/$(ver_cut 1-2)"
-[[ "${PV}" == *_beta* ]] || [[ "${PV}" == *_rc* ]] || \
-KEYWORDS="amd64"
-IUSE="alsa debug doc dtrace headless java lvm +opus pam pax-kernel pch pulseaudio +opengl python +qt5 +sdk +udev vboxwebsrv vnc"
-
-COMMON_DEPEND="
- ${PYTHON_DEPS}
- !app-emulation/virtualbox-bin
- acct-group/vboxusers
- ~app-emulation/virtualbox-modules-${DIR_PV:-${PV}}
- dev-libs/libIDL
- >=dev-libs/libxslt-1.1.19
- net-misc/curl
- dev-libs/libxml2
- media-libs/libpng:0=
- media-libs/libvpx:0=
- sys-libs/zlib:=
- !headless? (
- media-libs/libsdl:0[X,video]
- x11-libs/libX11
- x11-libs/libxcb:=
- x11-libs/libXcursor
- x11-libs/libXext
- x11-libs/libXmu
- x11-libs/libXt
- opengl? (
- media-libs/libglvnd[X]
- virtual/glu
- )
- qt5? (
- dev-qt/qtcore:5
- dev-qt/qtgui:5
- dev-qt/qtprintsupport:5
- dev-qt/qtwidgets:5
- dev-qt/qtx11extras:5
- opengl? ( dev-qt/qtopengl:5 )
- x11-libs/libXinerama
- )
- )
- dev-libs/openssl:0=
- virtual/libcrypt:=
- lvm? ( sys-fs/lvm2 )
- opus? ( media-libs/opus )
- udev? ( >=virtual/udev-171 )
- vnc? ( >=net-libs/libvncserver-0.9.9 )
-"
-DEPEND="
- ${COMMON_DEPEND}
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- !headless? (
- x11-libs/libXinerama
- opengl? ( virtual/opengl )
- )
- pam? ( sys-libs/pam )
- pax-kernel? ( sys-apps/elfix )
- pulseaudio? ( media-sound/pulseaudio )
- qt5? ( dev-qt/linguist-tools:5 )
- vboxwebsrv? ( net-libs/gsoap[-gnutls(-)] )
-"
-BDEPEND="
- ${PYTHON_DEPS}
- >=dev-util/kbuild-0.1.9998.3127
- >=dev-lang/yasm-0.6.2
- sys-devel/bin86
- sys-libs/libcap
- sys-power/iasl
- virtual/pkgconfig
- doc? (
- app-text/docbook-sgml-dtd:4.4
- 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 )
-"
-RDEPEND="
- ${COMMON_DEPEND}
- java? ( >=virtual/jre-1.6 )
-"
-
-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_7.so
- usr/lib/virtualbox/VBoxXPCOMC.so
- usr/lib/virtualbox/VBoxOGLhostcrutil.so
- usr/lib/virtualbox/VBoxNetDHCP.so
- usr/lib/virtualbox/VBoxNetNAT.so"
-
-S="${WORKDIR}/${MY_PN}-${DIR_PV:-${MY_PV}}"
-
-REQUIRED_USE="
- java? ( sdk )
- python? ( sdk )
- vboxwebsrv? ( java )
- ${PYTHON_REQUIRED_USE}
-"
-
-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
-}
-
-pkg_setup() {
- java-pkg-opt-2_pkg_setup
- python-single-r1_pkg_setup
-
- tc-ld-disable-gold #bug 488176
- tc-export CC CXX LD AR RANLIB
- export HOST_CC="$(tc-getBUILD_CC)"
-}
-
-src_prepare() {
- # Remove shipped binaries (kBuild,yasm), see bug #232775
- rm -r kBuild/bin tools || die
-
- # Replace pointless GCC version check with something less stupid.
- # This is needed for the qt5 version check.
- sed -e 's@^check_gcc$@cc_maj="$(${CC} -dumpversion | cut -d. -f1)" ; cc_min="$(${CC} -dumpversion | cut -d. -f2)"@' \
- -i configure || 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
-
- # 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
-
- eapply "${FILESDIR}/${PN}-6.1.26-configure-include-qt5-path.patch" #805365
-
- eapply "${WORKDIR}/patches"
-
- default
-}
-
-doecho() {
- echo "$@"
- "$@" || die
-}
-
-src_configure() {
- local myconf=(
- --with-gcc="$(tc-getCC)"
- --with-g++="$(tc-getCXX)"
- --disable-dbus
- --disable-kmods
- $(usex alsa '' --disable-alsa)
- $(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)
- )
- else
- myconf+=(
- --build-headless
- --disable-opengl
- )
- fi
- if use amd64 && ! has_multilib_profile ; then
- myconf+=( --disable-vmmraw )
- fi
- # not an autoconf script
- doecho ./configure "${myconf[@]}"
-}
-
-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}"
- MAKE="kmk" emake \
- VBOX_BUILD_PUBLISHER=_Gentoo \
- TOOL_GXX3_CC="$(tc-getCC)" TOOL_GXX3_CXX="$(tc-getCXX)" \
- TOOL_GXX3_LD="$(tc-getCXX)" VBOX_GCC_OPT="${CXXFLAGS}" \
- TOOL_YASM_AS=yasm KBUILD_VERBOSE=2 \
- VBOX_WITH_VBOXIMGMOUNT=1 \
- 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,Tunctl,VMMPreload,XPCOMIPCD} vboximg-mount *so *r0 iPxeBaseBin ; 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}/VBoxTunctl /usr/bin/VBoxTunctl
- 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
- vbox_inst rdesktop-vrdp
- 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
-
- 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)"
- insinto ${udevdir}
- doins VBoxCreateUSBNode.sh
- fowners root:vboxusers ${udevdir}/VBoxCreateUSBNode.sh
- fperms 0750 ${udevdir}/VBoxCreateUSBNode.sh
- insinto ${udevdir}/rules.d
- sed "s@%UDEVDIR%@${udevdir}@" "${FILESDIR}"/10-virtualbox.rules \
- > "${T}"/10-virtualbox.rules || die
- doins "${T}"/10-virtualbox.rules
- 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" -print0 \
- | xargs --no-run-if-empty --null 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
-
- newtmpfiles "${FILESDIR}"/${PN}-vboxusb_tmpfilesd ${PN}-vboxusb.conf
-}
-
-pkg_postinst() {
- xdg_pkg_postinst
-
- if use udev ; then
- udevadm control --reload-rules \
- && 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 "http://download.virtualbox.org/virtualbox/${DIR_PV:-${PV}}/UserManual.pdf"
- elog ""
- elog "For advanced networking setups you should emerge:"
- elog "net-misc/bridge-utils and sys-apps/usermode-utilities"
- 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."
- elog "Starting with version 5.0.0, ${PN} no longer has the \"additions\" and"
- elog "the \"extension\" USE flag. For installation of the guest additions ISO"
- elog "image, please emerge"
- elog " app-emulation/virtualbox-additions"
- elog "and for the USB2, USB3, VRDP and PXE boot ROM modules, please emerge"
- elog " app-emulation/virtualbox-extpack-oracle"
- if ! use udev ; then
- elog ""
- elog "WARNING!"
- elog "Without USE=udev, USB devices will likely not work in ${PN}."
- elif [[ -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
-}
diff --git a/app-emulation/virtualbox/virtualbox-6.1.34.ebuild b/app-emulation/virtualbox/virtualbox-6.1.50-r2.ebuild
index ffef67a75eb1..a41107315c77 100644
--- a/app-emulation/virtualbox/virtualbox-6.1.34.ebuild
+++ b/app-emulation/virtualbox/virtualbox-6.1.50-r2.ebuild
@@ -1,34 +1,45 @@
-# Copyright 2022 Gentoo Authors
+# Copyright 2022-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
-PYTHON_COMPAT=( python3_{8..10} )
-inherit desktop flag-o-matic java-pkg-opt-2 linux-info pax-utils python-single-r1 tmpfiles toolchain-funcs udev xdg
+# 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_{10..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_PV="${PV/beta/BETA}"
-MY_PV="${MY_PV/rc/RC}"
-MY_P=${MY_PN}-${MY_PV}
-[[ "${PV}" == *a ]] && DIR_PV="$(ver_cut 1-3)"
+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/${DIR_PV:-${MY_PV}}/${MY_P}.tar.bz2
- https://dev.gentoo.org/~polynomial-c/${PN}/patchsets/${PN}-6.1.12-patches-01.tar.xz"
+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 dtrace? ( CDDL )"
SLOT="0/$(ver_cut 1-2)"
-[[ "${PV}" == *_beta* ]] || [[ "${PV}" == *_rc* ]] || \
-KEYWORDS="~amd64"
-IUSE="alsa debug doc dtrace headless java lvm +opus pam pax-kernel pch pulseaudio +opengl python +qt5 +sdk +udev vboxwebsrv vnc"
+KEYWORDS="amd64"
+IUSE="alsa 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}
- !app-emulation/virtualbox-bin
acct-group/vboxusers
- ~app-emulation/virtualbox-modules-${DIR_PV:-${PV}}
- dev-libs/libIDL
+ ~app-emulation/virtualbox-modules-${PV}
>=dev-libs/libxslt-1.1.19
net-misc/curl
dev-libs/libxml2
@@ -36,7 +47,8 @@ COMMON_DEPEND="
media-libs/libvpx:0=
sys-libs/zlib:=
!headless? (
- media-libs/libsdl:0[X,video]
+ sdl? ( media-libs/libsdl:0[X,video] )
+ x11-base/xorg-proto
x11-libs/libX11
x11-libs/libxcb:=
x11-libs/libXcursor
@@ -62,25 +74,40 @@ COMMON_DEPEND="
lvm? ( sys-fs/lvm2 )
opus? ( media-libs/opus )
udev? ( >=virtual/udev-171 )
+ 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}
alsa? ( >=media-libs/alsa-lib-1.0.13 )
!headless? (
x11-libs/libXinerama
+ x11-libs/libXrandr
opengl? ( virtual/opengl )
)
+ java? ( virtual/jdk:1.8 )
pam? ( sys-libs/pam )
pax-kernel? ( sys-apps/elfix )
- pulseaudio? ( media-sound/pulseaudio )
- qt5? ( dev-qt/linguist-tools:5 )
- vboxwebsrv? ( net-libs/gsoap[-gnutls(-)] )
+ pulseaudio? ( media-libs/libpulse )
"
BDEPEND="
${PYTHON_DEPS}
- >=dev-util/kbuild-0.1.9998.3127
+ >=app-arch/tar-1.34-r2
+ >=dev-build/kbuild-0.1.9998.3127
+ <=dev-build/kbuild-0.1.9998.3500
>=dev-lang/yasm-0.6.2
+ dev-libs/libIDL
+ sys-apps/which
sys-devel/bin86
sys-libs/libcap
sys-power/iasl
@@ -94,21 +121,32 @@ BDEPEND="
dev-texlive/texlive-fontsrecommended
dev-texlive/texlive-fontsextra
)
- java? ( >=virtual/jdk-1.8 )
+ java? ( virtual/jdk:1.8 )
+ qt5? ( dev-qt/linguist-tools:5 )
"
RDEPEND="
${COMMON_DEPEND}
- java? ( >=virtual/jre-1.6 )
+ java? ( virtual/jre: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="
@@ -116,12 +154,11 @@ QA_WX_LOAD="
"
QA_PRESTRIPPED="
- /usr/lib64/virtualbox/VMMR0.r0
- /usr/lib64/virtualbox/VBoxDDR0.r0
+ usr/lib64/virtualbox/VMMR0.r0
+ usr/lib64/virtualbox/VBoxDDR0.r0
+ usr/lib64/virtualbox/ExtensionPacks/Oracle_VBoxDTrace_Extension_Pack/linux.amd64/VBoxDTraceR0.r0
"
-S="${WORKDIR}/${MY_PN}-${DIR_PV:-${MY_PV}}"
-
REQUIRED_USE="
java? ( sdk )
python? ( sdk )
@@ -130,7 +167,24 @@ REQUIRED_USE="
"
PATCHES=(
- "${FILESDIR}/${P}-vboxr0.patch"
+ "${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
+
+ # 906309
+ "${FILESDIR}"/${PN}-6.1.44-fix-libxml2.patch
+ # 922445
+ "${FILESDIR}"/${PN}-7.0.14-libxml2-2.12.patch
+
+ # Downloaded patchset
+ "${WORKDIR}"/virtualbox-patches-6.1.36/patches
)
pkg_pretend() {
@@ -149,22 +203,34 @@ pkg_pretend() {
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
-
- tc-ld-disable-gold #bug 488176
- tc-export CC CXX LD AR RANLIB
- export HOST_CC="$(tc-getBUILD_CC)"
}
src_prepare() {
- # Remove shipped binaries (kBuild,yasm), see bug #232775
+ 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
+
+ # Remove shipped binaries (kBuild, yasm), see bug #232775
rm -r kBuild/bin tools || die
- # Replace pointless GCC version check with something less stupid.
+ # Replace pointless GCC version check with something more sensible.
# This is needed for the qt5 version check.
sed -e 's@^check_gcc$@cc_maj="$(${CC} -dumpversion | cut -d. -f1)" ; cc_min="$(${CC} -dumpversion | cut -d. -f2)"@' \
-i configure || die
@@ -179,6 +245,9 @@ src_prepare() {
>> LocalConfig.kmk || die
fi
+ # bug #916002, #488176
+ tc-ld-force-bfd
+
# Respect LDFLAGS
sed -e "s@_LDFLAGS\.${ARCH}*.*=@& ${LDFLAGS}@g" \
-i Config.kmk src/libs/xpcom18a4/Config.kmk || die
@@ -202,49 +271,53 @@ src_prepare() {
java-pkg-opt-2_src_prepare
fi
- # 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
-
- eapply "${FILESDIR}/${PN}-6.1.26-configure-include-qt5-path.patch" #805365
+ # 890561
+ echo -e "\nVBOX_GTAR=gtar" >> LocalConfig.kmk || die
+}
- eapply "${WORKDIR}/patches"
+src_configure() {
+ #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
- default
-}
+ # 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
-doecho() {
- echo "$@"
- "$@" || die
-}
+ tc-export AR CC CXX LD RANLIB
+ export HOST_CC="$(tc-getBUILD_CC)"
-src_configure() {
local myconf=(
--with-gcc="$(tc-getCC)"
--with-g++="$(tc-getCXX)"
+
--disable-dbus
--disable-kmods
- $(usex alsa '' --disable-alsa)
- $(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 '')
+
+ $(usev !alsa --disable-alsa)
+ $(usev debug --build-debug)
+ $(usev !doc --disable-docs)
+ $(usev !java --disable-java)
+ $(usev !lvm --disable-devmapper)
+ $(usev !opus --disable-libopus)
+ $(usev !pulseaudio --disable-pulse)
+ $(usev !python --disable-python)
+ $(usev vboxwebsrv --enable-webservice)
+ $(usev vnc --enable-vnc)
)
+
if ! use headless ; then
myconf+=(
- $(usex opengl '' --disable-opengl)
- $(usex qt5 '' --disable-qt)
+ $(usev !opengl --disable-opengl)
+ $(usev !qt5 --disable-qt)
+ $(usev !sdl --disable-sdl)
)
else
myconf+=(
@@ -252,27 +325,118 @@ src_configure() {
--disable-opengl
)
fi
+
if use amd64 && ! has_multilib_profile ; then
myconf+=( --disable-vmmraw )
fi
+
+ # bug #908814
+ filter-lto
+
+ # bug #843437
+ cat >> LocalConfig.kmk <<-EOF || die
+ CXXFLAGS=${CXXFLAGS}
+ CFLAGS=${CFLAGS}
+ EOF
+
# not an autoconf script
- doecho ./configure "${myconf[@]}"
+ 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}) #'
+ MAKEJOBS=$(grep -Eo '(\-j|\-\-jobs)(=?|[[:space:]]*)[[:digit:]]+' <<< ${MAKEOPTS})
+ MAKELOAD=$(grep -Eo '(\-l|\-\-load-average)(=?|[[:space:]]*)[[:digit:]]+' <<< ${MAKEOPTS})
MAKEOPTS="${MAKEJOBS} ${MAKELOAD}"
- MAKE="kmk" emake \
- VBOX_BUILD_PUBLISHER=_Gentoo \
- TOOL_GXX3_CC="$(tc-getCC)" TOOL_GXX3_CXX="$(tc-getCXX)" \
- TOOL_GXX3_LD="$(tc-getCXX)" VBOX_GCC_OPT="${CXXFLAGS}" \
- TOOL_YASM_AS=yasm KBUILD_VERBOSE=2 \
- VBOX_WITH_VBOXIMGMOUNT=1 \
- all
+
+ 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() {
@@ -313,7 +477,8 @@ src_install() {
insinto ${vbox_inst_path}
doins -r components
- for each in VBox{Autostart,BalloonCtrl,BugReport,CpuReport,ExtPackHelperApp,Manage,SVC,Tunctl,VMMPreload,XPCOMIPCD} vboximg-mount *so *r0 iPxeBaseBin ; do
+ for each in VBox{Autostart,BalloonCtrl,BugReport,CpuReport,ExtPackHelperApp,Manage,SVC,Tunctl,VMMPreload,XPCOMIPCD} \
+ vboximg-mount *so *r0 iPxeBaseBin ; do
vbox_inst ${each}
done
@@ -334,8 +499,9 @@ src_install() {
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}
+ 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}/VBoxTunctl /usr/bin/VBoxTunctl
dosym ${vbox_inst_path}/vboximg-mount /usr/bin/vboximg-mount
@@ -351,12 +517,14 @@ src_install() {
if ! use headless ; then
vbox_inst rdesktop-vrdp
- vbox_inst VBoxSDL 4750
- pax-mark -m "${ED}"${vbox_inst_path}/VBoxSDL
+ 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
+ for each in vboxsdl VBoxSDL ; do
+ dosym ${vbox_inst_path}/VBox /usr/bin/${each}
+ done
+ fi
if use qt5 ; then
vbox_inst VirtualBox
@@ -443,9 +611,7 @@ src_install() {
# 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" -print0 \
- | xargs --no-run-if-empty --null sed -i '/Version/s@_Gentoo@@' \
- || die
+ find ExtensionPacks -type f -name "ExtPack.xml" -exec sed -i '/Version/s@_Gentoo@@' {} \+ || die
local extensions_dir="${vbox_inst_path}/ExtensionPacks"
@@ -463,6 +629,19 @@ src_install() {
dodoc UserManual.pdf
fi
+ if use python ; then
+ local mangled_python="${EPYTHON#python}"
+ mangled_python="${mangled_python/./_}"
+
+ local python_path_ext="${ED}/usr/$(get_libdir)/virtualbox/VBoxPython${mangled_python}.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
}
@@ -470,8 +649,8 @@ pkg_postinst() {
xdg_pkg_postinst
if use udev ; then
- udevadm control --reload-rules \
- && udevadm trigger --subsystem-match=usb
+ udev_reload
+ udevadm trigger --subsystem-match=usb
fi
tmpfiles_process virtualbox-vboxusb.conf
@@ -479,27 +658,24 @@ pkg_postinst() {
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 "http://download.virtualbox.org/virtualbox/${DIR_PV:-${PV}}/UserManual.pdf"
- elog ""
- elog "For advanced networking setups you should emerge:"
- elog "net-misc/bridge-utils and sys-apps/usermode-utilities"
+ elog "https://download.virtualbox.org/virtualbox/${PV}/UserManual.pdf"
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."
- elog "Starting with version 5.0.0, ${PN} no longer has the \"additions\" and"
- elog "the \"extension\" USE flag. For installation of the guest additions ISO"
- elog "image, please emerge"
- elog " app-emulation/virtualbox-additions"
- elog "and for the USB2, USB3, VRDP and PXE boot ROM modules, please emerge"
- elog " app-emulation/virtualbox-extpack-oracle"
+
+ 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
- elog ""
- elog "WARNING!"
- elog "Without USE=udev, USB devices will likely not work in ${PN}."
+ ewarn "Without USE=udev, USB devices will likely not work in ${PN}."
fi
}
+
+pkg_postrm() {
+ xdg_pkg_postrm
+
+ use udev && udev_reload
+}
diff --git a/app-emulation/virtualbox/virtualbox-7.0.14-r2.ebuild b/app-emulation/virtualbox/virtualbox-7.0.14-r2.ebuild
new file mode 100644
index 000000000000..5b6ec05dfcd1
--- /dev/null
+++ b/app-emulation/virtualbox/virtualbox-7.0.14-r2.ebuild
@@ -0,0 +1,740 @@
+# Copyright 2022-2024 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_{10..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-7.0.14.tar.bz2
+ gui? ( !doc? ( https://dev.gentoo.org/~ceamac/${CATEGORY}/${PN}/${PN}-help-${PV}.tar.xz ) )
+"
+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 +gui java lvm nls pam pch pulseaudio +opengl python +sdk +sdl +udev vboxwebsrv vde vnc"
+
+unset WATCOM #856769
+
+COMMON_DEPEND="
+ ${PYTHON_DEPS}
+ acct-group/vboxusers
+ ~app-emulation/virtualbox-modules-${PV}
+ dev-libs/libtpms
+ 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 )
+ gui? (
+ 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
+ x11-libs/libX11
+ x11-libs/libXt
+ opengl? ( dev-qt/qtopengl:5 )
+ )
+ lvm? ( sys-fs/lvm2 )
+ opengl? (
+ media-libs/libglvnd[X]
+ media-libs/vulkan-loader
+ x11-libs/libX11
+ x11-libs/libXt
+ )
+ pam? ( sys-libs/pam )
+ sdl? (
+ media-libs/libsdl2[X,video]
+ x11-libs/libX11
+ x11-libs/libXcursor
+ x11-libs/libXt
+ )
+ vboxwebsrv? ( net-libs/gsoap[-gnutls(-),debug?] )
+ vde? ( net-misc/vde )
+ 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 )
+ gui? (
+ x11-base/xorg-proto
+ x11-libs/libxcb:=
+ x11-libs/libXcursor
+ x11-libs/libXext
+ x11-libs/libXinerama
+ x11-libs/libXmu
+ x11-libs/libXrandr
+ )
+ java? ( virtual/jdk:1.8 )
+ opengl? (
+ x11-base/xorg-proto
+ x11-libs/libXcursor
+ x11-libs/libXinerama
+ x11-libs/libXmu
+ x11-libs/libXrandr
+ virtual/glu
+ )
+ sdl? ( x11-libs/libXinerama )
+ pulseaudio? ( media-libs/libpulse )
+ udev? ( >=virtual/udev-171 )
+"
+RDEPEND="
+ ${COMMON_DEPEND}
+ gui? ( x11-libs/libxcb:= )
+ java? ( virtual/jre:1.8 )
+"
+BDEPEND="
+ ${PYTHON_DEPS}
+ >=app-arch/tar-1.34-r2
+ >=dev-lang/yasm-0.6.2
+ dev-libs/libIDL
+ dev-util/glslang
+ >=dev-build/kbuild-0.1.9998.3592
+ 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
+ dev-qt/qthelp:5
+ )
+ gui? ( dev-qt/linguist-tools:5 )
+ nls? ( dev-qt/linguist-tools:5 )
+ 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=(
+ # Downloaded patchset
+ "${WORKDIR}"/virtualbox-patches-7.0.14/patches
+)
+
+pkg_pretend() {
+ if ! use gui; then
+ einfo "No USE=\"gui\" selected, this build will not include any 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
+ if ! use nls && use gui; then
+ einfo "USE=\"gui\" also selects USE=\"nls\". This build"
+ einfo "will have NLS support."
+ 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
+
+ # 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
+
+ # bug #916002, #488176
+ tc-ld-force-bfd
+
+ # 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
+ echo -e "\nIPRT_WITHOUT_PAM=1" >> LocalConfig.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 #908814
+ filter-lto
+
+ # bug #843437
+ cat >> LocalConfig.kmk <<-EOF || die
+ CXXFLAGS=${CXXFLAGS}
+ CFLAGS=${CFLAGS}
+ EOF
+
+ if use sdl; then
+ sed -i 's/sdl-config/sdl2-config/' configure || die
+ echo -e "\nVBOX_WITH_VBOXSDL=1" >> LocalConfig.kmk || die
+ fi
+
+ #443830
+ echo -e "\nVBOX_WITH_VBOX_IMG=1" >> LocalConfig.kmk || die
+
+ if tc-is-clang; then
+ # clang assembler chokes on comments starting with /
+ sed -i -e '/^\//d' src/libs/xpcom18a4/nsprpub/pr/src/md/unix/os_Linux_x86_64.s || die
+
+ # clang does not support this extension
+ eapply "${FILESDIR}"/${PN}-7.0.8-disable-rebuild-iPxeBiosBin.patch
+ 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
+
+ # fix help path #891879
+ echo -e "\nVBOX_PATH_PACKAGE_DOCS=/usr/share/doc/${PF}" >> LocalConfig.kmk || die
+
+ # 489208
+ # Cannot patch the whole text, many translations. Use sed instead to replace the command
+ find src/VBox/Frontends/VirtualBox/nls -name \*.ts -exec sed -i \
+ 's/&apos;[^&]*\(vboxdrv setup\|vboxconfig\)&apos;/\&apos;emerge -1 virtualbox-modules\&apos;/' {} \+ || die
+ sed -i "s:'/sbin/vboxconfig':'emerge -1 virtualbox-modules':" \
+ src/VBox/Frontends/VirtualBox/src/main.cpp \
+ src/VBox/VMM/VMMR3/VM.cpp || die
+
+ # 890561
+ echo -e "\nVBOX_GTAR=gtar" >> LocalConfig.kmk || die
+
+ if ! use nls && ! use gui; then
+ cat >> LocalConfig.kmk <<-EOF || die
+ VBOX_WITH_NLS :=
+ VBOX_WITH_MAIN_NLS :=
+ VBOX_WITH_PUEL_NLS :=
+ VBOX_WITH_VBOXMANAGE_NLS :=
+ EOF
+ fi
+}
+
+src_configure() {
+ 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
+
+ $(usev !alsa --disable-alsa)
+ $(usev !dbus --disable-dbus)
+ $(usev debug --build-debug)
+ $(usev !doc --disable-docs)
+ $(usev !java --disable-java)
+ $(usev !lvm --disable-devmapper)
+ $(usev !pulseaudio --disable-pulse)
+ $(usev !python --disable-python)
+ $(usev vboxwebsrv --enable-webservice)
+ $(usev vde --enable-vde)
+ $(usev vnc --enable-vnc)
+ )
+
+ if use gui || use sdl || use opengl; then
+ myconf+=(
+ $(usev !opengl --disable-opengl)
+ $(usev !gui --disable-qt)
+ $(usev !sdl --disable-sdl)
+ )
+ else
+ myconf+=(
+ --build-headless
+ )
+ 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 vbox-img *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
+ dosym ${vbox_inst_path}/vbox-img /usr/bin/vbox-img
+
+ 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 "VBOX_APP_HOME=${vbox_inst_path}" > "${T}/90virtualbox"
+ # environment variables used during SDK binding installation
+ echo "VBOX_SDK_PATH=${vbox_inst_path}/sdk" >> "${T}/90virtualbox"
+ echo "VBOX_INSTALL_PATH=${vbox_inst_path}" >> "${T}/90virtualbox"
+ doenvd "${T}/90virtualbox"
+
+ 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 gui; 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
+
+ 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 UserManual.q{ch,hc}
+ docompress -x /usr/share/doc/${PF}
+ elif use gui; then
+ dodoc "${WORKDIR}"/${PN}-help-${PV}/UserManual.q{ch,hc}
+ docompress -x /usr/share/doc/${PF}
+ 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
+
+ # 378871
+ local installer_dir="${ED}/usr/$(get_libdir)/virtualbox/sdk/installer"
+ pushd "${installer_dir}" &> /dev/null || die
+ sed -e "s;%VBOX_INSTALL_PATH%;${vbox_inst_path};" \
+ -e "s;%VBOX_SDK_PATH%;${vbox_inst_path}/sdk;" \
+ -i vboxapi/__init__.py || die
+ # insert shebang, the files come without one
+ find vboxapi -name \*.py -exec sed -e "1 i\#! ${PYTHON}" -i {} \+ || die
+ python_domodule vboxapi
+ popd &> /dev/null || die
+ python_doscript vboxshell.py
+
+ # do not install the installer
+ rm -r "${installer_dir}" || die
+ 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 gui; 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
+}
diff --git a/app-emulation/virtualbox/virtualbox-7.0.18.ebuild b/app-emulation/virtualbox/virtualbox-7.0.18.ebuild
new file mode 100644
index 000000000000..bf56c96cb843
--- /dev/null
+++ b/app-emulation/virtualbox/virtualbox-7.0.18.ebuild
@@ -0,0 +1,741 @@
+# Copyright 2022-2024 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_{10..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-7.0.16.tar.bz2
+ gui? ( !doc? ( https://dev.gentoo.org/~ceamac/${CATEGORY}/${PN}/${PN}-help-${PV}.tar.xz ) )
+"
+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 +gui java lvm nls pam pch pulseaudio +opengl python +sdk +sdl +udev vboxwebsrv vde vnc"
+
+unset WATCOM #856769
+
+COMMON_DEPEND="
+ ${PYTHON_DEPS}
+ acct-group/vboxusers
+ ~app-emulation/virtualbox-modules-${PV}
+ dev-libs/libtpms
+ 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 )
+ gui? (
+ 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
+ x11-libs/libX11
+ x11-libs/libXt
+ opengl? ( dev-qt/qtopengl:5 )
+ )
+ lvm? ( sys-fs/lvm2 )
+ opengl? (
+ media-libs/libglvnd[X]
+ media-libs/vulkan-loader
+ x11-libs/libX11
+ x11-libs/libXt
+ )
+ pam? ( sys-libs/pam )
+ sdl? (
+ media-libs/libsdl2[X,video]
+ x11-libs/libX11
+ x11-libs/libXcursor
+ x11-libs/libXt
+ )
+ vboxwebsrv? ( net-libs/gsoap[-gnutls(-),debug?] )
+ vde? ( net-misc/vde )
+ 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 )
+ gui? (
+ x11-base/xorg-proto
+ x11-libs/libxcb:=
+ x11-libs/libXcursor
+ x11-libs/libXext
+ x11-libs/libXinerama
+ x11-libs/libXmu
+ x11-libs/libXrandr
+ )
+ java? ( virtual/jdk:1.8 )
+ opengl? (
+ x11-base/xorg-proto
+ x11-libs/libXcursor
+ x11-libs/libXinerama
+ x11-libs/libXmu
+ x11-libs/libXrandr
+ virtual/glu
+ )
+ sdl? ( x11-libs/libXinerama )
+ pulseaudio? ( media-libs/libpulse )
+ udev? ( >=virtual/udev-171 )
+"
+RDEPEND="
+ ${COMMON_DEPEND}
+ gui? ( x11-libs/libxcb:= )
+ java? ( virtual/jre:1.8 )
+"
+BDEPEND="
+ ${PYTHON_DEPS}
+ >=app-arch/tar-1.34-r2
+ >=dev-lang/yasm-0.6.2
+ dev-libs/libIDL
+ dev-util/glslang
+ >=dev-build/kbuild-0.1.9998.3592
+ 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
+ dev-qt/qthelp:5
+ )
+ gui? ( dev-qt/linguist-tools:5 )
+ nls? ( dev-qt/linguist-tools:5 )
+ 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=(
+ # Downloaded patchset
+ "${WORKDIR}"/virtualbox-patches-7.0.16/patches
+)
+
+pkg_pretend() {
+ if ! use gui; then
+ einfo "No USE=\"gui\" selected, this build will not include any 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
+ if ! use nls && use gui; then
+ einfo "USE=\"gui\" also selects USE=\"nls\". This build"
+ einfo "will have NLS support."
+ 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
+
+ # 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
+
+ # bug #916002, #488176
+ tc-ld-force-bfd
+
+ # 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
+ echo -e "\nIPRT_WITHOUT_PAM=1" >> LocalConfig.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 #908814
+ filter-lto
+
+ # bug #843437
+ cat >> LocalConfig.kmk <<-EOF || die
+ CXXFLAGS=${CXXFLAGS}
+ CFLAGS=${CFLAGS}
+ EOF
+
+ if use sdl; then
+ sed -i 's/sdl-config/sdl2-config/' configure || die
+ echo -e "\nVBOX_WITH_VBOXSDL=1" >> LocalConfig.kmk || die
+ fi
+
+ #443830
+ echo -e "\nVBOX_WITH_VBOX_IMG=1" >> LocalConfig.kmk || die
+
+ if tc-is-clang; then
+ # clang assembler chokes on comments starting with /
+ sed -i -e '/^\//d' src/libs/xpcom18a4/nsprpub/pr/src/md/unix/os_Linux_x86_64.s || die
+
+ # clang does not support this extension
+ eapply "${FILESDIR}"/${PN}-7.0.8-disable-rebuild-iPxeBiosBin.patch
+ 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
+
+ # fix help path #891879
+ echo -e "\nVBOX_PATH_PACKAGE_DOCS=/usr/share/doc/${PF}" >> LocalConfig.kmk || die
+
+ # 489208
+ # Cannot patch the whole text, many translations. Use sed instead to replace the command
+ find src/VBox/Frontends/VirtualBox/nls -name \*.ts -exec sed -i \
+ 's/&apos;[^&]*\(vboxdrv setup\|vboxconfig\)&apos;/\&apos;emerge -1 virtualbox-modules\&apos;/' {} \+ || die
+ sed -i "s:'/sbin/vboxconfig':'emerge -1 virtualbox-modules':" \
+ src/VBox/Frontends/VirtualBox/src/main.cpp \
+ src/VBox/VMM/VMMR3/VM.cpp || die
+
+ # 890561
+ echo -e "\nVBOX_GTAR=gtar" >> LocalConfig.kmk || die
+
+ if ! use nls && ! use gui; then
+ cat >> LocalConfig.kmk <<-EOF || die
+ VBOX_WITH_NLS :=
+ VBOX_WITH_MAIN_NLS :=
+ VBOX_WITH_PUEL_NLS :=
+ VBOX_WITH_VBOXMANAGE_NLS :=
+ EOF
+ fi
+}
+
+src_configure() {
+ 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
+
+ $(usev !alsa --disable-alsa)
+ $(usev !dbus --disable-dbus)
+ $(usev debug --build-debug)
+ $(usev !doc --disable-docs)
+ $(usev !java --disable-java)
+ $(usev !lvm --disable-devmapper)
+ $(usev !pulseaudio --disable-pulse)
+ $(usev !python --disable-python)
+ $(usev vboxwebsrv --enable-webservice)
+ $(usev vde --enable-vde)
+ $(usev vnc --enable-vnc)
+ )
+
+ if use gui || use sdl || use opengl; then
+ myconf+=(
+ $(usev !opengl --disable-opengl)
+ $(usev !gui --disable-qt)
+ $(usev !sdl --disable-sdl)
+ )
+ else
+ myconf+=(
+ --build-headless
+ )
+ 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 vbox-img *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
+ dosym ${vbox_inst_path}/vbox-img /usr/bin/vbox-img
+
+ 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 "VBOX_APP_HOME=${vbox_inst_path}" > "${T}/90virtualbox"
+ # environment variables used during SDK binding installation
+ echo "VBOX_SDK_PATH=${vbox_inst_path}/sdk" >> "${T}/90virtualbox"
+ echo "VBOX_INSTALL_PATH=${vbox_inst_path}" >> "${T}/90virtualbox"
+ doenvd "${T}/90virtualbox"
+
+ 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 gui; 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
+
+ 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 UserManual.q{ch,hc}
+ docompress -x /usr/share/doc/${PF}
+ elif use gui; then
+ dodoc "${WORKDIR}"/${PN}-help-${PV}/UserManual.q{ch,hc}
+ docompress -x /usr/share/doc/${PF}
+ 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
+
+ # 378871
+ local installer_dir="${ED}/usr/$(get_libdir)/virtualbox/sdk/installer"
+ pushd "${installer_dir}" &> /dev/null || die
+ sed -e "s;%VBOX_INSTALL_PATH%;${vbox_inst_path};" \
+ -e "s;%VBOX_SDK_PATH%;${vbox_inst_path}/sdk;" \
+ -i vboxapi/__init__.py || die
+ # insert shebang, the files come without one
+ find vboxapi -name \*.py -exec sed -e "1 i\#! ${PYTHON}" -i {} \+ || die
+ python_domodule vboxapi
+ popd &> /dev/null || die
+ sed -e "1 i\#! ${PYTHON}" -i vboxshell.py || die
+ python_doscript vboxshell.py
+
+ # do not install the installer
+ rm -r "${installer_dir}" || die
+ 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 gui; 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
+}
diff --git a/app-emulation/virtualbox/virtualbox-9999.ebuild b/app-emulation/virtualbox/virtualbox-9999.ebuild
new file mode 100644
index 000000000000..7c503c7ea1c8
--- /dev/null
+++ b/app-emulation/virtualbox/virtualbox-9999.ebuild
@@ -0,0 +1,769 @@
+# Copyright 2022-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Important!
+# This compiles the latest svn version.
+# It also compiles the kernel modules. Does not depend on virtualbox-modules.
+# It is not meant to be used, might be very unstable.
+# Upstream seem to have added support for python 3.12, but it crashes.
+#
+# USE=doc does not work for now.
+#
+#
+# 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_{10..11} )
+
+inherit desktop edo flag-o-matic java-pkg-opt-2 linux-mod-r1 multilib optfeature pax-utils \
+ python-single-r1 subversion tmpfiles toolchain-funcs udev xdg
+
+MY_PN="VirtualBox"
+BASE_PV=7.0.16
+MY_P=${MY_PN}-${PV}
+
+DESCRIPTION="Family of powerful x86 virtualization products for enterprise and home use"
+HOMEPAGE="https://www.virtualbox.org/"
+ESVN_REPO_URI="https://www.virtualbox.org/svn/vbox/trunk"
+SRC_URI="
+ https://gitweb.gentoo.org/proj/virtualbox-patches.git/snapshot/virtualbox-patches-7.1.0_pre20240419.tar.bz2
+ gui? ( !doc? ( https://dev.gentoo.org/~ceamac/${CATEGORY}/${PN}/${PN}-help-${BASE_PV}.tar.xz ) )
+"
+S="${WORKDIR}/trunk"
+
+LICENSE="GPL-2+ GPL-3 LGPL-2.1 MIT dtrace? ( CDDL )"
+SLOT="0/$(ver_cut 1-2)"
+IUSE="alsa dbus debug doc dtrace +gui java lvm nls pam pch pulseaudio +opengl python +sdk +sdl +udev vboxwebsrv vde vnc"
+
+unset WATCOM #856769
+
+COMMON_DEPEND="
+ ${PYTHON_DEPS}
+ acct-group/vboxusers
+ app-arch/xz-utils
+ dev-libs/libtpms
+ 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 )
+ gui? (
+ dev-qt/qtbase:6[widgets]
+ dev-qt/qtscxml:6
+ dev-qt/qttools:6[assistant]
+ x11-libs/libX11
+ x11-libs/libXt
+ )
+ lvm? ( sys-fs/lvm2 )
+ opengl? (
+ media-libs/libglvnd[X]
+ media-libs/vulkan-loader
+ x11-libs/libX11
+ x11-libs/libXt
+ )
+ pam? ( sys-libs/pam )
+ sdl? (
+ media-libs/libsdl2[X,video]
+ x11-libs/libX11
+ x11-libs/libXt
+ )
+ vboxwebsrv? ( net-libs/gsoap[-gnutls(-),debug?] )
+ vde? ( net-misc/vde )
+ 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:=
+ x11-libs/libXt
+ alsa? ( >=media-libs/alsa-lib-1.0.13 )
+ gui? (
+ x11-base/xorg-proto
+ x11-libs/libxcb:=
+ x11-libs/libXcursor
+ x11-libs/libXext
+ x11-libs/libXinerama
+ x11-libs/libXmu
+ x11-libs/libXrandr
+ )
+ java? ( virtual/jdk:1.8 )
+ opengl? (
+ x11-base/xorg-proto
+ x11-libs/libXcursor
+ x11-libs/libXinerama
+ x11-libs/libXmu
+ x11-libs/libXrandr
+ virtual/glu
+ )
+ sdl? (
+ x11-libs/libXcursor
+ x11-libs/libXinerama
+ )
+ pulseaudio? ( media-libs/libpulse )
+ udev? ( >=virtual/udev-171 )
+"
+RDEPEND="
+ ${COMMON_DEPEND}
+ !app-emulation/virtualbox-modules
+ gui? ( x11-libs/libxcb:= )
+ java? ( virtual/jre:1.8 )
+"
+BDEPEND="
+ ${PYTHON_DEPS}
+ >=app-arch/tar-1.34-r2
+ >=dev-lang/yasm-0.6.2
+ dev-libs/libIDL
+ dev-util/glslang
+ >=dev-build/kbuild-0.1.9998.3592
+ 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
+ dev-qt/qthelp:5
+ )
+ gui? ( dev-qt/qttools:6[linguist] )
+ nls? ( dev-qt/qttools:6[linguist] )
+ 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=(
+ # Downloaded patchset
+ "${WORKDIR}"/virtualbox-patches-7.1.0_pre20240419/patches
+)
+
+DOCS=() # Don't install the default README file during einstalldocs
+
+CONFIG_CHECK="~!SPINLOCK JUMP_LABEL"
+
+pkg_pretend() {
+ if ! use gui; then
+ einfo "No USE=\"gui\" selected, this build will not include any 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
+ if ! use nls && use gui; then
+ einfo "USE=\"gui\" also selects USE=\"nls\". This build"
+ einfo "will have NLS support."
+ 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
+ linux-mod-r1_pkg_setup
+}
+
+src_unpack() {
+ subversion_src_unpack
+ default
+}
+
+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
+
+ # 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
+ echo -e "\nIPRT_WITHOUT_PAM=1" >> LocalConfig.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 #908814
+ filter-lto
+
+ # bug #843437
+ cat >> LocalConfig.kmk <<-EOF || die
+ CXXFLAGS=${CXXFLAGS}
+ CFLAGS=${CFLAGS}
+ EOF
+
+ if use sdl; then
+ sed -i 's/sdl-config/sdl2-config/' configure || die
+ echo -e "\nVBOX_WITH_VBOXSDL=1" >> LocalConfig.kmk || die
+ fi
+
+ #443830
+ echo -e "\nVBOX_WITH_VBOX_IMG=1" >> LocalConfig.kmk || die
+
+ if tc-is-clang; then
+ # clang assembler chokes on comments starting with /
+ sed -i -e '/^\//d' src/libs/xpcom18a4/nsprpub/pr/src/md/unix/os_Linux_x86_64.s || die
+
+ # clang does not support this extension
+ eapply "${FILESDIR}"/${PN}-7.0.8-disable-rebuild-iPxeBiosBin.patch
+ 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
+
+ # fix help path #891879
+ echo -e "\nVBOX_PATH_PACKAGE_DOCS=/usr/share/doc/${PF}" >> LocalConfig.kmk || die
+
+ # 489208
+ # Cannot patch the whole text, many translations. Use sed instead to replace the command
+ find src/VBox/Frontends/VirtualBox/nls -name \*.ts -exec sed -i \
+ 's/&apos;[^&]*\(vboxdrv setup\|vboxconfig\)&apos;/\&apos;emerge -1 virtualbox-modules\&apos;/' {} \+ || die
+ sed -i "s:'/sbin/vboxconfig':'emerge -1 virtualbox-modules':" \
+ src/VBox/Frontends/VirtualBox/src/main.cpp \
+ src/VBox/VMM/VMMR3/VM.cpp || die
+
+ # 890561
+ echo -e "\nVBOX_GTAR=gtar" >> LocalConfig.kmk || die
+
+ if ! use nls && ! use gui; then
+ cat >> LocalConfig.kmk <<-EOF || die
+ VBOX_WITH_NLS :=
+ VBOX_WITH_MAIN_NLS :=
+ VBOX_WITH_PUEL_NLS :=
+ VBOX_WITH_VBOXMANAGE_NLS :=
+ EOF
+ fi
+}
+
+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
+
+ $(usev !alsa --disable-alsa)
+ $(usev !dbus --disable-dbus)
+ $(usev debug --build-debug)
+ $(usev !doc --disable-docs)
+ $(usev !java --disable-java)
+ $(usev !lvm --disable-devmapper)
+ $(usev !pulseaudio --disable-pulse)
+ $(usev !python --disable-python)
+ $(usev vboxwebsrv --enable-webservice)
+ $(usev vde --enable-vde)
+ $(usev vnc --enable-vnc)
+ )
+
+ if use gui || use sdl || use opengl; then
+ myconf+=(
+ $(usev !opengl --disable-opengl)
+ $(usev !gui --disable-qt)
+ $(usev !sdl --disable-sdl)
+ )
+ else
+ myconf+=(
+ --build-headless
+ )
+ 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
+
+ local modlist=( {vboxdrv,vboxnetflt,vboxnetadp}=misc:"out/linux.${ARCH}/release/bin/src" )
+ local modargs=( KERN_DIR="${KV_OUT_DIR}" KERN_VER="${KV_FULL}" )
+ linux-mod-r1_src_compile
+}
+
+src_install() {
+ linux-mod-r1_src_install
+ insinto /usr/lib/modules-load.d/
+ newins - virtualbox.conf <<-EOF
+ vboxdrv
+ vboxnetflt
+ vboxnetadp
+ EOF
+
+ 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} \
+ vboximg-mount vbox-img *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
+ dosym ${vbox_inst_path}/vbox-img /usr/bin/vbox-img
+
+ 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 "VBOX_APP_HOME=${vbox_inst_path}" > "${T}/90virtualbox"
+ # environment variables used during SDK binding installation
+ echo "VBOX_SDK_PATH=${vbox_inst_path}/sdk" >> "${T}/90virtualbox"
+ echo "VBOX_INSTALL_PATH=${vbox_inst_path}" >> "${T}/90virtualbox"
+ doenvd "${T}/90virtualbox"
+
+ 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 gui; then
+ vbox_inst VirtualBox
+ vbox_inst VirtualBoxVM 4750
+ for each in VirtualBox{,VM} ; do
+ pax-mark -m "${ED}"${vbox_inst_path}/${each}
+ done
+
+ 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
+
+ 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 UserManual.q{ch,hc}
+ docompress -x /usr/share/doc/${PF}
+ elif use gui; then
+ dodoc "${WORKDIR}"/${PN}-help-${BASE_PV}/UserManual.q{ch,hc}
+ docompress -x /usr/share/doc/${PF}
+ 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
+
+ # 378871
+ local installer_dir="${ED}/usr/$(get_libdir)/virtualbox/sdk/installer/python/vboxapi/src"
+ pushd "${installer_dir}" &> /dev/null || die
+ sed -e "s;%VBOX_INSTALL_PATH%;${vbox_inst_path};" \
+ -e "s;%VBOX_SDK_PATH%;${vbox_inst_path}/sdk;" \
+ -i vboxapi/__init__.py || die
+ # insert shebang, the files come without one
+ find vboxapi -name \*.py -exec sed -e "1 i\#! ${PYTHON}" -i {} \+ || die
+ python_domodule vboxapi
+ popd &> /dev/null || die
+
+ # upstream added a /bin/sh stub here
+ # use /usr/bin/python3, python_doscript will take care of it
+ sed -e '1 i #! /usr/bin/python3' -i vboxshell.py
+ python_doscript vboxshell.py
+
+ # do not install the installer
+ rm -r "${installer_dir%vboxapi*}" || die
+ fi
+
+ newtmpfiles "${FILESDIR}"/${PN}-vboxusb_tmpfilesd ${PN}-vboxusb.conf
+}
+
+pkg_postinst() {
+ linux-mod-r1_pkg_postinst
+
+ xdg_pkg_postinst
+
+ if use udev; then
+ udev_reload
+ udevadm trigger --subsystem-match=usb
+ fi
+
+ tmpfiles_process virtualbox-vboxusb.conf
+
+ if use gui; 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/${BASE_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
+}