Gentoo Archives: gentoo-commits

From: Viorel Munteanu <ceamac@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/virtualbox/, app-emulation/virtualbox/files/
Date: Wed, 02 Nov 2022 06:41:45
Message-Id: 1667371182.9616b251f6c74d1b6d7688d5e4cca40df855da93.ceamac@gentoo
1 commit: 9616b251f6c74d1b6d7688d5e4cca40df855da93
2 Author: Viorel Munteanu <ceamac.paragon <AT> gmail <DOT> com>
3 AuthorDate: Tue Oct 11 18:37:58 2022 +0000
4 Commit: Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
5 CommitDate: Wed Nov 2 06:39:42 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9616b251
7
8 app-emulation/virtualbox: add 7.0.2
9
10 Signed-off-by: Viorel Munteanu <ceamac.paragon <AT> gmail.com>
11 Signed-off-by: Viorel Munteanu <ceamac <AT> gentoo.org>
12
13 app-emulation/virtualbox/Manifest | 1 +
14 .../virtualbox-7.0.0-fix-compilation-clang.patch | 44 ++
15 .../files/virtualbox-7.0.0-fix-compilation.patch | 56 ++
16 .../files/virtualbox-7.0.0-python3_11.patch | 90 +++
17 app-emulation/virtualbox/virtualbox-7.0.2.ebuild | 685 +++++++++++++++++++++
18 5 files changed, 876 insertions(+)
19
20 diff --git a/app-emulation/virtualbox/Manifest b/app-emulation/virtualbox/Manifest
21 index c3288f9542c0..7223bc1b6af8 100644
22 --- a/app-emulation/virtualbox/Manifest
23 +++ b/app-emulation/virtualbox/Manifest
24 @@ -1,4 +1,5 @@
25 DIST VirtualBox-6.1.36.tar.bz2 165685382 BLAKE2B 98dbb06450b9df650cb72493bcdea4b88fa9dd21f76d723fdc0bb2c1ab8266f67e972a7222dc9b5bd0d43754911710664bddace753995be025cf6bcc05a24ae5 SHA512 cc3b984a7da40c9bf14831808a2bc2bf7bf6821e53c25fa11cb4b4275feb1d4b0cb4a47d8a360b90c89e5a4038481efe8fe28ee22996dbefb6446761e88a8dec
26 DIST VirtualBox-6.1.38.tar.bz2 165761175 BLAKE2B decda6e7a595f79e6ace6f8f6b8a7829223ac1422c3d280b6287a40ef942e773ad473f4fa4640a76f8fb825ebd8561c646f1b3d87922b1af55c138298b4c8f4f SHA512 7a4f2dc80e3251b1da6d29d3c6f6b802527decc70497b1a1d1008c0ab3109c2039d131c587d6ec4786aea619546757655337c2ec3456243336ca13c6f6748116
27 DIST VirtualBox-6.1.40.tar.bz2 165769795 BLAKE2B 5c216f23422be3fc4f7760881c666c57a516d12726ed8ef040bbdf918f1af53c69d204b22949e25f751cbe788b00c810c49c27b7c51c1837fd1c503a3eff202c SHA512 0dace071fe58500d0912fe4da4751de6840752375039554a56c8c753a0880a419c4a1ed7f1b0ebc51230f7099ca3f5d987dc7b91ad4d98dbd75bf63e3c27e096
28 +DIST VirtualBox-7.0.2.tar.bz2 199461536 BLAKE2B 94f7c2961c13530b6086bf4576f243b5b260f43ec445c8a2e411205989a9db229715502f2b76b8f3cb45a49ff565410701be90f1e850f069aae5579c0796b503 SHA512 c79d6365f83e1fde356a7f4a6ccd23bc7306d1b5b4be669634c575f08ba53338caca684758c9409ecef2b05ab6f9ad37dfa6075ad6afbc5d7909d46ee6794927
29 DIST virtualbox-patches-6.1.36.tar.bz2 2733 BLAKE2B dcfebfeca4873d382441515d48b4dfee9343bc7c83ea3cbb5002dbf7975143a79fae9a701b67dc35505e9ca03ff1b6293cb7c3279c4fdfda8ad21ba5fb9b7e87 SHA512 1bed5cdefbf8e7c4b0d9092ba4961ecf2262f27f35c71a91ef6f2e8fe8a1d92ed74f06bafbf58d70ba7165d933997f58073f4d4f4051e3ba5c0339b729066f57
30
31 diff --git a/app-emulation/virtualbox/files/virtualbox-7.0.0-fix-compilation-clang.patch b/app-emulation/virtualbox/files/virtualbox-7.0.0-fix-compilation-clang.patch
32 new file mode 100644
33 index 000000000000..c3e34f875acd
34 --- /dev/null
35 +++ b/app-emulation/virtualbox/files/virtualbox-7.0.0-fix-compilation-clang.patch
36 @@ -0,0 +1,44 @@
37 +clang does not have syslimits.h, it is gcc specific
38 +and it is useless anyway since <limits.h> is already included
39 +so just remove it
40 +
41 +Cannot use PFNRT here on clang because of the exception specification
42 +
43 +--- a/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceLibCWrappers.h
44 ++++ b/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceLibCWrappers.h
45 +@@ -34,8 +34,6 @@
46 + # include <limits.h> /* Workaround for syslimit.h bug in gcc 4.8.3 on gentoo. */
47 + # ifdef RT_OS_DARWIN
48 + # include <sys/syslimits.h> /* PATH_MAX */
49 +-# elif !defined(RT_OS_SOLARIS) && !defined(RT_OS_FREEBSD)
50 +-# include <syslimits.h> /* PATH_MAX */
51 + # endif
52 + # include <libgen.h> /* basename */
53 + # include <unistd.h>
54 +--- a/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.h
55 ++++ b/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.h
56 +@@ -97,7 +97,11 @@
57 + /** Load OpenGL library and initialize function pointers. */
58 + int glLdrInit(PPDMDEVINS pDevIns);
59 + /** Resolve an OpenGL function name. */
60 ++#ifdef __clang__
61 ++void* glLdrGetProcAddress(const char *pszSymbol);
62 ++#else // !__clang__
63 + PFNRT glLdrGetProcAddress(const char *pszSymbol);
64 ++#endif // !__clang__
65 + /** Get pointers to extension function. They are available on Windows only when OpenGL context is set. */
66 + int glLdrGetExtFunctions(PPDMDEVINS pDevIns);
67 +
68 +--- a/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.cpp
69 ++++ b/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.cpp
70 +@@ -35,6 +35,10 @@
71 + #include <iprt/ldr.h>
72 + #include <iprt/log.h>
73 +
74 ++#ifdef __clang__
75 ++# define PFNRT void*
76 ++#endif
77 ++
78 + #ifdef RT_OS_WINDOWS
79 + # define OGLGETPROCADDRESS MyWinGetProcAddress
80 + DECLINLINE(PFNRT) MyWinGetProcAddress(const char *pszSymbol)
81
82 diff --git a/app-emulation/virtualbox/files/virtualbox-7.0.0-fix-compilation.patch b/app-emulation/virtualbox/files/virtualbox-7.0.0-fix-compilation.patch
83 new file mode 100644
84 index 000000000000..362e792c9cb9
85 --- /dev/null
86 +++ b/app-emulation/virtualbox/files/virtualbox-7.0.0-fix-compilation.patch
87 @@ -0,0 +1,56 @@
88 +Fix compilation if VBOX_WITH_AUDIO_OSS is defined while VBOX_WITH_AUDIO_PULSE and VBOX_WITH_AUDIO_ALSA are not
89 +
90 +Fix compilation if VBOX_WITH_AUDIO_RECORDING is not defined
91 +
92 +--- a/src/VBox/Main/xml/Settings.cpp
93 ++++ b/src/VBox/Main/xml/Settings.cpp
94 +@@ -8931,6 +8931,9 @@
95 + RTCLock lock(s_mtx);
96 + if (s_enmLinuxDriver == AudioDriverType_Null)
97 + {
98 ++# ifdef VBOX_WITH_AUDIO_OSS
99 ++ s_enmLinuxDriver = AudioDriverType_OSS;
100 ++# endif /* VBOX_WITH_AUDIO_OSS */
101 + # ifdef VBOX_WITH_AUDIO_PULSE
102 + /* Check for the pulse library & that the pulse audio daemon is running. */
103 + if (RTProcIsRunningByName("pulseaudio") &&
104 +@@ -8943,10 +8946,7 @@
105 + if (RTLdrIsLoadable("libasound.so.2"))
106 + s_enmLinuxDriver = AudioDriverType_ALSA;
107 + # endif /* VBOX_WITH_AUDIO_ALSA */
108 +-# ifdef VBOX_WITH_AUDIO_OSS
109 +- else
110 +- s_enmLinuxDriver = AudioDriverType_OSS;
111 +-# endif /* VBOX_WITH_AUDIO_OSS */
112 ++ ;
113 + }
114 + return s_enmLinuxDriver;
115 +
116 +--- a/src/VBox/Main/src-client/RecordingInternals.cpp
117 ++++ b/src/VBox/Main/src-client/RecordingInternals.cpp
118 +@@ -139,7 +139,9 @@
119 + switch (pFrame->enmType)
120 + {
121 + case RECORDINGFRAME_TYPE_AUDIO:
122 ++#ifdef VBOX_WITH_AUDIO_RECORDING
123 + recordingAudioFrameDestroy(&pFrame->Audio);
124 ++#endif // VBOX_WITH_AUDIO_RECORDING
125 + break;
126 +
127 + case RECORDINGFRAME_TYPE_VIDEO:
128 +--- a/src/VBox/Main/src-client/Recording.cpp
129 ++++ b/src/VBox/Main/src-client/Recording.cpp
130 +@@ -836,11 +836,13 @@
131 +
132 + if (m_enmState == RECORDINGSTS_STARTED)
133 + {
134 ++#ifdef VBOX_WITH_AUDIO_RECORDING
135 + if ( recordingCodecIsInitialized(&m_CodecAudio)
136 + && recordingCodecGetWritable(&m_CodecAudio, msTimestamp) > 0)
137 + {
138 + fNeedsUpdate = true;
139 + }
140 ++#endif // VBOX_WITH_AUDIO_RECORDING
141 +
142 + if (!fNeedsUpdate)
143 + {
144
145 diff --git a/app-emulation/virtualbox/files/virtualbox-7.0.0-python3_11.patch b/app-emulation/virtualbox/files/virtualbox-7.0.0-python3_11.patch
146 new file mode 100644
147 index 000000000000..cbdc1e1e2ad1
148 --- /dev/null
149 +++ b/app-emulation/virtualbox/files/virtualbox-7.0.0-python3_11.patch
150 @@ -0,0 +1,90 @@
151 +Add support for python 3.11
152 +
153 +Virtualbox 7.0.0 will only build a lib named VBoxPython3.so, regardless of the
154 +actual python version used when compiling. Remove VBoxPython3m.so, we don't
155 +use it.
156 +
157 +--- a/src/libs/xpcom18a4/python/Makefile.kmk
158 ++++ b/src/libs/xpcom18a4/python/Makefile.kmk
159 +@@ -30,7 +30,7 @@
160 +
161 + #
162 + # List of supported Python versions, defining a number of
163 +-# 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
164 ++# VBOX_PYTHON[26|27|31|32|32M|33|33M|34|34M|35|35M|36|36M|37|37M|38|38M|39|39M|310|310M|311|311M|DEF]_[INC|LIB] variables
165 + # which get picked up below.
166 + #
167 + ifeq ($(KBUILD_TARGET),darwin) # Relatively predictable, don't script.
168 +@@ -702,6 +702,52 @@
169 + endif
170 + endif
171 +
172 ++ifdef VBOX_PYTHON311_INC
173 ++#
174 ++# Python 3.11 version
175 ++#
176 ++DLLS += VBoxPython3_11
177 ++VBoxPython3_11_EXTENDS = VBoxPythonBase
178 ++VBoxPython3_11_EXTENDS_BY = appending
179 ++VBoxPython3_11_TEMPLATE = XPCOM
180 ++VBoxPython3_11_INCS = $(VBOX_PYTHON311_INC)
181 ++VBoxPython3_11_LIBS = $(VBOX_PYTHON311_LIB)
182 ++
183 ++ ifdef VBOX_WITH_32_ON_64_MAIN_API
184 ++ ifdef VBOX_PYTHON311_LIB_X86
185 ++DLLS += VBoxPython3_11_x86
186 ++VBoxPython3_11_x86_EXTENDS = VBoxPythonBase_x86
187 ++VBoxPython3_11_x86_EXTENDS_BY = appending
188 ++VBoxPython3_11_x86_TEMPLATE = XPCOM
189 ++VBoxPython3_11_x86_INCS = $(VBOX_PYTHON311_INC)
190 ++VBoxPython3_11_x86_LIBS = $(VBOX_PYTHON311_LIB_X86)
191 ++ endif
192 ++ endif
193 ++endif
194 ++
195 ++ifdef VBOX_PYTHON311M_INC
196 ++#
197 ++# Python 3.11 version with pymalloc
198 ++#
199 ++DLLS += VBoxPython3_11m
200 ++VBoxPython3_11m_EXTENDS = VBoxPythonBase_m
201 ++VBoxPython3_11m_EXTENDS_BY = appending
202 ++VBoxPython3_11m_TEMPLATE = XPCOM
203 ++VBoxPython3_11m_INCS = $(VBOX_PYTHON311M_INC)
204 ++VBoxPython3_11m_LIBS = $(VBOX_PYTHON311M_LIB)
205 ++
206 ++ ifdef VBOX_WITH_32_ON_64_MAIN_API
207 ++ ifdef VBOX_PYTHON311M_LIB_X86
208 ++DLLS += VBoxPython3_11m_x86
209 ++VBoxPython3_11m_x86_EXTENDS = VBoxPythonBase_x86_m
210 ++VBoxPython3_11m_x86_EXTENDS_BY = appending
211 ++VBoxPython3_11m_x86_TEMPLATE_ = XPCOM
212 ++VBoxPython3_11m_x86_INCS = $(VBOX_PYTHON311M_INC)
213 ++VBoxPython3_11m_x86_LIBS = $(VBOX_PYTHON311M_LIB_X86)
214 ++ endif
215 ++ endif
216 ++endif
217 ++
218 + ifdef VBOX_PYTHONDEF_INC
219 + #
220 + # Python without versioning
221 +@@ -744,18 +790,13 @@
222 + # TODO: ASSUMING that we don't need a different headers for pymalloc
223 + # ('m' builds < 3.8) and CRT malloc.
224 + #
225 +-VBOX_PYTHON_LIMITED_API_VER := $(firstword $(foreach ver, 35 36 38 39 310 34 33 \
226 ++VBOX_PYTHON_LIMITED_API_VER := $(firstword $(foreach ver, 35 36 38 39 310 311 34 33 \
227 + ,$(if-expr defined(VBOX_PYTHON$(ver)_INC),$(ver),)$(if-expr defined(VBOX_PYTHON$(ver)M_INC),$(ver)M,)))
228 + ifneq ($(VBOX_PYTHON_LIMITED_API_VER),)
229 + DLLS += VBoxPython3
230 + VBoxPython3_EXTENDS = VBoxPythonBase
231 + VBoxPython3_DEFS = $(filter-out VBOX_PYXPCOM_VERSIONED,$(VBoxPythonBase_DEFS)) Py_LIMITED_API=0x03030000
232 + VBoxPython3_INCS = $(VBoxPythonBase_INCS) $(VBOX_PYTHON$(VBOX_PYTHON_LIMITED_API_VER)_INC)
233 +-
234 +-DLLS += VBoxPython3m
235 +-VBoxPython3m_EXTENDS = VBoxPythonBase_m
236 +-VBoxPython3m_DEFS = $(filter-out VBOX_PYXPCOM_VERSIONED,$(VBoxPythonBase_m_DEFS)) Py_LIMITED_API=0x03030000
237 +-VBoxPython3m_INCS = $(VBoxPythonBase_m_INCS) $(VBOX_PYTHON$(VBOX_PYTHON_LIMITED_API_VER)_INC)
238 + endif
239 + endif # VBOX_WITH_PYTHON_LIMITED_API
240 +
241
242 diff --git a/app-emulation/virtualbox/virtualbox-7.0.2.ebuild b/app-emulation/virtualbox/virtualbox-7.0.2.ebuild
243 new file mode 100644
244 index 000000000000..4a23f2b624d2
245 --- /dev/null
246 +++ b/app-emulation/virtualbox/virtualbox-7.0.2.ebuild
247 @@ -0,0 +1,685 @@
248 +# Copyright 2022 Gentoo Authors
249 +# Distributed under the terms of the GNU General Public License v2
250 +
251 +EAPI=8
252 +
253 +# To add a new Python here:
254 +# 1. Patch src/libs/xpcom18a4/python/Makefile.kmk (copy the previous impl's logic)
255 +# Do NOT skip this part. It'll end up silently not-building the Python extension
256 +# or otherwise misbehaving if you do.
257 +#
258 +# 2. Then update PYTHON_COMPAT & set PYTHON_SINGLE_TARGET for testing w/ USE=python.
259 +#
260 +# May need to look at other distros (e.g. Arch Linux) to find patches for newer
261 +# Python versions as upstream tends to lag. Upstream may have patches on their
262 +# trunk branch but not release branch.
263 +#
264 +# See bug #785835, bug #856121.
265 +PYTHON_COMPAT=( python3_{8..11} )
266 +
267 +inherit desktop edo flag-o-matic java-pkg-opt-2 linux-info multilib optfeature pax-utils python-single-r1 tmpfiles toolchain-funcs udev xdg
268 +
269 +MY_PN="VirtualBox"
270 +MY_P=${MY_PN}-${PV}
271 +
272 +DESCRIPTION="Family of powerful x86 virtualization products for enterprise and home use"
273 +HOMEPAGE="https://www.virtualbox.org/"
274 +SRC_URI="https://download.virtualbox.org/virtualbox/${PV}/${MY_P}.tar.bz2
275 + https://gitweb.gentoo.org/proj/virtualbox-patches.git/snapshot/virtualbox-patches-6.1.36.tar.bz2"
276 +S="${WORKDIR}/${MY_PN}-${PV}"
277 +
278 +LICENSE="GPL-2+ GPL-3 LGPL-2.1 MIT dtrace? ( CDDL )"
279 +SLOT="0/$(ver_cut 1-2)"
280 +KEYWORDS="~amd64"
281 +IUSE="alsa dbus debug doc dtrace headless java lvm +opus pam pax-kernel pch pulseaudio +opengl python +qt5 +sdk +sdl +udev vboxwebsrv vnc"
282 +
283 +unset WATCOM #856769
284 +
285 +COMMON_DEPEND="
286 + ${PYTHON_DEPS}
287 + acct-group/vboxusers
288 + ~app-emulation/virtualbox-modules-${PV}
289 + dev-libs/libxml2
290 + dev-libs/openssl:0=
291 + media-libs/libpng:0=
292 + media-libs/libvpx:0=
293 + net-misc/curl
294 + sys-libs/zlib
295 + dbus? ( sys-apps/dbus )
296 + !headless? (
297 + x11-libs/libX11
298 + x11-libs/libXt
299 + opengl? (
300 + media-libs/libglvnd[X]
301 + )
302 + qt5? (
303 + dev-qt/qtcore:5
304 + dev-qt/qtdbus:5
305 + dev-qt/qtgui:5
306 + dev-qt/qthelp:5
307 + dev-qt/qtprintsupport:5
308 + dev-qt/qtwidgets:5
309 + dev-qt/qtx11extras:5
310 + dev-qt/qtxml:5
311 + opengl? ( dev-qt/qtopengl:5 )
312 + )
313 + sdl? (
314 + media-libs/libsdl:0[X,video]
315 + x11-libs/libXcursor
316 + )
317 + )
318 + lvm? ( sys-fs/lvm2 )
319 + pam? ( sys-libs/pam )
320 + vboxwebsrv? ( net-libs/gsoap[-gnutls(-)] )
321 + vnc? ( >=net-libs/libvncserver-0.9.9 )
322 +"
323 +# We're stuck on JDK (and JRE, I guess?) 1.8 because of need for wsimport
324 +# with USE="vboxwebsrv java". Note that we have to put things in DEPEND,
325 +# not (only, anyway) BDEPEND, as the eclass magic to set the environment variables
326 +# based on *DEPEND doesn't work for BDEPEND at least right now.
327 +#
328 +# There's a comment in Config.kmk about it
329 +# ("With Java 11 wsimport was removed, usually part of a separate install now.")
330 +# but it needs more investigation.
331 +#
332 +# See bug #878299 to track this issue.
333 +DEPEND="
334 + ${COMMON_DEPEND}
335 + >=dev-libs/libxslt-1.1.19
336 + virtual/libcrypt:=
337 + alsa? ( >=media-libs/alsa-lib-1.0.13 )
338 + opengl? ( virtual/glu )
339 + !headless? (
340 + x11-libs/libXcursor
341 + x11-libs/libXext
342 + x11-libs/libXinerama
343 + x11-libs/libXmu
344 + x11-libs/libxcb:=
345 + x11-libs/libXrandr
346 + opengl? ( virtual/opengl )
347 + )
348 + java? ( virtual/jdk:1.8 )
349 + opus? ( media-libs/opus )
350 + pax-kernel? ( sys-apps/elfix )
351 + pulseaudio? ( media-sound/pulseaudio )
352 + qt5? ( x11-libs/libXinerama )
353 + udev? ( >=virtual/udev-171 )
354 +"
355 +RDEPEND="
356 + ${COMMON_DEPEND}
357 + java? ( virtual/jre:1.8 )
358 + qt5? ( x11-libs/libxcb:= )
359 +"
360 +BDEPEND="
361 + ${PYTHON_DEPS}
362 + >=dev-lang/yasm-0.6.2
363 + dev-libs/libIDL
364 + dev-qt/linguist-tools:5
365 + dev-util/glslang
366 + >=dev-util/kbuild-0.1.9998.3127
367 + sys-apps/which
368 + sys-devel/bin86
369 + sys-libs/libcap
370 + sys-power/iasl
371 + virtual/pkgconfig
372 + doc? (
373 + app-text/docbook-sgml-dtd:4.4
374 + app-text/docbook-xsl-ns-stylesheets
375 + dev-texlive/texlive-basic
376 + dev-texlive/texlive-latex
377 + dev-texlive/texlive-latexrecommended
378 + dev-texlive/texlive-latexextra
379 + dev-texlive/texlive-fontsrecommended
380 + dev-texlive/texlive-fontsextra
381 + )
382 + java? ( virtual/jdk:1.8 )
383 +"
384 +
385 +QA_FLAGS_IGNORED="
386 + usr/lib64/virtualbox/VBoxDDR0.r0
387 + usr/lib64/virtualbox/VMMR0.r0
388 + usr/lib64/virtualbox/ExtensionPacks/Oracle_VBoxDTrace_Extension_Pack/linux.amd64/VBoxDTraceR0.r0
389 + usr/lib64/virtualbox/ExtensionPacks/Oracle_VBoxDTrace_Extension_Pack/linux.amd64/VBoxDTraceR0.debug
390 +"
391 +
392 +QA_TEXTRELS="
393 + usr/lib64/virtualbox/VMMR0.r0
394 + usr/lib64/virtualbox/ExtensionPacks/Oracle_VBoxDTrace_Extension_Pack/linux.amd64/VBoxDTraceR0.r0
395 +"
396 +
397 +QA_EXECSTACK="
398 + usr/lib64/virtualbox/iPxeBaseBin
399 + usr/lib64/virtualbox/VMMR0.r0
400 + usr/lib64/virtualbox/VBoxDDR0.r0
401 + usr/lib64/virtualbox/ExtensionPacks/Oracle_VBoxDTrace_Extension_Pack/linux.amd64/VBoxDTraceR0.r0
402 + usr/lib64/virtualbox/ExtensionPacks/Oracle_VBoxDTrace_Extension_Pack/linux.amd64/VBoxDTraceR0.debug
403 +"
404 +
405 +QA_WX_LOAD="
406 + usr/lib64/virtualbox/iPxeBaseBin
407 +"
408 +
409 +QA_PRESTRIPPED="
410 + usr/lib64/virtualbox/VMMR0.r0
411 + usr/lib64/virtualbox/VBoxDDR0.r0
412 + usr/lib64/virtualbox/ExtensionPacks/Oracle_VBoxDTrace_Extension_Pack/linux.amd64/VBoxDTraceR0.r0
413 +"
414 +
415 +REQUIRED_USE="
416 + java? ( sdk )
417 + python? ( sdk )
418 + vboxwebsrv? ( java )
419 + ${PYTHON_REQUIRED_USE}
420 +"
421 +
422 +PATCHES=(
423 + "${FILESDIR}"/${PN}-6.1.26-configure-include-qt5-path.patch # bug #805365
424 +
425 + # This patch is needed to avoid automagic detection based on a hardcoded
426 + # list of Pythons in configure. It's necessary but not sufficient
427 + # (see the rest of the ebuild's logic for the remainder) to handle
428 + # proper Python selection.
429 + "${FILESDIR}"/${PN}-6.1.34-r3-python.patch
430 +
431 + # 865361
432 + "${FILESDIR}"/${PN}-6.1.36-fcf-protection.patch
433 +
434 + "${FILESDIR}"/${PN}-7.0.0-fix-compilation.patch
435 + "${FILESDIR}"/${PN}-7.0.0-fix-compilation-clang.patch
436 + "${FILESDIR}"/${PN}-7.0.0-python3_11.patch
437 +
438 + # Downloaded patchset
439 + "${WORKDIR}"/virtualbox-patches-6.1.36/patches
440 +)
441 +
442 +pkg_pretend() {
443 + if ! use headless && ! use qt5; then
444 + einfo "No USE=\"qt5\" selected, this build will not include any Qt frontend."
445 + elif use headless && use qt5; then
446 + einfo "You selected USE=\"headless qt5\", defaulting to"
447 + einfo "USE=\"headless\", this build will not include any X11/Qt frontend."
448 + fi
449 +
450 + if ! use opengl; then
451 + einfo "No USE=\"opengl\" selected, this build will lack"
452 + einfo "the OpenGL feature."
453 + fi
454 + if ! use python; then
455 + einfo "You have disabled the \"python\" USE flag. This will only"
456 + einfo "disable the python bindings being installed."
457 + fi
458 +
459 + # 749273
460 + local d=${ROOT}
461 + for i in usr "$(get_libdir)"; do
462 + d="${d}/$i"
463 + if [[ "$(stat -L -c "%g %u" "${d}")" != "0 0" ]]; then
464 + die "${d} should be owned by root, VirtualBox will not start otherwise"
465 + fi
466 + done
467 +}
468 +
469 +pkg_setup() {
470 + java-pkg-opt-2_pkg_setup
471 + python-single-r1_pkg_setup
472 +}
473 +
474 +src_prepare() {
475 + default
476 +
477 + # Only add nopie patch when we're on hardened
478 + if gcc-specs-pie; then
479 + eapply "${FILESDIR}"/050_virtualbox-5.2.8-nopie.patch
480 + fi
481 +
482 + # Only add paxmark patch when we're on pax-kernel
483 + if use pax-kernel; then
484 + eapply "${FILESDIR}"/virtualbox-5.2.8-paxmark-bldprogs.patch
485 + fi
486 +
487 + # Remove shipped binaries (kBuild, yasm) and tools, see bug #232775
488 + rm -r kBuild/bin || die
489 + # Remove everything in tools except kBuildUnits
490 + find tools -mindepth 1 -maxdepth 1 -name kBuildUnits -prune -o -exec rm -r {} \+ || die
491 +
492 + # Disable things unused or split into separate ebuilds
493 + sed -e "s@MY_LIBDIR@$(get_libdir)@" \
494 + "${FILESDIR}"/${PN}-5-localconfig > LocalConfig.kmk || die
495 +
496 + if ! use pch; then
497 + # bug #753323
498 + printf '\n%s\n' "VBOX_WITHOUT_PRECOMPILED_HEADERS=1" \
499 + >> LocalConfig.kmk || die
500 + fi
501 +
502 + # Respect LDFLAGS
503 + sed -e "s@_LDFLAGS\.${ARCH}*.*=@& ${LDFLAGS}@g" \
504 + -i Config.kmk src/libs/xpcom18a4/Config.kmk || die
505 +
506 + # Do not use hard-coded ld (related to bug #488176)
507 + sed -e '/QUIET)ld /s@ld @$(LD) @' \
508 + -i src/VBox/Devices/PC/ipxe/Makefile.kmk || die
509 +
510 + # Use PAM only when pam USE flag is enbaled (bug #376531)
511 + if ! use pam; then
512 + einfo "Disabling PAM removes the possibility to use the VRDP features."
513 + sed -i 's@^.*VBOX_WITH_PAM@#VBOX_WITH_PAM@' Config.kmk || die
514 + sed -i 's@\(.*/auth/Makefile.kmk.*\)@#\1@' \
515 + src/VBox/HostServices/Makefile.kmk || die
516 + fi
517 +
518 + # add correct java path
519 + if use java; then
520 + sed "s@/usr/lib/jvm/java-6-sun@$(java-config -O)@" \
521 + -i "${S}"/Config.kmk || die
522 + java-pkg-opt-2_src_prepare
523 + fi
524 +
525 + #856811 #864274
526 + # cannot filter out only one flag, some combinations of these flags produce buggy executables
527 + for i in abm avx avx2 bmi bmi2 fma fma4 popcnt; do
528 + append-cflags $(test-flags-CC -mno-$i)
529 + append-cxxflags $(test-flags-CXX -mno-$i)
530 + done
531 +
532 + # bug #843437
533 + cat >> LocalConfig.kmk <<-EOF || die
534 + CXXFLAGS=${CXXFLAGS}
535 + CFLAGS=${CFLAGS}
536 + EOF
537 +
538 + if use sdl; then
539 + echo -e "\nVBOX_WITH_VBOXSDL=1" >> LocalConfig.kmk || die
540 + fi
541 +
542 + # clang assembler chokes on comments starting with /
543 + if tc-is-clang; then
544 + sed -i -e '/^\//d' src/libs/xpcom18a4/nsprpub/pr/src/md/unix/os_Linux_x86_64.s || die
545 + fi
546 +
547 + # fix doc generation
548 + echo -e "\nVBOX_PATH_DOCBOOK=/usr/share/sgml/docbook/xsl-ns-stylesheets" >> LocalConfig.kmk || die
549 + # replace xhtml names with numeric equivalents
550 + find doc/manual -name \*.xml -exec sed -i \
551 + -e 's/&nbsp;/\&#160;/g' \
552 + -e 's/&ndash;/\&#8211;/g' \
553 + -e 's/&larr;/\&#8592;/g' \
554 + -e 's/&rarr;/\&#8594;/g' \
555 + -e 's/&harr;/\&#8596;/g' {} \+ || die
556 +}
557 +
558 +src_configure() {
559 + tc-ld-disable-gold # bug #488176
560 +
561 + tc-export AR CC CXX LD RANLIB
562 + export HOST_CC="$(tc-getBUILD_CC)"
563 +
564 + local myconf=(
565 + --with-gcc="$(tc-getCC)"
566 + --with-g++="$(tc-getCXX)"
567 +
568 + --disable-kmods
569 +
570 + $(usex alsa '' --disable-alsa)
571 + $(usex dbus '' --disable-dbus)
572 + $(usex debug --build-debug '')
573 + $(usex doc '' --disable-docs)
574 + $(usex java '' --disable-java)
575 + $(usex lvm '' --disable-devmapper)
576 + $(usex opus '' --disable-libopus)
577 + $(usex pulseaudio '' --disable-pulse)
578 + $(usex python '' --disable-python)
579 + $(usex vboxwebsrv --enable-webservice '')
580 + $(usex vnc --enable-vnc '')
581 + )
582 +
583 + if ! use headless; then
584 + myconf+=(
585 + $(usex opengl '' --disable-opengl)
586 + $(usex qt5 '' --disable-qt)
587 + $(usex sdl '' --disable-sdl)
588 + )
589 + else
590 + myconf+=(
591 + --build-headless
592 + --disable-opengl
593 + )
594 + fi
595 +
596 + if use amd64 && ! has_multilib_profile; then
597 + myconf+=( --disable-vmmraw )
598 + fi
599 +
600 + # not an autoconf script
601 + edo ./configure "${myconf[@]}"
602 +
603 + # Force usage of chosen Python implementation
604 + # bug #856121, bug #785835
605 + sed -i \
606 + -e '/VBOX_WITH_PYTHON.*=/d' \
607 + -e '/VBOX_PATH_PYTHON_INC.*=/d' \
608 + -e '/VBOX_LIB_PYTHON.*=/d' \
609 + AutoConfig.kmk || die
610 +
611 + cat >> AutoConfig.kmk <<-EOF || die
612 + VBOX_WITH_PYTHON=$(usev python 1)
613 + VBOX_PATH_PYTHON_INC=$(python_get_includedir)
614 + VBOX_LIB_PYTHON=$(python_get_library_path)
615 + EOF
616 +
617 + if use python; then
618 + local mangled_python="${EPYTHON#python}"
619 + mangled_python="${mangled_python/.}"
620 +
621 + # Stub out the script which defines what the Makefile ends up
622 + # building for. gen_python_deps.py gets called by the Makefile
623 + # with some args and it spits out a bunch of paths for a hardcoded
624 + # list of Pythons. We just override it with what we're actually using.
625 + # This minimises the amount of patching we have to do for new Pythons.
626 + cat > src/libs/xpcom18a4/python/gen_python_deps.py <<-EOF || die
627 + print("VBOX_PYTHON${mangled_python}_INC=$(python_get_includedir)")
628 + print("VBOX_PYTHON${mangled_python}_LIB=$(python_get_library_path)")
629 + print("VBOX_PYTHONDEF_INC=$(python_get_includedir)")
630 + print("VBOX_PYTHONDEF_LIB=$(python_get_library_path)")
631 + EOF
632 +
633 + chmod +x src/libs/xpcom18a4/python/gen_python_deps.py || die
634 + fi
635 +}
636 +
637 +src_compile() {
638 + source ./env.sh || die
639 +
640 + # Force kBuild to respect C[XX]FLAGS and MAKEOPTS (bug #178529)
641 + MAKEJOBS=$(grep -Eo '(\-j|\-\-jobs)(=?|[[:space:]]*)[[:digit:]]+' <<< ${MAKEOPTS})
642 + MAKELOAD=$(grep -Eo '(\-l|\-\-load-average)(=?|[[:space:]]*)[[:digit:]]+' <<< ${MAKEOPTS})
643 + MAKEOPTS="${MAKEJOBS} ${MAKELOAD}"
644 +
645 + local myemakeargs=(
646 + VBOX_BUILD_PUBLISHER=_Gentoo
647 + VBOX_WITH_VBOXIMGMOUNT=1
648 +
649 + KBUILD_VERBOSE=2
650 +
651 + AS="$(tc-getCC)"
652 + CC="$(tc-getCC)"
653 + CXX="$(tc-getCXX)"
654 +
655 + TOOL_GCC3_CC="$(tc-getCC)"
656 + TOOL_GCC3_LD="$(tc-getCC)"
657 + TOOL_GCC3_AS="$(tc-getCC)"
658 + TOOL_GCC3_AR="$(tc-getAR)"
659 + TOOL_GCC3_OBJCOPY="$(tc-getOBJCOPY)"
660 +
661 + TOOL_GXX3_CC="$(tc-getCC)"
662 + TOOL_GXX3_CXX="$(tc-getCXX)"
663 + TOOL_GXX3_LD="$(tc-getCXX)"
664 + TOOL_GXX3_AS="$(tc-getCXX)"
665 + TOOL_GXX3_AR="$(tc-getAR)"
666 + TOOL_GXX3_OBJCOPY="$(tc-getOBJCOPY)"
667 +
668 + TOOL_GCC3_CFLAGS="${CFLAGS}"
669 + TOOL_GCC3_CXXFLAGS="${CXXFLAGS}"
670 + VBOX_GCC_OPT="${CXXFLAGS}"
671 + VBOX_NM="$(tc-getNM)"
672 +
673 + TOOL_YASM_AS=yasm
674 + )
675 +
676 + if use amd64 && has_multilib_profile; then
677 + myemakeargs+=(
678 + CC32="$(tc-getCC) -m32"
679 + CXX32="$(tc-getCXX) -m32"
680 +
681 + TOOL_GCC32_CC="$(tc-getCC) -m32"
682 + TOOL_GCC32_CXX="$(tc-getCXX) -m32"
683 + TOOL_GCC32_LD="$(tc-getCC) -m32"
684 + TOOL_GCC32_AS="$(tc-getCC) -m32"
685 + TOOL_GCC32_AR="$(tc-getAR)"
686 + TOOL_GCC32_OBJCOPY="$(tc-getOBJCOPY)"
687 +
688 + TOOL_GXX32_CC="$(tc-getCC) -m32"
689 + TOOL_GXX32_CXX="$(tc-getCXX) -m32"
690 + TOOL_GXX32_LD="$(tc-getCXX) -m32"
691 + TOOL_GXX32_AS="$(tc-getCXX) -m32"
692 + TOOL_GXX32_AR="$(tc-getAR)"
693 + TOOL_GXX32_OBJCOPY="$(tc-getOBJCOPY)"
694 + )
695 + fi
696 +
697 + MAKE="kmk" emake "${myemakeargs[@]}" all
698 +}
699 +
700 +src_install() {
701 + cd "${S}"/out/linux.${ARCH}/$(usex debug debug release)/bin || die
702 +
703 + local vbox_inst_path="/usr/$(get_libdir)/${PN}" each size ico icofile
704 +
705 + vbox_inst() {
706 + local binary="${1}"
707 + local perms="${2:-0750}"
708 + local path="${3:-${vbox_inst_path}}"
709 +
710 + [[ -n "${binary}" ]] || die "vbox_inst: No binary given!"
711 + [[ ${perms} =~ ^[[:digit:]]+{4}$ ]] || die "vbox_inst: perms must consist of four digits."
712 +
713 + insinto ${path}
714 + doins ${binary}
715 + fowners root:vboxusers ${path}/${binary}
716 + fperms ${perms} ${path}/${binary}
717 + }
718 +
719 + # Create configuration files
720 + insinto /etc/vbox
721 + newins "${FILESDIR}/${PN}-4-config" vbox.cfg
722 +
723 + # Set the correct libdir
724 + sed \
725 + -e "s@MY_LIBDIR@$(get_libdir)@" \
726 + -i "${ED}"/etc/vbox/vbox.cfg || die "vbox.cfg sed failed"
727 +
728 + # Install the wrapper script
729 + exeinto ${vbox_inst_path}
730 + newexe "${FILESDIR}/${PN}-ose-6-wrapper" "VBox"
731 + fowners root:vboxusers ${vbox_inst_path}/VBox
732 + fperms 0750 ${vbox_inst_path}/VBox
733 +
734 + # Install binaries and libraries
735 + insinto ${vbox_inst_path}
736 + doins -r components
737 +
738 + for each in VBox{Autostart,BalloonCtrl,BugReport,CpuReport,ExtPackHelperApp,Manage,SVC,VMMPreload,XPCOMIPCD} vboximg-mount *so *r0; do
739 + vbox_inst ${each}
740 + done
741 +
742 + # These binaries need to be suid root.
743 + for each in VBox{Headless,Net{AdpCtl,DHCP,NAT}} ; do
744 + vbox_inst ${each} 4750
745 + done
746 +
747 + # Install EFI Firmware files (bug #320757)
748 + for each in VBoxEFI{32,64}.fd ; do
749 + vbox_inst ${each} 0644
750 + done
751 +
752 + # VBoxSVC and VBoxManage need to be pax-marked (bug #403453)
753 + # VBoxXPCOMIPCD (bug #524202)
754 + for each in VBox{Headless,Manage,SVC,XPCOMIPCD} ; do
755 + pax-mark -m "${ED}"${vbox_inst_path}/${each}
756 + done
757 +
758 + # Symlink binaries to the shipped wrapper
759 + for each in vbox{autostart,balloonctrl,bugreport,headless,manage} VBox{Autostart,BalloonCtrl,BugReport,Headless,Manage,VRDP} ; do
760 + dosym ${vbox_inst_path}/VBox /usr/bin/${each}
761 + done
762 + dosym ${vbox_inst_path}/vboximg-mount /usr/bin/vboximg-mount
763 +
764 + if use pam; then
765 + # VRDPAuth only works with this (bug #351949)
766 + dosym VBoxAuth.so ${vbox_inst_path}/VRDPAuth.so
767 + fi
768 +
769 + # set an env-variable for 3rd party tools
770 + echo -n "VBOX_APP_HOME=${vbox_inst_path}" > "${T}/90virtualbox"
771 + doenvd "${T}/90virtualbox"
772 +
773 + if ! use headless; then
774 + if use sdl; then
775 + vbox_inst VBoxSDL 4750
776 + pax-mark -m "${ED}"${vbox_inst_path}/VBoxSDL
777 +
778 + for each in vboxsdl VBoxSDL ; do
779 + dosym ${vbox_inst_path}/VBox /usr/bin/${each}
780 + done
781 + fi
782 +
783 + if use qt5; then
784 + vbox_inst VirtualBox
785 + vbox_inst VirtualBoxVM 4750
786 + for each in VirtualBox{,VM} ; do
787 + pax-mark -m "${ED}"${vbox_inst_path}/${each}
788 + done
789 +
790 + if use opengl; then
791 + vbox_inst VBoxTestOGL
792 + pax-mark -m "${ED}"${vbox_inst_path}/VBoxTestOGL
793 + fi
794 +
795 + for each in virtualbox{,vm} VirtualBox{,VM} ; do
796 + dosym ${vbox_inst_path}/VBox /usr/bin/${each}
797 + done
798 +
799 + insinto /usr/share/${PN}
800 + doins -r nls
801 + doins -r UnattendedTemplates
802 +
803 + domenu ${PN}.desktop
804 + fi
805 +
806 + pushd "${S}"/src/VBox/Artwork/OSE &>/dev/null || die
807 + for size in 16 32 48 64 128 ; do
808 + newicon -s ${size} ${PN}-${size}px.png ${PN}.png
809 + done
810 + newicon ${PN}-48px.png ${PN}.png
811 + doicon -s scalable ${PN}.svg
812 + popd &>/dev/null || die
813 + pushd "${S}"/src/VBox/Artwork/other &>/dev/null || die
814 + for size in 16 24 32 48 64 72 96 128 256 512 ; do
815 + for ico in hdd ova ovf vbox{,-extpack} vdi vdh vmdk ; do
816 + icofile="${PN}-${ico}-${size}px.png"
817 + if [[ -f "${icofile}" ]]; then
818 + newicon -s ${size} ${icofile} ${PN}-${ico}.png
819 + fi
820 + done
821 + done
822 + popd &>/dev/null || die
823 + fi
824 +
825 + if use lvm; then
826 + vbox_inst VBoxVolInfo 4750
827 + dosym ${vbox_inst_path}/VBoxVolInfo /usr/bin/VBoxVolInfo
828 + fi
829 +
830 + if use sdk; then
831 + insinto ${vbox_inst_path}
832 + doins -r sdk
833 +
834 + if use java; then
835 + java-pkg_regjar "${ED}/${vbox_inst_path}/sdk/bindings/xpcom/java/vboxjxpcom.jar"
836 + java-pkg_regso "${ED}/${vbox_inst_path}/libvboxjxpcom.so"
837 + fi
838 + fi
839 +
840 + if use udev; then
841 + local udevdir="$(get_udevdir)"
842 + local udev_file="VBoxCreateUSBNode.sh"
843 + local rules_file="10-virtualbox.rules"
844 +
845 + insinto ${udevdir}
846 + doins ${udev_file}
847 + fowners root:vboxusers ${udevdir}/${udev_file}
848 + fperms 0750 ${udevdir}/${udev_file}
849 +
850 + insinto ${udevdir}/rules.d
851 + sed "s@%UDEVDIR%@${udevdir}@" "${FILESDIR}"/${rules_file} \
852 + > "${T}"/${rules_file} || die
853 + doins "${T}"/${rules_file}
854 + fi
855 +
856 + if use vboxwebsrv; then
857 + vbox_inst vboxwebsrv
858 + dosym ${vbox_inst_path}/VBox /usr/bin/vboxwebsrv
859 + newinitd "${FILESDIR}"/vboxwebsrv-initd vboxwebsrv
860 + newconfd "${FILESDIR}"/vboxwebsrv-confd vboxwebsrv
861 + fi
862 +
863 + # Remove dead symlinks (bug #715338)
864 + find "${ED}"/usr/$(get_libdir)/${PN} -xtype l -delete || die
865 +
866 + # Fix version string in extensions or else they don't get accepted
867 + # by the virtualbox host process (see bug #438930)
868 + find ExtensionPacks -type f -name "ExtPack.xml" -exec sed -i '/Version/s@_Gentoo@@' {} \+ || die
869 +
870 + local extensions_dir="${vbox_inst_path}/ExtensionPacks"
871 +
872 + if use vnc; then
873 + insinto ${extensions_dir}
874 + doins -r ExtensionPacks/VNC
875 + fi
876 +
877 + if use dtrace; then
878 + insinto ${extensions_dir}
879 + doins -r ExtensionPacks/Oracle_VBoxDTrace_Extension_Pack
880 + fi
881 +
882 + if use doc; then
883 + dodoc UserManual.pdf
884 + fi
885 +
886 + if use python; then
887 + local python_path_ext="${ED}/usr/$(get_libdir)/virtualbox/VBoxPython3.so"
888 + if [[ ! -x "${python_path_ext}" ]]; then
889 + eerror "Couldn't find ${python_path_ext}! Bindings were requested with USE=python"
890 + eerror "but none were installed. This may happen if support for a Python target"
891 + eerror "(listed in PYTHON_COMPAT in the ebuild) is incomplete within the Makefiles."
892 + die "Incomplete installation of Python bindings! File a bug with Gentoo!"
893 + fi
894 + fi
895 +
896 + newtmpfiles "${FILESDIR}"/${PN}-vboxusb_tmpfilesd ${PN}-vboxusb.conf
897 +}
898 +
899 +pkg_postinst() {
900 + xdg_pkg_postinst
901 +
902 + if use udev; then
903 + udev_reload
904 + udevadm trigger --subsystem-match=usb
905 + fi
906 +
907 + tmpfiles_process virtualbox-vboxusb.conf
908 +
909 + if ! use headless && use qt5; then
910 + elog "To launch VirtualBox just type: \"virtualbox\"."
911 + fi
912 +
913 + elog "You must be in the vboxusers group to use VirtualBox."
914 + elog ""
915 + elog "The latest user manual is available for download at:"
916 + elog "https://download.virtualbox.org/virtualbox/${PV}/UserManual.pdf"
917 + elog ""
918 +
919 + optfeature "Advanced networking setups" net-misc/bridge-utils sys-apps/usermode-utilities
920 + optfeature "USB2, USB3, PXE boot, and VRDP support" app-emulation/virtualbox-extpack-oracle
921 + optfeature "Guest additions ISO" app-emulation/virtualbox-additions
922 +
923 + if ! use udev; then
924 + ewarn "Without USE=udev, USB devices will likely not work in ${PN}."
925 + fi
926 +}
927 +
928 +pkg_postrm() {
929 + xdg_pkg_postrm
930 +
931 + use udev && udev_reload
932 +}