public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/virtualbox/, app-emulation/virtualbox/files/
Date: Wed,  6 Jul 2022 06:05:32 +0000 (UTC)	[thread overview]
Message-ID: <1657087517.1fc46c8f5638d711c550447a86a13286bd79fe73.sam@gentoo> (raw)

commit:     1fc46c8f5638d711c550447a86a13286bd79fe73
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jul  6 04:44:34 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jul  6 06:05:17 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1fc46c8f

app-emulation/virtualbox: force usage of selected Python; add Python 3.10

- Finish off the work from earlier (started in 0e7860b78e08743e7ba8a9d641a085e349811f83
  and then 7dde6a6bd36cadd1c70d8ec3d3f956750231eeff) for forcing the right
  Python implementation to be used for USE=python/bindings builds.

  We now hijack the script that the Makefile calls to get the list of available
  interpreters (which is separate from the weird configure thing!) and just
  create a stub which outputs the paths for the corresponding implementation
  chosen via PYTHON_SINGLE_TARGET using the normal eclass machinery.

- Add a sanity check in src_install for when USE=python for
  /usr/$(get_libdir)/virtualbox/VBoxPython*.so to minimise the risk
  of silently not building & not realising it.

  (Noticed risk of this when in the middle of this work & noticed that
  w/o the extra (see next point) Makefile targets, it ends up silently
  just not doing anything).

- Import Arch Linux / upstream (on trunk) patches for Python 3.10
  (thanks to Kerin Millar for the pointer on that bit).

  We're resigned to having to update the Makefile every time
  a new Python comes out, but it's at least only one place,
  and it's not trivial for us to change it given.. kbuild.

  (It's not just a list, but a bunch of variables which get
  defined for each target.)

Closes: https://bugs.gentoo.org/856121
Closes: https://bugs.gentoo.org/785835
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/virtualbox-6.1.34-r3-python3.10.patch    | 122 +++++
 .../virtualbox/virtualbox-6.1.34-r4.ebuild         | 585 +++++++++++++++++++++
 2 files changed, 707 insertions(+)

diff --git a/app-emulation/virtualbox/files/virtualbox-6.1.34-r3-python3.10.patch b/app-emulation/virtualbox/files/virtualbox-6.1.34-r3-python3.10.patch
new file mode 100644
index 000000000000..e06e86910103
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-6.1.34-r3-python3.10.patch
@@ -0,0 +1,122 @@
+https://github.com/archlinux/svntogit-community/blob/b103146beee8b7c70d04685033a8536aed2e5aea/trunk/002-python310.patch
+https://github.com/archlinux/svntogit-community/blob/b103146beee8b7c70d04685033a8536aed2e5aea/trunk/003-pyunicode.patch
+
+https://www.virtualbox.org/changeset/90537/vbox
+https://www.virtualbox.org/changeset/86623/vbox
+--- a/src/libs/xpcom18a4/python/src/module/_xpcom.cpp
++++ b/src/libs/xpcom18a4/python/src/module/_xpcom.cpp
+@@ -84,7 +84,11 @@
+ #  define MANGLE_MODULE_INIT(a_Name)    RT_CONCAT(a_Name, MODULE_NAME_SUFFIX)
+ # endif
+ # ifdef VBOX_PYXPCOM_VERSIONED
+-#  if   PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
++#  if   PY_VERSION_HEX >= 0x030a0000 && PY_VERSION_HEX < 0x030b0000
++#   define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython3_10")
++#   define initVBoxPython MANGLE_MODULE_INIT(PyInit_VBoxPython3_10)
++
++#  elif   PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
+ #   define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython3_9")
+ #   define initVBoxPython MANGLE_MODULE_INIT(PyInit_VBoxPython3_9)
+ 
+--- a/src/libs/xpcom18a4/python/Makefile.kmk
++++ b/src/libs/xpcom18a4/python/Makefile.kmk
+@@ -4,7 +4,7 @@
+ #
+ 
+ #
+-# Copyright (C) 2009-2017 Oracle Corporation
++# Copyright (C) 2009-2021 Oracle Corporation
+ #
+ # This file is part of VirtualBox Open Source Edition (OSE), as
+ # available from http://www.virtualbox.org. This file is free software;
+@@ -20,7 +20,7 @@
+ 
+ #
+ # List of supported Python versions, defining a number of
+-# VBOX_PYTHON[26|27|31|32|32M|33|33M|34|34M|35|35M|36|36M|37|37M|38|38M|39|39M|DEF]_[INC|LIB] variables
++# VBOX_PYTHON[26|27|31|32|32M|33|33M|34|34M|35|35M|36|36M|37|37M|38|38M|39|39M|310|310M|DEF]_[INC|LIB] variables
+ # which get picked up below.
+ #
+ ifeq ($(KBUILD_TARGET),darwin) # Relatively predictable, don't script.
+@@ -646,6 +646,52 @@
+  endif
+ endif
+ 
++ifdef VBOX_PYTHON310_INC
++#
++# Python 3.10 version
++#
++DLLS += VBoxPython3_10
++VBoxPython3_10_EXTENDS    = VBoxPythonBase
++VBoxPython3_10_EXTENDS_BY = appending
++VBoxPython3_10_TEMPLATE   = XPCOM
++VBoxPython3_10_INCS       = $(VBOX_PYTHON310_INC)
++VBoxPython3_10_LIBS       = $(VBOX_PYTHON310_LIB)
++
++ ifdef VBOX_WITH_32_ON_64_MAIN_API
++  ifdef VBOX_PYTHON310_LIB_X86
++DLLS += VBoxPython3_10_x86
++VBoxPython3_10_x86_EXTENDS    = VBoxPythonBase_x86
++VBoxPython3_10_x86_EXTENDS_BY = appending
++VBoxPython3_10_x86_TEMPLATE   = XPCOM
++VBoxPython3_10_x86_INCS       = $(VBOX_PYTHON310_INC)
++VBoxPython3_10_x86_LIBS       = $(VBOX_PYTHON310_LIB_X86)
++  endif
++ endif
++endif
++
++ifdef VBOX_PYTHON310M_INC
++#
++# Python 3.10 version with pymalloc
++#
++DLLS += VBoxPython3_10m
++VBoxPython3_10m_EXTENDS    = VBoxPythonBase_m
++VBoxPython3_10m_EXTENDS_BY = appending
++VBoxPython3_10m_TEMPLATE   = XPCOM
++VBoxPython3_10m_INCS       = $(VBOX_PYTHON310M_INC)
++VBoxPython3_10m_LIBS       = $(VBOX_PYTHON310M_LIB)
++
++ ifdef VBOX_WITH_32_ON_64_MAIN_API
++  ifdef VBOX_PYTHON310M_LIB_X86
++DLLS += VBoxPython3_10m_x86
++VBoxPython3_10m_x86_EXTENDS    = VBoxPythonBase_x86_m
++VBoxPython3_10m_x86_EXTENDS_BY = appending
++VBoxPython3_10m_x86_TEMPLATE_  = XPCOM
++VBoxPython3_10m_x86_INCS       = $(VBOX_PYTHON310M_INC)
++VBoxPython3_10m_x86_LIBS       = $(VBOX_PYTHON310M_LIB_X86)
++  endif
++ endif
++endif
++
+ ifdef VBOX_PYTHONDEF_INC
+ #
+ # Python without versioning
+@@ -730,4 +776,3 @@
+ 
+ 
+ include $(FILE_KBUILD_SUB_FOOTER)
+-
+
+--- a/src/libs/xpcom18a4/python/src/PyXPCOM.h
++++ b/src/libs/xpcom18a4/python/src/PyXPCOM.h
+@@ -137,12 +137,14 @@
+ #  define PyInt_Check(o) PyLong_Check(o)
+ #  define PyInt_AsLong(o) PyLong_AsLong(o)
+ #  define PyNumber_Int(o) PyNumber_Long(o)
+-#  ifndef PyUnicode_AsUTF8
+-#   define PyUnicode_AsUTF8(o) _PyUnicode_AsString(o)
++#  if !defined(Py_LIMITED_API) && PY_VERSION_HEX <= 0x03030000 /* 3.3 added PyUnicode_AsUTF8AndSize */
++#   ifndef PyUnicode_AsUTF8
++#    define PyUnicode_AsUTF8(o) _PyUnicode_AsString(o)
++#   endif
++#   ifndef PyUnicode_AsUTF8AndSize
++#    define PyUnicode_AsUTF8AndSize(o,s) _PyUnicode_AsStringAndSize(o,s)
++#   endif
+ #  endif
+-#  ifndef PyUnicode_AsUTF8AndSize
+-#   define PyUnicode_AsUTF8AndSize(o,s) _PyUnicode_AsStringAndSize(o,s)
+-#  endif
+ typedef struct PyMethodChain
+ {
+     PyMethodDef *methods;
+

diff --git a/app-emulation/virtualbox/virtualbox-6.1.34-r4.ebuild b/app-emulation/virtualbox/virtualbox-6.1.34-r4.ebuild
new file mode 100644
index 000000000000..a20ee04a2d51
--- /dev/null
+++ b/app-emulation/virtualbox/virtualbox-6.1.34-r4.ebuild
@@ -0,0 +1,585 @@
+# Copyright 2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# To add a new Python here:
+# 1. Patch src/libs/xpcom18a4/python/Makefile.kmk (copy the previous impl's logic)
+#    Do NOT skip this part. It'll end up silently not-building the Python extension
+#    or otherwise misbehaving if you do.
+#
+# 2. Then update PYTHON_COMPAT & set PYTHON_SINGLE_TARGET for testing w/ USE=python.
+#
+#  May need to look at other distros (e.g. Arch Linux) to find patches for newer
+#  Python versions as upstream tends to lag. Upstream may have patches on their
+#  trunk branch but not release branch.
+#
+#  See bug #785835, bug #856121.
+PYTHON_COMPAT=( python3_{8..10} )
+
+inherit desktop edo 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)"
+
+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"
+S="${WORKDIR}/${MY_PN}-${DIR_PV:-${MY_PV}}"
+
+LICENSE="GPL-2 dtrace? ( CDDL )"
+SLOT="0/$(ver_cut 1-2)"
+if [[ ${PV} != *_beta* ]] && [[ ${PV} != *_rc* ]] ; then
+	KEYWORDS="~amd64"
+fi
+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 )
+"
+# 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. See bug #832166.
+DEPEND="
+	${COMMON_DEPEND}
+	alsa? ( >=media-libs/alsa-lib-1.0.13 )
+	!headless? (
+		x11-libs/libXinerama
+		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(-)] )
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	>=dev-util/kbuild-0.1.9998.3127
+	>=dev-lang/yasm-0.6.2
+	sys-apps/which
+	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.8 )
+"
+
+QA_TEXTRELS="
+	usr/lib64/virtualbox/VMMR0.r0
+"
+
+QA_EXECSTACK="
+	usr/lib64/virtualbox/iPxeBaseBin
+	usr/lib64/virtualbox/VMMR0.r0
+	usr/lib64/virtualbox/VBoxDDR0.r0
+"
+
+QA_WX_LOAD="
+	usr/lib64/virtualbox/iPxeBaseBin
+"
+
+QA_PRESTRIPPED="
+	usr/lib64/virtualbox/VMMR0.r0
+	usr/lib64/virtualbox/VBoxDDR0.r0
+"
+
+REQUIRED_USE="
+	java? ( sdk )
+	python? ( sdk )
+	vboxwebsrv? ( java )
+	${PYTHON_REQUIRED_USE}
+"
+
+PATCHES=(
+	"${FILESDIR}"/${P}-vboxr0.patch
+
+	# Upstream patch for USE=-pam
+	# bug #843437
+	"${FILESDIR}"/${PN}-6.1.34-no-pam.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
+
+	# Patch grabbed from Arch Linux / upstream for Python 3.10 support
+	"${FILESDIR}"/${PN}-6.1.34-r3-python3.10.patch
+
+	# Downloaded patchset
+	"${WORKDIR}"/patches
+)
+
+pkg_pretend() {
+	if ! use headless && ! use qt5 ; then
+		einfo "No USE=\"qt5\" selected, this build will not include any Qt frontend."
+	elif use headless && use qt5 ; then
+		einfo "You selected USE=\"headless qt5\", defaulting to"
+		einfo "USE=\"headless\", this build will not include any X11/Qt frontend."
+	fi
+
+	if ! use opengl ; then
+		einfo "No USE=\"opengl\" selected, this build will lack"
+		einfo "the OpenGL feature."
+	fi
+	if ! use python ; then
+		einfo "You have disabled the \"python\" USE flag. This will only"
+		einfo "disable the python bindings being installed."
+	fi
+}
+
+pkg_setup() {
+	java-pkg-opt-2_pkg_setup
+	python-single-r1_pkg_setup
+}
+
+src_prepare() {
+	default
+
+	# Only add nopie patch when we're on hardened
+	if gcc-specs-pie ; then
+		eapply "${FILESDIR}"/050_virtualbox-5.2.8-nopie.patch
+	fi
+
+	# Only add paxmark patch when we're on pax-kernel
+	if use pax-kernel ; then
+		eapply "${FILESDIR}"/virtualbox-5.2.8-paxmark-bldprogs.patch
+	fi
+
+	# Remove shipped binaries (kBuild, yasm), see bug #232775
+	rm -r kBuild/bin tools || die
+
+	# 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
+
+	# 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
+}
+
+src_configure() {
+	tc-ld-disable-gold # bug #488176
+	tc-export CC CXX LD AR RANLIB
+	export HOST_CC="$(tc-getBUILD_CC)"
+
+	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
+
+	# bug #843437
+	cat >> LocalConfig.kmk <<-EOF || die
+		CFLAGS=${CFLAGS}
+		CXXFLAGS=${CXXFLAGS}
+	EOF
+
+	# 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=$(usex python 1 0)
+		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}"
+
+	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)"
+		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" -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
+
+	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
+}
+
+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 "https://download.virtualbox.org/virtualbox/${DIR_PV:-${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
+}


             reply	other threads:[~2022-07-06  6:05 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-06  6:05 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-09-15 13:02 [gentoo-commits] repo/gentoo:master commit in: app-emulation/virtualbox/, app-emulation/virtualbox/files/ Viorel Munteanu
2024-09-15 13:02 Viorel Munteanu
2024-02-10 16:31 Viorel Munteanu
2024-02-10 16:31 Viorel Munteanu
2024-01-28 10:44 Viorel Munteanu
2023-08-28 10:08 Viorel Munteanu
2023-08-15 12:50 Viorel Munteanu
2023-08-15 12:50 Viorel Munteanu
2023-07-20  9:40 Viorel Munteanu
2023-06-02 18:27 Viorel Munteanu
2023-05-15 14:35 Viorel Munteanu
2023-04-21 16:38 Viorel Munteanu
2023-02-21 15:06 Viorel Munteanu
2023-02-03 14:35 Viorel Munteanu
2022-11-20  8:20 Viorel Munteanu
2022-11-02  6:41 Viorel Munteanu
2022-09-05 12:39 Joonas Niilola
2022-08-18 18:43 Sam James
2021-04-22 16:55 Lars Wendler
2020-06-03  0:10 Andreas Sturmlechner
2020-06-02 21:52 Andreas Sturmlechner
2019-01-16 12:02 Lars Wendler
2018-12-07 21:42 Lars Wendler
2018-11-17 11:55 Lars Wendler
2018-02-19 14:16 Lars Wendler
2018-02-16 14:56 Lars Wendler
2017-07-26 19:21 Richard Farina
2017-05-11 12:07 Lars Wendler
2017-02-21 22:05 Magnus Granberg
2016-03-11 17:31 Lars Wendler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1657087517.1fc46c8f5638d711c550447a86a13286bd79fe73.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox