commit:     e4a265e2227853cdc801be5d492bcacfb0d5a0cb
Author:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 22 08:35:34 2025 +0000
Commit:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
CommitDate: Wed Oct 22 13:06:42 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e4a265e2

app-emulation/virtualbox: add 7.2.4

Signed-off-by: Viorel Munteanu <ceamac <AT> gentoo.org>

 app-emulation/virtualbox/Manifest                |   3 +
 app-emulation/virtualbox/virtualbox-7.2.4.ebuild | 775 +++++++++++++++++++++++
 2 files changed, 778 insertions(+)

diff --git a/app-emulation/virtualbox/Manifest 
b/app-emulation/virtualbox/Manifest
index b968802da268..c006cd682e76 100644
--- a/app-emulation/virtualbox/Manifest
+++ b/app-emulation/virtualbox/Manifest
@@ -1,9 +1,12 @@
 DIST VirtualBox-7.0.26.tar.bz2 174650718 BLAKE2B 
ba13a940b9566a5ac5b228bf29d49d4b9bf16a72da3212c305538711d363f1e6fddaa8717d4c46394ce488d2c1670874fece356740f421f44f6f40bd655f5551
 SHA512 
337f62438679f98b342213dbafdd3e07f7d7092a4205bfe388d64d1cc8224499621addea56b70d806c93290bb82e6150c07516e69250460a276e3b7a4484a9b6
 DIST VirtualBox-7.1.12.tar.bz2 214691769 BLAKE2B 
7d316732c504b62e19cc0611242c24f12b93faccc6d7dbcc0ab6c63f01828f29c659fa4947cc0fb5443615320edea9b904e53ce68baf4ff4f62e73f99bf5bee9
 SHA512 
0996f59463a3c89e249b3fac0531f5814287afa6a279020b49f48740143fea1b1cf466508b7cfcb6f809d0046117022a67d836b67be3173a0d6cd2aadca6086e
 DIST VirtualBox-7.2.2.tar.bz2 206992991 BLAKE2B 
ee69ea899cdf11e567d9e0fdd119d88b03027a4b0ec827244a8810e0f02f95b98f62bcc02501afad66aee03199107ebf27bbfb32d0dd01e113ee8dd2f2bf0382
 SHA512 
b07307d9e5ac4536a843a9400a55a2b6c6fc2eaf97126a9a97783609cd9f95238c65c0d9300d0098c64fa3cb438f1998d079ca5628ec9eae00c265a1b74f741b
+DIST VirtualBox-7.2.4.tar.bz2 207084201 BLAKE2B 
80bd0dc8c8667fe9525671afd92a78c1291a23861d452cde00bd76577fba5d71002bb4a5d01cc50f07b811702b739f3bdef61d76b29ed81a3ff6f3305d2e32ff
 SHA512 
49bf9d860ef2f7393c3da9fc0c267358a5a70657a3664a3075e233f4c1c0785921d9b020c2f8d52c11022c3f92923b181c14893e50264b5dbbf9898336faa174
 DIST virtualbox-help-7.1.0.tar.xz 1631644 BLAKE2B 
408748619d1e981b9d5b5e615baca75ff297e9b7e745751767361b7b9c74345a3db1980734439f3868c412fe28a6b687b417adc3cc148d2e2b8a9fa60e48463b
 SHA512 
513b8474d4fbf7cdb83624dc8d344122c524d92f9f84b32784161c8e1cac8ddc2c265447621d7cd3cf105d555a044e6abf42155f413ba89d507eba7ce3b2da89
 DIST virtualbox-help-7.1.12.tar.xz 8306480 BLAKE2B 
e19fe609dfbd2c7ab3f9374f1b28f7e461169411ff98328aed0de3353628730e1ce8255f580d99c3a425337900843560bf166151913d66ca4933718225befc99
 SHA512 
aa6ddc302cbefa26e9da19bec0da7520430ef9ae137c8a2658b201ee4712f1e8212f027ca8c78d27e8e70aa7b0c365f0445de47d61b725a2e4a840c6db41c7b2
 DIST virtualbox-help-7.2.2.tar.xz 8341440 BLAKE2B 
9d850e40ee3718db56d6fde3e3b7b5aea9b3a2b066bee3f941ee7509ad78e714a37966aa7851a774e44cd1bb28073a1cfe7e7c39ca868819c846001ab1335117
 SHA512 
e54e7d77bc922132b297356fea35c4271d225839c31e3dc760e18dacceef598167e9ad62cd7c50dd3ebf3b0fe1a539b274ca876a5962746870fd42a729aa6429
+DIST virtualbox-help-7.2.4.tar.xz 8341880 BLAKE2B 
a4b4654cd16050d8d2b61d44f02b9a5a0b29db0e879305107526eb3524bc00a691c545715c1f0ecd987211b97766ac71418d84040bb17862da871b690897a6c9
 SHA512 
8f55355a50cda1f5db8de04ffdc999bdbfdb6fb87d729330e53ec8aef25c7abcd822cbc300be1b897972eb3e3ed88bcb67beae87d4c46e775462130002efee8a
 DIST virtualbox-patches-7.0.22-r1.tar.bz2 6972 BLAKE2B 
e9116cb2ed874f9a0133e756b725a48ee665a412114d04195849f5930782c65678a2aaf581b9b02bc29001be4191116e322643232ee37de5cba0f2b5049b615f
 SHA512 
be72b596f63229bd28b22c026108cf5a5c951f58343a709f158446593e6f872a81734dd83a838dd91c02c80854312e2cad81f3a525035db5ffabeb96729a8276
 DIST virtualbox-patches-7.1.10.tar.bz2 5966 BLAKE2B 
cde325931ed2b41c74c9fa070980c5a6988a658608b2899473991e58ebf995f3cfd8efd295c98181d879104249ffc021643315ffe7801d30ded663a61e442488
 SHA512 
82de81a6e63bbaae8a1467fe0f4b84a6a71ee3f3d2190d53215f0b0913f6d2e53623709e5063ba629798a844c0c29fa0f48aca72efc96e775d7b18f75c1de79f
 DIST virtualbox-patches-7.2.0_p20250830.tar.bz2 6067 BLAKE2B 
fcadab8588ac52bf0fc36e8e6fb7fb37ec3b2fa160333f05686c667c48381dd22e9f76b06c91547fee872bcaa332d875ce7e3e46d04cb987671ddfa2dfb0b3fc
 SHA512 
38f447ee87f60516ab56e1db88e241efc81a1ae284f261c695d1c65abe0fe7ad58e30b98a1d490eed5cec21e59ca89b426666619297f7263c3f5e5a37c501732
+DIST virtualbox-patches-7.2.4.tar.bz2 6938 BLAKE2B 
be3ef14c2090f39eeb1fe6fe82231dbf725ff6d20603e72e4c3bbf8b15ae7698d2be86bb321bd1776a15c6385770a393cc8c6b945ea87c54f9c767c3c77b61af
 SHA512 
2e9c403dff97f5146e7632d7f6b5d0230f65f8be172efc6dd2959e72054778f617aa437f8c86d1489f9ce9212899ff08e83433a9eca3e5691353b036d426784a

diff --git a/app-emulation/virtualbox/virtualbox-7.2.4.ebuild 
b/app-emulation/virtualbox/virtualbox-7.2.4.ebuild
new file mode 100644
index 000000000000..891ea0cf780f
--- /dev/null
+++ b/app-emulation/virtualbox/virtualbox-7.2.4.ebuild
@@ -0,0 +1,775 @@
+# Copyright 2022-2025 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_{11..14} )
+
+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^^}
+HELP_PV=${PV}
+PATCHES_PV="7.2.4"
+
+DESCRIPTION="Family of powerful x86 virtualization products for enterprise and 
home use"
+HOMEPAGE="https://www.virtualbox.org/ https://github.com/VirtualBox/virtualbox";
+SRC_URI="
+       https://download.virtualbox.org/virtualbox/${PV^^}/${MY_P}.tar.bz2
+       
https://gitweb.gentoo.org/proj/virtualbox-patches.git/snapshot/virtualbox-patches-${PATCHES_PV}.tar.bz2
+       gui? ( !doc? ( 
https://dev.gentoo.org/~ceamac/${CATEGORY}/${PN}/${PN}-help-${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 test +udev vboxwebsrv vde vnc"
+RESTRICT="!test? ( test )"
+
+unset WATCOM #856769
+
+COMMON_DEPEND="
+       acct-group/vboxusers
+       app-arch/xz-utils
+       ~app-emulation/virtualbox-modules-${PV%*a}
+       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[X,wayland,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 )
+       python? ( ${PYTHON_DEPS} )
+       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}
+       gui? ( x11-libs/libxcb:= )
+       java? ( virtual/jre:1.8 )
+"
+BDEPEND="
+       >=app-arch/tar-1.34-r2
+       >=dev-lang/yasm-0.6.2
+       dev-util/glslang
+       >=dev-build/kbuild-0.1.9998.3660
+       sys-apps/which
+       sys-devel/bin86
+       sys-libs/libcap
+       sys-power/iasl
+       virtual/pkgconfig
+       doc? (
+               app-doc/dita-ot-bin
+               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/qttools:6[assistant]
+               sys-libs/nss_wrapper
+       )
+       gui? ( dev-qt/qttools:6[linguist] )
+       nls? ( dev-qt/qttools:6[linguist] )
+       java? ( virtual/jdk:1.8 )
+       python? (
+               ${PYTHON_DEPS}
+               test? (
+                       $(python_gen_cond_dep '
+                               dev-python/pytest[${PYTHON_USEDEP}]
+                       ')
+               )
+       )
+"
+
+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 ${PYTHON_REQUIRED_USE} )
+       vboxwebsrv? ( java )
+"
+
+PATCHES=(
+       # Downloaded patchset
+       "${WORKDIR}"/virtualbox-patches-${PATCHES_PV}/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 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
+       use python && python-single-r1_pkg_setup
+}
+
+src_prepare() {
+       default
+
+       if use python; then
+               mkdir test
+               cp "${FILESDIR}"/test_python.py test/
+               python_fix_shebang test/test_python.py
+       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
+
+       # 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, #925347
+       tc-ld-is-mold || 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
+
+       # bug #940482
+       filter-flags -fno-plt
+
+       # 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 does not support this extension
+               eapply 
"${FILESDIR}"/${PN}-7.1.0-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)"
+
+       # --enable-webservice is a no-op
+       # webservice is automagically enabled if gsoap is found
+       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 --with-gsoap-dir=/dev/null)
+               $(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
+               )
+               # disable shared clipboard when headless, it crashes when 
connecting with RDP: bug #955867
+               echo -e "\nVBOX_WITH_SHARED_CLIPBOARD :=" >> LocalConfig.kmk || 
die
+       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
+
+       if use python; then
+               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
+
+               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
+       else
+               cat >> AutoConfig.kmk <<-EOF || die
+                       VBOX_WITH_PYTHON:=
+               EOF
+       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
+
+       if use doc; then
+               # dita needs to write to ~/.fop and ~/.java
+               # but it ignores ${HOME} and tries to write to the real home of 
user portage
+               # resulting in a sandbox violation
+               # -Duser.home= does not work
+               # force using the temporary homedir with nss_wrapper
+               echo "${LOGNAME}::$(id -u):$(id -g):${USER}:${HOME}:/bin/bash" 
>> ~/passwd
+               echo "${LOGNAME}::$(id -g):" >> ~/group
+
+               local -x LD_PRELOAD=libnss_wrapper.so
+               local -x NSS_WRAPPER_PASSWD="${HOME}"/passwd
+               local -x NSS_WRAPPER_GROUP="${HOME}"/group
+       fi
+
+       MAKE="kmk" emake "${myemakeargs[@]}" all
+}
+
+src_test() {
+       if use python; then
+               local -x VBOX_APP_HOME="${S}"/out/linux.${ARCH}/$(usex debug 
debug release)
+               local -x VBOX_INSTALL_PATH="${VBOX_APP_HOME}"
+               local -x VBOX_PROGRAM_PATH="${VBOX_APP_HOME}"/bin
+               local -x VBOX_SDK_PATH="${VBOX_PROGRAM_PATH}"/sdk
+               local -x 
PYTHONPATH="${VBOX_SDK_PATH}"/installer/python/vboxapi/src
+               einfo "VBOX_APP_HOME ${VBOX_APP_HOME}"
+               einfo "VBOX_PROGRAM_PATH ${VBOX_PROGRAM_PATH}"
+               einfo "VBOX_SDK_PATH ${VBOX_SDK_PATH}"
+               einfo "PYTHONPATH ${PYTHONPATH}"
+               LD_LIBRARY_PATH="${VBOX_PROGRAM_PATH}" epytest test/
+       fi
+}
+
+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}
 \
+               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{-x86,-amd64}.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-${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/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() {
+       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
+}

Reply via email to