1 |
commit: 1fc46c8f5638d711c550447a86a13286bd79fe73 |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jul 6 04:44:34 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jul 6 06:05:17 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1fc46c8f |
7 |
|
8 |
app-emulation/virtualbox: force usage of selected Python; add Python 3.10 |
9 |
|
10 |
- Finish off the work from earlier (started in 0e7860b78e08743e7ba8a9d641a085e349811f83 |
11 |
and then 7dde6a6bd36cadd1c70d8ec3d3f956750231eeff) for forcing the right |
12 |
Python implementation to be used for USE=python/bindings builds. |
13 |
|
14 |
We now hijack the script that the Makefile calls to get the list of available |
15 |
interpreters (which is separate from the weird configure thing!) and just |
16 |
create a stub which outputs the paths for the corresponding implementation |
17 |
chosen via PYTHON_SINGLE_TARGET using the normal eclass machinery. |
18 |
|
19 |
- Add a sanity check in src_install for when USE=python for |
20 |
/usr/$(get_libdir)/virtualbox/VBoxPython*.so to minimise the risk |
21 |
of silently not building & not realising it. |
22 |
|
23 |
(Noticed risk of this when in the middle of this work & noticed that |
24 |
w/o the extra (see next point) Makefile targets, it ends up silently |
25 |
just not doing anything). |
26 |
|
27 |
- Import Arch Linux / upstream (on trunk) patches for Python 3.10 |
28 |
(thanks to Kerin Millar for the pointer on that bit). |
29 |
|
30 |
We're resigned to having to update the Makefile every time |
31 |
a new Python comes out, but it's at least only one place, |
32 |
and it's not trivial for us to change it given.. kbuild. |
33 |
|
34 |
(It's not just a list, but a bunch of variables which get |
35 |
defined for each target.) |
36 |
|
37 |
Closes: https://bugs.gentoo.org/856121 |
38 |
Closes: https://bugs.gentoo.org/785835 |
39 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
40 |
|
41 |
.../files/virtualbox-6.1.34-r3-python3.10.patch | 122 +++++ |
42 |
.../virtualbox/virtualbox-6.1.34-r4.ebuild | 585 +++++++++++++++++++++ |
43 |
2 files changed, 707 insertions(+) |
44 |
|
45 |
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 |
46 |
new file mode 100644 |
47 |
index 000000000000..e06e86910103 |
48 |
--- /dev/null |
49 |
+++ b/app-emulation/virtualbox/files/virtualbox-6.1.34-r3-python3.10.patch |
50 |
@@ -0,0 +1,122 @@ |
51 |
+https://github.com/archlinux/svntogit-community/blob/b103146beee8b7c70d04685033a8536aed2e5aea/trunk/002-python310.patch |
52 |
+https://github.com/archlinux/svntogit-community/blob/b103146beee8b7c70d04685033a8536aed2e5aea/trunk/003-pyunicode.patch |
53 |
+ |
54 |
+https://www.virtualbox.org/changeset/90537/vbox |
55 |
+https://www.virtualbox.org/changeset/86623/vbox |
56 |
+--- a/src/libs/xpcom18a4/python/src/module/_xpcom.cpp |
57 |
++++ b/src/libs/xpcom18a4/python/src/module/_xpcom.cpp |
58 |
+@@ -84,7 +84,11 @@ |
59 |
+ # define MANGLE_MODULE_INIT(a_Name) RT_CONCAT(a_Name, MODULE_NAME_SUFFIX) |
60 |
+ # endif |
61 |
+ # ifdef VBOX_PYXPCOM_VERSIONED |
62 |
+-# if PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 |
63 |
++# if PY_VERSION_HEX >= 0x030a0000 && PY_VERSION_HEX < 0x030b0000 |
64 |
++# define MODULE_NAME MANGLE_MODULE_NAME("VBoxPython3_10") |
65 |
++# define initVBoxPython MANGLE_MODULE_INIT(PyInit_VBoxPython3_10) |
66 |
++ |
67 |
++# elif PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 |
68 |
+ # define MODULE_NAME MANGLE_MODULE_NAME("VBoxPython3_9") |
69 |
+ # define initVBoxPython MANGLE_MODULE_INIT(PyInit_VBoxPython3_9) |
70 |
+ |
71 |
+--- a/src/libs/xpcom18a4/python/Makefile.kmk |
72 |
++++ b/src/libs/xpcom18a4/python/Makefile.kmk |
73 |
+@@ -4,7 +4,7 @@ |
74 |
+ # |
75 |
+ |
76 |
+ # |
77 |
+-# Copyright (C) 2009-2017 Oracle Corporation |
78 |
++# Copyright (C) 2009-2021 Oracle Corporation |
79 |
+ # |
80 |
+ # This file is part of VirtualBox Open Source Edition (OSE), as |
81 |
+ # available from http://www.virtualbox.org. This file is free software; |
82 |
+@@ -20,7 +20,7 @@ |
83 |
+ |
84 |
+ # |
85 |
+ # List of supported Python versions, defining a number of |
86 |
+-# 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 |
87 |
++# 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 |
88 |
+ # which get picked up below. |
89 |
+ # |
90 |
+ ifeq ($(KBUILD_TARGET),darwin) # Relatively predictable, don't script. |
91 |
+@@ -646,6 +646,52 @@ |
92 |
+ endif |
93 |
+ endif |
94 |
+ |
95 |
++ifdef VBOX_PYTHON310_INC |
96 |
++# |
97 |
++# Python 3.10 version |
98 |
++# |
99 |
++DLLS += VBoxPython3_10 |
100 |
++VBoxPython3_10_EXTENDS = VBoxPythonBase |
101 |
++VBoxPython3_10_EXTENDS_BY = appending |
102 |
++VBoxPython3_10_TEMPLATE = XPCOM |
103 |
++VBoxPython3_10_INCS = $(VBOX_PYTHON310_INC) |
104 |
++VBoxPython3_10_LIBS = $(VBOX_PYTHON310_LIB) |
105 |
++ |
106 |
++ ifdef VBOX_WITH_32_ON_64_MAIN_API |
107 |
++ ifdef VBOX_PYTHON310_LIB_X86 |
108 |
++DLLS += VBoxPython3_10_x86 |
109 |
++VBoxPython3_10_x86_EXTENDS = VBoxPythonBase_x86 |
110 |
++VBoxPython3_10_x86_EXTENDS_BY = appending |
111 |
++VBoxPython3_10_x86_TEMPLATE = XPCOM |
112 |
++VBoxPython3_10_x86_INCS = $(VBOX_PYTHON310_INC) |
113 |
++VBoxPython3_10_x86_LIBS = $(VBOX_PYTHON310_LIB_X86) |
114 |
++ endif |
115 |
++ endif |
116 |
++endif |
117 |
++ |
118 |
++ifdef VBOX_PYTHON310M_INC |
119 |
++# |
120 |
++# Python 3.10 version with pymalloc |
121 |
++# |
122 |
++DLLS += VBoxPython3_10m |
123 |
++VBoxPython3_10m_EXTENDS = VBoxPythonBase_m |
124 |
++VBoxPython3_10m_EXTENDS_BY = appending |
125 |
++VBoxPython3_10m_TEMPLATE = XPCOM |
126 |
++VBoxPython3_10m_INCS = $(VBOX_PYTHON310M_INC) |
127 |
++VBoxPython3_10m_LIBS = $(VBOX_PYTHON310M_LIB) |
128 |
++ |
129 |
++ ifdef VBOX_WITH_32_ON_64_MAIN_API |
130 |
++ ifdef VBOX_PYTHON310M_LIB_X86 |
131 |
++DLLS += VBoxPython3_10m_x86 |
132 |
++VBoxPython3_10m_x86_EXTENDS = VBoxPythonBase_x86_m |
133 |
++VBoxPython3_10m_x86_EXTENDS_BY = appending |
134 |
++VBoxPython3_10m_x86_TEMPLATE_ = XPCOM |
135 |
++VBoxPython3_10m_x86_INCS = $(VBOX_PYTHON310M_INC) |
136 |
++VBoxPython3_10m_x86_LIBS = $(VBOX_PYTHON310M_LIB_X86) |
137 |
++ endif |
138 |
++ endif |
139 |
++endif |
140 |
++ |
141 |
+ ifdef VBOX_PYTHONDEF_INC |
142 |
+ # |
143 |
+ # Python without versioning |
144 |
+@@ -730,4 +776,3 @@ |
145 |
+ |
146 |
+ |
147 |
+ include $(FILE_KBUILD_SUB_FOOTER) |
148 |
+- |
149 |
+ |
150 |
+--- a/src/libs/xpcom18a4/python/src/PyXPCOM.h |
151 |
++++ b/src/libs/xpcom18a4/python/src/PyXPCOM.h |
152 |
+@@ -137,12 +137,14 @@ |
153 |
+ # define PyInt_Check(o) PyLong_Check(o) |
154 |
+ # define PyInt_AsLong(o) PyLong_AsLong(o) |
155 |
+ # define PyNumber_Int(o) PyNumber_Long(o) |
156 |
+-# ifndef PyUnicode_AsUTF8 |
157 |
+-# define PyUnicode_AsUTF8(o) _PyUnicode_AsString(o) |
158 |
++# if !defined(Py_LIMITED_API) && PY_VERSION_HEX <= 0x03030000 /* 3.3 added PyUnicode_AsUTF8AndSize */ |
159 |
++# ifndef PyUnicode_AsUTF8 |
160 |
++# define PyUnicode_AsUTF8(o) _PyUnicode_AsString(o) |
161 |
++# endif |
162 |
++# ifndef PyUnicode_AsUTF8AndSize |
163 |
++# define PyUnicode_AsUTF8AndSize(o,s) _PyUnicode_AsStringAndSize(o,s) |
164 |
++# endif |
165 |
+ # endif |
166 |
+-# ifndef PyUnicode_AsUTF8AndSize |
167 |
+-# define PyUnicode_AsUTF8AndSize(o,s) _PyUnicode_AsStringAndSize(o,s) |
168 |
+-# endif |
169 |
+ typedef struct PyMethodChain |
170 |
+ { |
171 |
+ PyMethodDef *methods; |
172 |
+ |
173 |
|
174 |
diff --git a/app-emulation/virtualbox/virtualbox-6.1.34-r4.ebuild b/app-emulation/virtualbox/virtualbox-6.1.34-r4.ebuild |
175 |
new file mode 100644 |
176 |
index 000000000000..a20ee04a2d51 |
177 |
--- /dev/null |
178 |
+++ b/app-emulation/virtualbox/virtualbox-6.1.34-r4.ebuild |
179 |
@@ -0,0 +1,585 @@ |
180 |
+# Copyright 2022 Gentoo Authors |
181 |
+# Distributed under the terms of the GNU General Public License v2 |
182 |
+ |
183 |
+EAPI=8 |
184 |
+ |
185 |
+# To add a new Python here: |
186 |
+# 1. Patch src/libs/xpcom18a4/python/Makefile.kmk (copy the previous impl's logic) |
187 |
+# Do NOT skip this part. It'll end up silently not-building the Python extension |
188 |
+# or otherwise misbehaving if you do. |
189 |
+# |
190 |
+# 2. Then update PYTHON_COMPAT & set PYTHON_SINGLE_TARGET for testing w/ USE=python. |
191 |
+# |
192 |
+# May need to look at other distros (e.g. Arch Linux) to find patches for newer |
193 |
+# Python versions as upstream tends to lag. Upstream may have patches on their |
194 |
+# trunk branch but not release branch. |
195 |
+# |
196 |
+# See bug #785835, bug #856121. |
197 |
+PYTHON_COMPAT=( python3_{8..10} ) |
198 |
+ |
199 |
+inherit desktop edo java-pkg-opt-2 linux-info multilib optfeature pax-utils python-single-r1 tmpfiles toolchain-funcs udev xdg |
200 |
+ |
201 |
+MY_PN="VirtualBox" |
202 |
+MY_PV="${PV/beta/BETA}" |
203 |
+MY_PV="${MY_PV/rc/RC}" |
204 |
+MY_P=${MY_PN}-${MY_PV} |
205 |
+[[ ${PV} == *a ]] && DIR_PV="$(ver_cut 1-3)" |
206 |
+ |
207 |
+DESCRIPTION="Family of powerful x86 virtualization products for enterprise and home use" |
208 |
+HOMEPAGE="https://www.virtualbox.org/" |
209 |
+SRC_URI="https://download.virtualbox.org/virtualbox/${DIR_PV:-${MY_PV}}/${MY_P}.tar.bz2 |
210 |
+ https://dev.gentoo.org/~polynomial-c/${PN}/patchsets/${PN}-6.1.12-patches-01.tar.xz" |
211 |
+S="${WORKDIR}/${MY_PN}-${DIR_PV:-${MY_PV}}" |
212 |
+ |
213 |
+LICENSE="GPL-2 dtrace? ( CDDL )" |
214 |
+SLOT="0/$(ver_cut 1-2)" |
215 |
+if [[ ${PV} != *_beta* ]] && [[ ${PV} != *_rc* ]] ; then |
216 |
+ KEYWORDS="~amd64" |
217 |
+fi |
218 |
+IUSE="alsa debug doc dtrace headless java lvm +opus pam pax-kernel pch pulseaudio +opengl python +qt5 +sdk +udev vboxwebsrv vnc" |
219 |
+ |
220 |
+COMMON_DEPEND=" |
221 |
+ ${PYTHON_DEPS} |
222 |
+ !app-emulation/virtualbox-bin |
223 |
+ acct-group/vboxusers |
224 |
+ ~app-emulation/virtualbox-modules-${DIR_PV:-${PV}} |
225 |
+ dev-libs/libIDL |
226 |
+ >=dev-libs/libxslt-1.1.19 |
227 |
+ net-misc/curl |
228 |
+ dev-libs/libxml2 |
229 |
+ media-libs/libpng:0= |
230 |
+ media-libs/libvpx:0= |
231 |
+ sys-libs/zlib:= |
232 |
+ !headless? ( |
233 |
+ media-libs/libsdl:0[X,video] |
234 |
+ x11-libs/libX11 |
235 |
+ x11-libs/libxcb:= |
236 |
+ x11-libs/libXcursor |
237 |
+ x11-libs/libXext |
238 |
+ x11-libs/libXmu |
239 |
+ x11-libs/libXt |
240 |
+ opengl? ( |
241 |
+ media-libs/libglvnd[X] |
242 |
+ virtual/glu |
243 |
+ ) |
244 |
+ qt5? ( |
245 |
+ dev-qt/qtcore:5 |
246 |
+ dev-qt/qtgui:5 |
247 |
+ dev-qt/qtprintsupport:5 |
248 |
+ dev-qt/qtwidgets:5 |
249 |
+ dev-qt/qtx11extras:5 |
250 |
+ opengl? ( dev-qt/qtopengl:5 ) |
251 |
+ x11-libs/libXinerama |
252 |
+ ) |
253 |
+ ) |
254 |
+ dev-libs/openssl:0= |
255 |
+ virtual/libcrypt:= |
256 |
+ lvm? ( sys-fs/lvm2 ) |
257 |
+ opus? ( media-libs/opus ) |
258 |
+ udev? ( >=virtual/udev-171 ) |
259 |
+ vnc? ( >=net-libs/libvncserver-0.9.9 ) |
260 |
+" |
261 |
+# We're stuck on JDK (and JRE, I guess?) 1.8 because of need for wsimport |
262 |
+# with USE="vboxwebsrv java". Note that we have to put things in DEPEND, |
263 |
+# not (only, anyway) BDEPEND, as the eclass magic to set the environment variables |
264 |
+# based on *DEPEND doesn't work for BDEPEND at least right now. See bug #832166. |
265 |
+DEPEND=" |
266 |
+ ${COMMON_DEPEND} |
267 |
+ alsa? ( >=media-libs/alsa-lib-1.0.13 ) |
268 |
+ !headless? ( |
269 |
+ x11-libs/libXinerama |
270 |
+ opengl? ( virtual/opengl ) |
271 |
+ ) |
272 |
+ java? ( virtual/jdk:1.8 ) |
273 |
+ pam? ( sys-libs/pam ) |
274 |
+ pax-kernel? ( sys-apps/elfix ) |
275 |
+ pulseaudio? ( media-sound/pulseaudio ) |
276 |
+ qt5? ( dev-qt/linguist-tools:5 ) |
277 |
+ vboxwebsrv? ( net-libs/gsoap[-gnutls(-)] ) |
278 |
+" |
279 |
+BDEPEND=" |
280 |
+ ${PYTHON_DEPS} |
281 |
+ >=dev-util/kbuild-0.1.9998.3127 |
282 |
+ >=dev-lang/yasm-0.6.2 |
283 |
+ sys-apps/which |
284 |
+ sys-devel/bin86 |
285 |
+ sys-libs/libcap |
286 |
+ sys-power/iasl |
287 |
+ virtual/pkgconfig |
288 |
+ doc? ( |
289 |
+ app-text/docbook-sgml-dtd:4.4 |
290 |
+ dev-texlive/texlive-basic |
291 |
+ dev-texlive/texlive-latex |
292 |
+ dev-texlive/texlive-latexrecommended |
293 |
+ dev-texlive/texlive-latexextra |
294 |
+ dev-texlive/texlive-fontsrecommended |
295 |
+ dev-texlive/texlive-fontsextra |
296 |
+ ) |
297 |
+ java? ( virtual/jdk:1.8 ) |
298 |
+" |
299 |
+RDEPEND=" |
300 |
+ ${COMMON_DEPEND} |
301 |
+ java? ( virtual/jre:1.8 ) |
302 |
+" |
303 |
+ |
304 |
+QA_TEXTRELS=" |
305 |
+ usr/lib64/virtualbox/VMMR0.r0 |
306 |
+" |
307 |
+ |
308 |
+QA_EXECSTACK=" |
309 |
+ usr/lib64/virtualbox/iPxeBaseBin |
310 |
+ usr/lib64/virtualbox/VMMR0.r0 |
311 |
+ usr/lib64/virtualbox/VBoxDDR0.r0 |
312 |
+" |
313 |
+ |
314 |
+QA_WX_LOAD=" |
315 |
+ usr/lib64/virtualbox/iPxeBaseBin |
316 |
+" |
317 |
+ |
318 |
+QA_PRESTRIPPED=" |
319 |
+ usr/lib64/virtualbox/VMMR0.r0 |
320 |
+ usr/lib64/virtualbox/VBoxDDR0.r0 |
321 |
+" |
322 |
+ |
323 |
+REQUIRED_USE=" |
324 |
+ java? ( sdk ) |
325 |
+ python? ( sdk ) |
326 |
+ vboxwebsrv? ( java ) |
327 |
+ ${PYTHON_REQUIRED_USE} |
328 |
+" |
329 |
+ |
330 |
+PATCHES=( |
331 |
+ "${FILESDIR}"/${P}-vboxr0.patch |
332 |
+ |
333 |
+ # Upstream patch for USE=-pam |
334 |
+ # bug #843437 |
335 |
+ "${FILESDIR}"/${PN}-6.1.34-no-pam.patch |
336 |
+ |
337 |
+ "${FILESDIR}"/${PN}-6.1.26-configure-include-qt5-path.patch # bug #805365 |
338 |
+ |
339 |
+ # This patch is needed to avoid automagic detection based on a hardcoded |
340 |
+ # list of Pythons in configure. It's necessary but not sufficient |
341 |
+ # (see the rest of the ebuild's logic for the remainder) to handle |
342 |
+ # proper Python selection. |
343 |
+ "${FILESDIR}"/${PN}-6.1.34-r3-python.patch |
344 |
+ |
345 |
+ # Patch grabbed from Arch Linux / upstream for Python 3.10 support |
346 |
+ "${FILESDIR}"/${PN}-6.1.34-r3-python3.10.patch |
347 |
+ |
348 |
+ # Downloaded patchset |
349 |
+ "${WORKDIR}"/patches |
350 |
+) |
351 |
+ |
352 |
+pkg_pretend() { |
353 |
+ if ! use headless && ! use qt5 ; then |
354 |
+ einfo "No USE=\"qt5\" selected, this build will not include any Qt frontend." |
355 |
+ elif use headless && use qt5 ; then |
356 |
+ einfo "You selected USE=\"headless qt5\", defaulting to" |
357 |
+ einfo "USE=\"headless\", this build will not include any X11/Qt frontend." |
358 |
+ fi |
359 |
+ |
360 |
+ if ! use opengl ; then |
361 |
+ einfo "No USE=\"opengl\" selected, this build will lack" |
362 |
+ einfo "the OpenGL feature." |
363 |
+ fi |
364 |
+ if ! use python ; then |
365 |
+ einfo "You have disabled the \"python\" USE flag. This will only" |
366 |
+ einfo "disable the python bindings being installed." |
367 |
+ fi |
368 |
+} |
369 |
+ |
370 |
+pkg_setup() { |
371 |
+ java-pkg-opt-2_pkg_setup |
372 |
+ python-single-r1_pkg_setup |
373 |
+} |
374 |
+ |
375 |
+src_prepare() { |
376 |
+ default |
377 |
+ |
378 |
+ # Only add nopie patch when we're on hardened |
379 |
+ if gcc-specs-pie ; then |
380 |
+ eapply "${FILESDIR}"/050_virtualbox-5.2.8-nopie.patch |
381 |
+ fi |
382 |
+ |
383 |
+ # Only add paxmark patch when we're on pax-kernel |
384 |
+ if use pax-kernel ; then |
385 |
+ eapply "${FILESDIR}"/virtualbox-5.2.8-paxmark-bldprogs.patch |
386 |
+ fi |
387 |
+ |
388 |
+ # Remove shipped binaries (kBuild, yasm), see bug #232775 |
389 |
+ rm -r kBuild/bin tools || die |
390 |
+ |
391 |
+ # Replace pointless GCC version check with something more sensible. |
392 |
+ # This is needed for the qt5 version check. |
393 |
+ sed -e 's@^check_gcc$@cc_maj="$(${CC} -dumpversion | cut -d. -f1)" ; cc_min="$(${CC} -dumpversion | cut -d. -f2)"@' \ |
394 |
+ -i configure || die |
395 |
+ |
396 |
+ # Disable things unused or split into separate ebuilds |
397 |
+ sed -e "s@MY_LIBDIR@$(get_libdir)@" \ |
398 |
+ "${FILESDIR}"/${PN}-5-localconfig > LocalConfig.kmk || die |
399 |
+ |
400 |
+ if ! use pch ; then |
401 |
+ # bug #753323 |
402 |
+ printf '\n%s\n' "VBOX_WITHOUT_PRECOMPILED_HEADERS=1" \ |
403 |
+ >> LocalConfig.kmk || die |
404 |
+ fi |
405 |
+ |
406 |
+ # Respect LDFLAGS |
407 |
+ sed -e "s@_LDFLAGS\.${ARCH}*.*=@& ${LDFLAGS}@g" \ |
408 |
+ -i Config.kmk src/libs/xpcom18a4/Config.kmk || die |
409 |
+ |
410 |
+ # Do not use hard-coded ld (related to bug #488176) |
411 |
+ sed -e '/QUIET)ld /s@ld @$(LD) @' \ |
412 |
+ -i src/VBox/Devices/PC/ipxe/Makefile.kmk || die |
413 |
+ |
414 |
+ # Use PAM only when pam USE flag is enbaled (bug #376531) |
415 |
+ if ! use pam ; then |
416 |
+ einfo "Disabling PAM removes the possibility to use the VRDP features." |
417 |
+ sed -i 's@^.*VBOX_WITH_PAM@#VBOX_WITH_PAM@' Config.kmk || die |
418 |
+ sed -i 's@\(.*/auth/Makefile.kmk.*\)@#\1@' \ |
419 |
+ src/VBox/HostServices/Makefile.kmk || die |
420 |
+ fi |
421 |
+ |
422 |
+ # add correct java path |
423 |
+ if use java ; then |
424 |
+ sed "s@/usr/lib/jvm/java-6-sun@$(java-config -O)@" \ |
425 |
+ -i "${S}"/Config.kmk || die |
426 |
+ java-pkg-opt-2_src_prepare |
427 |
+ fi |
428 |
+} |
429 |
+ |
430 |
+src_configure() { |
431 |
+ tc-ld-disable-gold # bug #488176 |
432 |
+ tc-export CC CXX LD AR RANLIB |
433 |
+ export HOST_CC="$(tc-getBUILD_CC)" |
434 |
+ |
435 |
+ local myconf=( |
436 |
+ --with-gcc="$(tc-getCC)" |
437 |
+ --with-g++="$(tc-getCXX)" |
438 |
+ |
439 |
+ --disable-dbus |
440 |
+ --disable-kmods |
441 |
+ |
442 |
+ $(usex alsa '' --disable-alsa) |
443 |
+ $(usex debug --build-debug '') |
444 |
+ $(usex doc '' --disable-docs) |
445 |
+ $(usex java '' --disable-java) |
446 |
+ $(usex lvm '' --disable-devmapper) |
447 |
+ $(usex opus '' --disable-libopus) |
448 |
+ $(usex pulseaudio '' --disable-pulse) |
449 |
+ $(usex python '' --disable-python) |
450 |
+ $(usex vboxwebsrv --enable-webservice '') |
451 |
+ $(usex vnc --enable-vnc '') |
452 |
+ ) |
453 |
+ |
454 |
+ if ! use headless ; then |
455 |
+ myconf+=( |
456 |
+ $(usex opengl '' --disable-opengl) |
457 |
+ $(usex qt5 '' --disable-qt) |
458 |
+ ) |
459 |
+ else |
460 |
+ myconf+=( |
461 |
+ --build-headless |
462 |
+ --disable-opengl |
463 |
+ ) |
464 |
+ fi |
465 |
+ |
466 |
+ if use amd64 && ! has_multilib_profile ; then |
467 |
+ myconf+=( --disable-vmmraw ) |
468 |
+ fi |
469 |
+ |
470 |
+ # bug #843437 |
471 |
+ cat >> LocalConfig.kmk <<-EOF || die |
472 |
+ CFLAGS=${CFLAGS} |
473 |
+ CXXFLAGS=${CXXFLAGS} |
474 |
+ EOF |
475 |
+ |
476 |
+ # not an autoconf script |
477 |
+ edo ./configure "${myconf[@]}" |
478 |
+ |
479 |
+ # Force usage of chosen Python implementation |
480 |
+ # bug #856121, bug #785835 |
481 |
+ sed -i \ |
482 |
+ -e '/VBOX_WITH_PYTHON.*=/d' \ |
483 |
+ -e '/VBOX_PATH_PYTHON_INC.*=/d' \ |
484 |
+ -e '/VBOX_LIB_PYTHON.*=/d' \ |
485 |
+ AutoConfig.kmk || die |
486 |
+ |
487 |
+ cat >> AutoConfig.kmk <<-EOF || die |
488 |
+ VBOX_WITH_PYTHON=$(usex python 1 0) |
489 |
+ VBOX_PATH_PYTHON_INC=$(python_get_includedir) |
490 |
+ VBOX_LIB_PYTHON=$(python_get_library_path) |
491 |
+ EOF |
492 |
+ |
493 |
+ if use python ; then |
494 |
+ local mangled_python="${EPYTHON#python}" |
495 |
+ mangled_python="${mangled_python/.}" |
496 |
+ |
497 |
+ # Stub out the script which defines what the Makefile ends up |
498 |
+ # building for. gen_python_deps.py gets called by the Makefile |
499 |
+ # with some args and it spits out a bunch of paths for a hardcoded |
500 |
+ # list of Pythons. We just override it with what we're actually using. |
501 |
+ # This minimises the amount of patching we have to do for new Pythons. |
502 |
+ cat > src/libs/xpcom18a4/python/gen_python_deps.py <<-EOF || die |
503 |
+ print("VBOX_PYTHON${mangled_python}_INC=$(python_get_includedir)") |
504 |
+ print("VBOX_PYTHON${mangled_python}_LIB=$(python_get_library_path)") |
505 |
+ print("VBOX_PYTHONDEF_INC=$(python_get_includedir)") |
506 |
+ print("VBOX_PYTHONDEF_LIB=$(python_get_library_path)") |
507 |
+ EOF |
508 |
+ |
509 |
+ chmod +x src/libs/xpcom18a4/python/gen_python_deps.py || die |
510 |
+ fi |
511 |
+} |
512 |
+ |
513 |
+src_compile() { |
514 |
+ source ./env.sh || die |
515 |
+ |
516 |
+ # Force kBuild to respect C[XX]FLAGS and MAKEOPTS (bug #178529) |
517 |
+ MAKEJOBS=$(grep -Eo '(\-j|\-\-jobs)(=?|[[:space:]]*)[[:digit:]]+' <<< ${MAKEOPTS}) |
518 |
+ MAKELOAD=$(grep -Eo '(\-l|\-\-load-average)(=?|[[:space:]]*)[[:digit:]]+' <<< ${MAKEOPTS}) |
519 |
+ MAKEOPTS="${MAKEJOBS} ${MAKELOAD}" |
520 |
+ |
521 |
+ MAKE="kmk" emake \ |
522 |
+ VBOX_BUILD_PUBLISHER=_Gentoo \ |
523 |
+ TOOL_GXX3_CC="$(tc-getCC)" \ |
524 |
+ TOOL_GXX3_CXX="$(tc-getCXX)" \ |
525 |
+ TOOL_GXX3_LD="$(tc-getCXX)" \ |
526 |
+ VBOX_GCC_OPT="${CXXFLAGS}" \ |
527 |
+ TOOL_YASM_AS=yasm \ |
528 |
+ KBUILD_VERBOSE=2 \ |
529 |
+ VBOX_WITH_VBOXIMGMOUNT=1 \ |
530 |
+ all |
531 |
+} |
532 |
+ |
533 |
+src_install() { |
534 |
+ cd "${S}"/out/linux.${ARCH}/$(usex debug debug release)/bin || die |
535 |
+ |
536 |
+ local vbox_inst_path="/usr/$(get_libdir)/${PN}" each size ico icofile |
537 |
+ |
538 |
+ vbox_inst() { |
539 |
+ local binary="${1}" |
540 |
+ local perms="${2:-0750}" |
541 |
+ local path="${3:-${vbox_inst_path}}" |
542 |
+ |
543 |
+ [[ -n "${binary}" ]] || die "vbox_inst: No binary given!" |
544 |
+ [[ ${perms} =~ ^[[:digit:]]+{4}$ ]] || die "vbox_inst: perms must consist of four digits." |
545 |
+ |
546 |
+ insinto ${path} |
547 |
+ doins ${binary} |
548 |
+ fowners root:vboxusers ${path}/${binary} |
549 |
+ fperms ${perms} ${path}/${binary} |
550 |
+ } |
551 |
+ |
552 |
+ # Create configuration files |
553 |
+ insinto /etc/vbox |
554 |
+ newins "${FILESDIR}/${PN}-4-config" vbox.cfg |
555 |
+ |
556 |
+ # Set the correct libdir |
557 |
+ sed \ |
558 |
+ -e "s@MY_LIBDIR@$(get_libdir)@" \ |
559 |
+ -i "${ED}"/etc/vbox/vbox.cfg || die "vbox.cfg sed failed" |
560 |
+ |
561 |
+ # Install the wrapper script |
562 |
+ exeinto ${vbox_inst_path} |
563 |
+ newexe "${FILESDIR}/${PN}-ose-6-wrapper" "VBox" |
564 |
+ fowners root:vboxusers ${vbox_inst_path}/VBox |
565 |
+ fperms 0750 ${vbox_inst_path}/VBox |
566 |
+ |
567 |
+ # Install binaries and libraries |
568 |
+ insinto ${vbox_inst_path} |
569 |
+ doins -r components |
570 |
+ |
571 |
+ for each in VBox{Autostart,BalloonCtrl,BugReport,CpuReport,ExtPackHelperApp,Manage,SVC,Tunctl,VMMPreload,XPCOMIPCD} vboximg-mount *so *r0 iPxeBaseBin ; do |
572 |
+ vbox_inst ${each} |
573 |
+ done |
574 |
+ |
575 |
+ # These binaries need to be suid root. |
576 |
+ for each in VBox{Headless,Net{AdpCtl,DHCP,NAT}} ; do |
577 |
+ vbox_inst ${each} 4750 |
578 |
+ done |
579 |
+ |
580 |
+ # Install EFI Firmware files (bug #320757) |
581 |
+ for each in VBoxEFI{32,64}.fd ; do |
582 |
+ vbox_inst ${each} 0644 |
583 |
+ done |
584 |
+ |
585 |
+ # VBoxSVC and VBoxManage need to be pax-marked (bug #403453) |
586 |
+ # VBoxXPCOMIPCD (bug #524202) |
587 |
+ for each in VBox{Headless,Manage,SVC,XPCOMIPCD} ; do |
588 |
+ pax-mark -m "${ED}"${vbox_inst_path}/${each} |
589 |
+ done |
590 |
+ |
591 |
+ # Symlink binaries to the shipped wrapper |
592 |
+ for each in vbox{autostart,balloonctrl,bugreport,headless,manage} VBox{Autostart,BalloonCtrl,BugReport,Headless,Manage,VRDP} ; do |
593 |
+ dosym ${vbox_inst_path}/VBox /usr/bin/${each} |
594 |
+ done |
595 |
+ dosym ${vbox_inst_path}/VBoxTunctl /usr/bin/VBoxTunctl |
596 |
+ dosym ${vbox_inst_path}/vboximg-mount /usr/bin/vboximg-mount |
597 |
+ |
598 |
+ if use pam ; then |
599 |
+ # VRDPAuth only works with this (bug #351949) |
600 |
+ dosym VBoxAuth.so ${vbox_inst_path}/VRDPAuth.so |
601 |
+ fi |
602 |
+ |
603 |
+ # set an env-variable for 3rd party tools |
604 |
+ echo -n "VBOX_APP_HOME=${vbox_inst_path}" > "${T}/90virtualbox" |
605 |
+ doenvd "${T}/90virtualbox" |
606 |
+ |
607 |
+ if ! use headless ; then |
608 |
+ vbox_inst rdesktop-vrdp |
609 |
+ vbox_inst VBoxSDL 4750 |
610 |
+ pax-mark -m "${ED}"${vbox_inst_path}/VBoxSDL |
611 |
+ |
612 |
+ for each in vboxsdl VBoxSDL ; do |
613 |
+ dosym ${vbox_inst_path}/VBox /usr/bin/${each} |
614 |
+ done |
615 |
+ |
616 |
+ if use qt5 ; then |
617 |
+ vbox_inst VirtualBox |
618 |
+ vbox_inst VirtualBoxVM 4750 |
619 |
+ for each in VirtualBox{,VM} ; do |
620 |
+ pax-mark -m "${ED}"${vbox_inst_path}/${each} |
621 |
+ done |
622 |
+ |
623 |
+ if use opengl ; then |
624 |
+ vbox_inst VBoxTestOGL |
625 |
+ pax-mark -m "${ED}"${vbox_inst_path}/VBoxTestOGL |
626 |
+ fi |
627 |
+ |
628 |
+ for each in virtualbox{,vm} VirtualBox{,VM} ; do |
629 |
+ dosym ${vbox_inst_path}/VBox /usr/bin/${each} |
630 |
+ done |
631 |
+ |
632 |
+ insinto /usr/share/${PN} |
633 |
+ doins -r nls |
634 |
+ doins -r UnattendedTemplates |
635 |
+ |
636 |
+ domenu ${PN}.desktop |
637 |
+ fi |
638 |
+ |
639 |
+ pushd "${S}"/src/VBox/Artwork/OSE &>/dev/null || die |
640 |
+ for size in 16 32 48 64 128 ; do |
641 |
+ newicon -s ${size} ${PN}-${size}px.png ${PN}.png |
642 |
+ done |
643 |
+ newicon ${PN}-48px.png ${PN}.png |
644 |
+ doicon -s scalable ${PN}.svg |
645 |
+ popd &>/dev/null || die |
646 |
+ pushd "${S}"/src/VBox/Artwork/other &>/dev/null || die |
647 |
+ for size in 16 24 32 48 64 72 96 128 256 512 ; do |
648 |
+ for ico in hdd ova ovf vbox{,-extpack} vdi vdh vmdk ; do |
649 |
+ icofile="${PN}-${ico}-${size}px.png" |
650 |
+ if [[ -f "${icofile}" ]] ; then |
651 |
+ newicon -s ${size} ${icofile} ${PN}-${ico}.png |
652 |
+ fi |
653 |
+ done |
654 |
+ done |
655 |
+ popd &>/dev/null || die |
656 |
+ fi |
657 |
+ |
658 |
+ if use lvm ; then |
659 |
+ vbox_inst VBoxVolInfo 4750 |
660 |
+ dosym ${vbox_inst_path}/VBoxVolInfo /usr/bin/VBoxVolInfo |
661 |
+ fi |
662 |
+ |
663 |
+ if use sdk ; then |
664 |
+ insinto ${vbox_inst_path} |
665 |
+ doins -r sdk |
666 |
+ |
667 |
+ if use java ; then |
668 |
+ java-pkg_regjar "${ED}/${vbox_inst_path}/sdk/bindings/xpcom/java/vboxjxpcom.jar" |
669 |
+ java-pkg_regso "${ED}/${vbox_inst_path}/libvboxjxpcom.so" |
670 |
+ fi |
671 |
+ fi |
672 |
+ |
673 |
+ if use udev ; then |
674 |
+ local udevdir="$(get_udevdir)" |
675 |
+ local udev_file="VBoxCreateUSBNode.sh" |
676 |
+ local rules_file="10-virtualbox.rules" |
677 |
+ |
678 |
+ insinto ${udevdir} |
679 |
+ doins ${udev_file} |
680 |
+ fowners root:vboxusers ${udevdir}/${udev_file} |
681 |
+ fperms 0750 ${udevdir}/${udev_file} |
682 |
+ |
683 |
+ insinto ${udevdir}/rules.d |
684 |
+ sed "s@%UDEVDIR%@${udevdir}@" "${FILESDIR}"/${rules_file} \ |
685 |
+ > "${T}"/${rules_file} || die |
686 |
+ doins "${T}"/${rules_file} |
687 |
+ fi |
688 |
+ |
689 |
+ if use vboxwebsrv ; then |
690 |
+ vbox_inst vboxwebsrv |
691 |
+ dosym ${vbox_inst_path}/VBox /usr/bin/vboxwebsrv |
692 |
+ newinitd "${FILESDIR}"/vboxwebsrv-initd vboxwebsrv |
693 |
+ newconfd "${FILESDIR}"/vboxwebsrv-confd vboxwebsrv |
694 |
+ fi |
695 |
+ |
696 |
+ # Remove dead symlinks (bug #715338) |
697 |
+ find "${ED}"/usr/$(get_libdir)/${PN} -xtype l -delete || die |
698 |
+ |
699 |
+ # Fix version string in extensions or else they don't get accepted |
700 |
+ # by the virtualbox host process (see bug #438930) |
701 |
+ find ExtensionPacks -type f -name "ExtPack.xml" -print0 \ |
702 |
+ | xargs --no-run-if-empty --null sed -i '/Version/s@_Gentoo@@' \ |
703 |
+ || die |
704 |
+ |
705 |
+ local extensions_dir="${vbox_inst_path}/ExtensionPacks" |
706 |
+ |
707 |
+ if use vnc ; then |
708 |
+ insinto ${extensions_dir} |
709 |
+ doins -r ExtensionPacks/VNC |
710 |
+ fi |
711 |
+ |
712 |
+ if use dtrace ; then |
713 |
+ insinto ${extensions_dir} |
714 |
+ doins -r ExtensionPacks/Oracle_VBoxDTrace_Extension_Pack |
715 |
+ fi |
716 |
+ |
717 |
+ if use doc ; then |
718 |
+ dodoc UserManual.pdf |
719 |
+ fi |
720 |
+ |
721 |
+ if use python ; then |
722 |
+ local mangled_python="${EPYTHON#python}" |
723 |
+ mangled_python="${mangled_python/./_}" |
724 |
+ |
725 |
+ local python_path_ext="${ED}/usr/$(get_libdir)/virtualbox/VBoxPython${mangled_python}.so" |
726 |
+ if [[ ! -x "${python_path_ext}" ]] ; then |
727 |
+ eerror "Couldn't find ${python_path_ext}! Bindings were requested with USE=python" |
728 |
+ eerror "but none were installed. This may happen if support for a Python target" |
729 |
+ eerror "(listed in PYTHON_COMPAT in the ebuild) is incomplete within the Makefiles." |
730 |
+ die "Incomplete installation of Python bindings! File a bug with Gentoo!" |
731 |
+ fi |
732 |
+ fi |
733 |
+ |
734 |
+ newtmpfiles "${FILESDIR}"/${PN}-vboxusb_tmpfilesd ${PN}-vboxusb.conf |
735 |
+} |
736 |
+ |
737 |
+pkg_postinst() { |
738 |
+ xdg_pkg_postinst |
739 |
+ |
740 |
+ if use udev ; then |
741 |
+ udevadm control --reload-rules |
742 |
+ udevadm trigger --subsystem-match=usb |
743 |
+ fi |
744 |
+ |
745 |
+ tmpfiles_process virtualbox-vboxusb.conf |
746 |
+ |
747 |
+ if ! use headless && use qt5 ; then |
748 |
+ elog "To launch VirtualBox just type: \"virtualbox\"." |
749 |
+ fi |
750 |
+ |
751 |
+ elog "You must be in the vboxusers group to use VirtualBox." |
752 |
+ elog "" |
753 |
+ elog "The latest user manual is available for download at:" |
754 |
+ elog "https://download.virtualbox.org/virtualbox/${DIR_PV:-${PV}}/UserManual.pdf" |
755 |
+ elog "" |
756 |
+ |
757 |
+ optfeature "Advanced networking setups" net-misc/bridge-utils sys-apps/usermode-utilities |
758 |
+ optfeature "USB2, USB3, PXE boot, and VRDP support" app-emulation/virtualbox-extpack-oracle |
759 |
+ optfeature "Guest additions ISO" app-emulation/virtualbox-additions |
760 |
+ |
761 |
+ if ! use udev ; then |
762 |
+ ewarn "Without USE=udev, USB devices will likely not work in ${PN}." |
763 |
+ fi |
764 |
+} |