Diff virtualbox-7.0.22 with a virtualbox-9999

/usr/portage/app-emulation/virtualbox/virtualbox-9999.ebuild 2025-02-03 17:39:32.302665042 +0300
3 3

  
4 4
EAPI=8
5 5

  
6
# Important!
7
# This compiles the latest svn version.
8
# It also compiles the kernel modules.  Does not depend on virtualbox-modules.
9
# It is not meant to be used, might be very unstable.
10
# Upstream seem to have added support for python 3.12, but it crashes.
11
#
12
#
13
#
6 14
# To add a new Python here:
7 15
# 1. Patch src/libs/xpcom18a4/python/Makefile.kmk (copy the previous impl's logic)
8 16
#    Do NOT skip this part. It'll end up silently not-building the Python extension
......
17 25
#  See bug #785835, bug #856121.
18 26
PYTHON_COMPAT=( python3_{10..11} )
19 27

  
20
inherit desktop edo flag-o-matic java-pkg-opt-2 linux-info multilib optfeature pax-utils \
21
	python-single-r1 tmpfiles toolchain-funcs udev xdg
28
inherit desktop edo flag-o-matic java-pkg-opt-2 linux-mod-r1 multilib optfeature pax-utils \
29
	python-single-r1 subversion tmpfiles toolchain-funcs udev xdg
22 30

  
23 31
MY_PN="VirtualBox"
32
BASE_PV=7.1.0
24 33
MY_P=${MY_PN}-${PV}
25 34

  
26 35
DESCRIPTION="Family of powerful x86 virtualization products for enterprise and home use"
27 36
HOMEPAGE="https://www.virtualbox.org/"
37
ESVN_REPO_URI="https://www.virtualbox.org/svn/vbox/trunk"
28 38
SRC_URI="
29
	https://download.virtualbox.org/virtualbox/${PV}/${MY_P}.tar.bz2
30
	https://gitweb.gentoo.org/proj/virtualbox-patches.git/snapshot/virtualbox-patches-7.0.22-r1.tar.bz2
31
	gui? ( !doc? ( https://dev.gentoo.org/~ceamac/${CATEGORY}/${PN}/${PN}-help-${PV}.tar.xz ) )
39
	https://gitweb.gentoo.org/proj/virtualbox-patches.git/snapshot/virtualbox-patches-7.2.0_pre20250106.tar.bz2
40
	gui? ( !doc? ( https://dev.gentoo.org/~ceamac/${CATEGORY}/${PN}/${PN}-help-${BASE_PV}.tar.xz ) )
32 41
"
33
S="${WORKDIR}/${MY_PN}-${PV}"
42
S="${WORKDIR}/trunk"
34 43

  
35 44
LICENSE="GPL-2+ GPL-3 LGPL-2.1 MIT dtrace? ( CDDL )"
36 45
SLOT="0/$(ver_cut 1-2)"
37
KEYWORDS="amd64"
38
IUSE="alsa dbus debug doc dtrace +gui java lvm nls pam pch pulseaudio +opengl python +sdk +sdl test +udev vboxwebsrv vde +vmmraw vnc"
39
RESTRICT="!test? ( test )"
46
IUSE="alsa dbus debug doc dtrace +gui java lvm nls pam pch pulseaudio +opengl python +sdk +sdl +udev vboxwebsrv vde +vmmraw vnc"
40 47

  
41 48
unset WATCOM #856769
42 49

  
43 50
COMMON_DEPEND="
44 51
	acct-group/vboxusers
45
	~app-emulation/virtualbox-modules-${PV}
52
	app-arch/xz-utils
46 53
	dev-libs/libtpms
47 54
	dev-libs/libxml2
48 55
	dev-libs/openssl:0=
......
52 59
	sys-libs/zlib
53 60
	dbus? ( sys-apps/dbus )
54 61
	gui? (
55
		dev-qt/qtcore:5
56
		dev-qt/qtdbus:5
57
		dev-qt/qtgui:5
58
		dev-qt/qthelp:5
59
		dev-qt/qtprintsupport:5
60
		dev-qt/qtwidgets:5
61
		dev-qt/qtx11extras:5
62
		dev-qt/qtxml:5
62
		dev-qt/qtbase:6[widgets]
63
		dev-qt/qtscxml:6
64
		dev-qt/qttools:6[assistant]
63 65
		x11-libs/libX11
64 66
		x11-libs/libXt
65
		opengl? ( dev-qt/qtopengl:5 )
66 67
	)
67 68
	lvm? ( sys-fs/lvm2 )
68 69
	opengl? (
......
76 77
	sdl? (
77 78
		media-libs/libsdl2[X,video]
78 79
		x11-libs/libX11
79
		x11-libs/libXcursor
80 80
		x11-libs/libXt
81 81
	)
82 82
	vboxwebsrv? ( net-libs/gsoap[-gnutls(-),debug?] )
......
97 97
	${COMMON_DEPEND}
98 98
	>=dev-libs/libxslt-1.1.19
99 99
	virtual/libcrypt:=
100
	x11-libs/libXt
100 101
	alsa? ( >=media-libs/alsa-lib-1.0.13 )
101 102
	gui? (
102 103
		x11-base/xorg-proto
......
116 117
		x11-libs/libXrandr
117 118
		virtual/glu
118 119
	)
119
	sdl? ( x11-libs/libXinerama )
120
	sdl? (
121
		x11-libs/libXcursor
122
		x11-libs/libXinerama
123
	)
120 124
	pulseaudio? ( media-libs/libpulse )
121 125
	udev? ( >=virtual/udev-171 )
122 126
"
123 127
RDEPEND="
124 128
	${COMMON_DEPEND}
129
	!app-emulation/virtualbox-modules
125 130
	gui? ( x11-libs/libxcb:= )
126 131
	java? ( virtual/jre:1.8 )
127 132
"
......
130 135
	>=dev-lang/yasm-0.6.2
131 136
	dev-libs/libIDL
132 137
	dev-util/glslang
133
	>=dev-build/kbuild-0.1.9998.3592
138
	>=dev-build/kbuild-0.1.9998.3660
134 139
	sys-apps/which
135 140
	sys-devel/bin86
136 141
	sys-libs/libcap
137 142
	sys-power/iasl
138 143
	virtual/pkgconfig
139 144
	doc? (
145
		app-doc/dita-ot-bin
140 146
		app-text/docbook-sgml-dtd:4.4
141 147
		app-text/docbook-xsl-ns-stylesheets
142 148
		dev-texlive/texlive-basic
......
145 151
		dev-texlive/texlive-latexextra
146 152
		dev-texlive/texlive-fontsrecommended
147 153
		dev-texlive/texlive-fontsextra
148
		dev-qt/qthelp:5
154
		dev-qt/qttools:6[assistant]
155
		sys-libs/nss_wrapper
149 156
	)
150
	gui? ( dev-qt/linguist-tools:5 )
151
	nls? ( dev-qt/linguist-tools:5 )
157
	gui? ( dev-qt/qttools:6[linguist] )
158
	nls? ( dev-qt/qttools:6[linguist] )
152 159
	java? ( virtual/jdk:1.8 )
153
	python? (
154
		${PYTHON_DEPS}
155
		test? (
156
			$(python_gen_cond_dep '
157
				dev-python/pytest[${PYTHON_USEDEP}]
158
			')
159
		)
160
	)
160
	python? ( ${PYTHON_DEPS} )
161 161
"
162 162

  
163 163
QA_FLAGS_IGNORED="
......
198 198

  
199 199
PATCHES=(
200 200
	# Downloaded patchset
201
	"${WORKDIR}"/virtualbox-patches-7.0.22-r1/patches
201
	"${WORKDIR}"/virtualbox-patches-7.2.0_pre20250106/patches
202 202
)
203 203

  
204
DOCS=()	# Don't install the default README file during einstalldocs
205

  
206
CONFIG_CHECK="~!SPINLOCK JUMP_LABEL"
207

  
204 208
pkg_pretend() {
205 209
	if ! use gui; then
206 210
		einfo "No USE=\"gui\" selected, this build will not include any Qt frontend."
......
228 232
pkg_setup() {
229 233
	java-pkg-opt-2_pkg_setup
230 234
	use python && python-single-r1_pkg_setup
235
	linux-mod-r1_pkg_setup
231 236
}
232 237

  
233
src_prepare() {
238
src_unpack() {
239
	subversion_src_unpack
234 240
	default
241
}
235 242

  
236
	if use python; then
237
		mkdir test
238
		cp "${FILESDIR}"/test_python.py test/
239
		python_fix_shebang test/test_python.py
240
	fi
243
src_prepare() {
244
	default
241 245

  
242 246
	# Only add nopie patch when we're on hardened
243 247
	if gcc-specs-pie; then
......
286 290
		java-pkg-opt-2_src_prepare
287 291
	fi
288 292

  
289
	#856811 #864274
290
	# cannot filter out only one flag, some combinations of these flags produce buggy executables
291
	for i in abm avx avx2 bmi bmi2 fma fma4 popcnt; do
292
		append-cflags $(test-flags-CC -mno-$i)
293
		append-cxxflags $(test-flags-CXX -mno-$i)
294
	done
295

  
296
	# bug #940482
297
	filter-flags -fno-plt
298

  
299 293
	# bug #908814
300 294
	filter-lto
301 295

  
......
314 308
	echo -e "\nVBOX_WITH_VBOX_IMG=1" >> LocalConfig.kmk || die
315 309

  
316 310
	if tc-is-clang; then
317
		# clang assembler chokes on comments starting with /
318
		sed -i -e '/^\//d' src/libs/xpcom18a4/nsprpub/pr/src/md/unix/os_Linux_x86_64.s || die
319

  
320 311
		# clang does not support this extension
321
		eapply "${FILESDIR}"/${PN}-7.0.8-disable-rebuild-iPxeBiosBin.patch
312
		eapply "${FILESDIR}"/${PN}-7.1.0-disable-rebuild-iPxeBiosBin.patch
322 313
	fi
323 314

  
324 315
	# fix doc generation
......
496 487
		)
497 488
	fi
498 489

  
490
	if use doc; then
491
		# dita needs to write to ~/.fop and ~/.java
492
		# but it ignores ${HOME} and tries to write to the real home of user portage
493
		# resulting in a sandbox violation
494
		# -Duser.home= does not work
495
		# force using the temporary homedir with nss_wrapper
496
		echo "${LOGNAME}::$(id -u):$(id -g):${USER}:${HOME}:/bin/bash" >> ~/passwd
497
		echo "${LOGNAME}::$(id -g):" >> ~/group
498

  
499
		local -x LD_PRELOAD=libnss_wrapper.so
500
		local -x NSS_WRAPPER_PASSWD="${HOME}"/passwd
501
		local -x NSS_WRAPPER_GROUP="${HOME}"/group
502
	fi
503

  
499 504
	MAKE="kmk" emake "${myemakeargs[@]}" all
500
}
501 505

  
502
src_test() {
503
	if use python; then
504
		local -x VBOX_PROGRAM_PATH="${S}"/out/linux.${ARCH}/$(usex debug debug release)/bin
505
		local -x VBOX_SDK_PATH="${VBOX_PROGRAM_PATH}"/sdk
506
		local -x PYTHONPATH="${VBOX_SDK_PATH}"/installer
507
		LD_LIBRARY_PATH="${VBOX_PROGRAM_PATH}" epytest test/
508
	fi
506
	local modlist=( {vboxdrv,vboxnetflt,vboxnetadp}=misc:"out/linux.${ARCH}/release/bin/src" )
507
	local modargs=( KERN_DIR="${KV_OUT_DIR}" KERN_VER="${KV_FULL}" )
508
	linux-mod-r1_src_compile
509 509
}
510 510

  
511 511
src_install() {
512
	linux-mod-r1_src_install
513
	insinto /usr/lib/modules-load.d/
514
	newins - virtualbox.conf <<-EOF
515
		vboxdrv
516
		vboxnetflt
517
		vboxnetadp
518
	EOF
519

  
512 520
	cd "${S}"/out/linux.${ARCH}/$(usex debug debug release)/bin || die
513 521

  
514 522
	local vbox_inst_path="/usr/$(get_libdir)/${PN}" each size ico icofile
......
546 554
	insinto ${vbox_inst_path}
547 555
	doins -r components
548 556

  
549
	for each in VBox{Autostart,BalloonCtrl,BugReport,CpuReport,ExtPackHelperApp,Manage,SVC,VMMPreload,XPCOMIPCD} \
557
	for each in VBox{Autostart,BalloonCtrl,BugReport,CpuReport,ExtPackHelperApp,Manage,SVC,VMMPreload} \
550 558
		vboximg-mount vbox-img *so *r0; do
551 559
		vbox_inst ${each}
552 560
	done
......
557 565
	done
558 566

  
559 567
	# Install EFI Firmware files (bug #320757)
560
	for each in VBoxEFI{32,64}.fd ; do
568
	for each in VBoxEFI{-x86,-amd64}.fd ; do
561 569
		vbox_inst ${each} 0644
562 570
	done
563 571

  
......
603 611
			pax-mark -m "${ED}"${vbox_inst_path}/${each}
604 612
		done
605 613

  
606
		if use opengl; then
607
			vbox_inst VBoxTestOGL
608
			pax-mark -m "${ED}"${vbox_inst_path}/VBoxTestOGL
609
		fi
610

  
611 614
		for each in virtualbox{,vm} VirtualBox{,VM} ; do
612 615
			dosym ${vbox_inst_path}/VBox /usr/bin/${each}
613 616
		done
......
698 701
		dodoc UserManual.pdf UserManual.q{ch,hc}
699 702
		docompress -x /usr/share/doc/${PF}
700 703
	elif use gui; then
701
		dodoc "${WORKDIR}"/${PN}-help-${PV}/UserManual.q{ch,hc}
704
		dodoc "${WORKDIR}"/${PN}-help-${BASE_PV}/UserManual.q{ch,hc}
702 705
		docompress -x /usr/share/doc/${PF}
703 706
	fi
704 707

  
......
712 715
		fi
713 716

  
714 717
		# 378871
715
		local installer_dir="${ED}/usr/$(get_libdir)/virtualbox/sdk/installer"
718
		local installer_dir="${ED}/usr/$(get_libdir)/virtualbox/sdk/installer/python/vboxapi/src"
716 719
		pushd "${installer_dir}" &> /dev/null || die
717 720
		sed -e "s;%VBOX_INSTALL_PATH%;${vbox_inst_path};" \
718 721
			-e "s;%VBOX_SDK_PATH%;${vbox_inst_path}/sdk;" \
......
721 724
		find vboxapi -name \*.py -exec sed -e "1 i\#! ${PYTHON}" -i {} \+ || die
722 725
		python_domodule vboxapi
723 726
		popd &> /dev/null || die
724
		sed -e "1 i\#! ${PYTHON}" -i vboxshell.py || die
727

  
728
		# upstream added a /bin/sh stub here
729
		# use /usr/bin/python3, python_doscript will take care of it
730
		sed -e '1 i #! /usr/bin/python3' -i vboxshell.py
725 731
		python_doscript vboxshell.py
726 732

  
727 733
		# do not install the installer
728
		rm -r "${installer_dir}" || die
734
		rm -r "${installer_dir%vboxapi*}" || die
729 735
	fi
730 736

  
731 737
	newtmpfiles "${FILESDIR}"/${PN}-vboxusb_tmpfilesd ${PN}-vboxusb.conf
732 738
}
733 739

  
734 740
pkg_postinst() {
741
	linux-mod-r1_pkg_postinst
742

  
735 743
	xdg_pkg_postinst
736 744

  
737 745
	if use udev; then
......
748 756
	elog "You must be in the vboxusers group to use VirtualBox."
749 757
	elog ""
750 758
	elog "The latest user manual is available for download at:"
751
	elog "https://download.virtualbox.org/virtualbox/${PV}/UserManual.pdf"
759
	elog "https://download.virtualbox.org/virtualbox/${BASE_PV}/UserManual.pdf"
752 760
	elog ""
753 761

  
754 762
	optfeature "Advanced networking setups" net-misc/bridge-utils sys-apps/usermode-utilities
Thank you!