commit:     ea8c412159e627831fb463ff7f969293abb6cefe
Author:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 20 10:04:17 2023 +0000
Commit:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
CommitDate: Sun Jan 22 09:55:03 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ea8c4121

app-emulation/virtualbox: enable py3.11

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

 .../files/virtualbox-6.1.42-python3_11.patch       | 81 ++++++++++++++++++++++
 app-emulation/virtualbox/virtualbox-6.1.42.ebuild  |  3 +-
 2 files changed, 83 insertions(+), 1 deletion(-)

diff --git a/app-emulation/virtualbox/files/virtualbox-6.1.42-python3_11.patch 
b/app-emulation/virtualbox/files/virtualbox-6.1.42-python3_11.patch
new file mode 100644
index 000000000000..1c3af9d8afef
--- /dev/null
+++ b/app-emulation/virtualbox/files/virtualbox-6.1.42-python3_11.patch
@@ -0,0 +1,81 @@
+Add Python 3.11 support to virtualbox 6.1
+
+--- a/src/libs/xpcom18a4/python/Makefile.kmk
++++ b/src/libs/xpcom18a4/python/Makefile.kmk
+@@ -26,7 +26,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|310|310M|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|311|311M|DEF]_[INC|LIB]
 variables
+ # which get picked up below.
+ #
+ ifeq ($(KBUILD_TARGET),darwin) # Relatively predictable, don't script.
+@@ -624,6 +624,52 @@
+   endif
+  endif
+ endif
++
++ifdef VBOX_PYTHON311_INC
++#
++# Python 3.11 version
++#
++DLLS += VBoxPython3_11
++VBoxPython3_11_EXTENDS    = VBoxPythonBase
++VBoxPython3_11_EXTENDS_BY = appending
++VBoxPython3_11_TEMPLATE   = XPCOM
++VBoxPython3_11_INCS       = $(VBOX_PYTHON311_INC)
++VBoxPython3_11_LIBS       = $(VBOX_PYTHON311_LIB)
++
++ ifdef VBOX_WITH_32_ON_64_MAIN_API
++  ifdef VBOX_PYTHON311_LIB_X86
++DLLS += VBoxPython3_11_x86
++VBoxPython3_11_x86_EXTENDS    = VBoxPythonBase_x86
++VBoxPython3_11_x86_EXTENDS_BY = appending
++VBoxPython3_11_x86_TEMPLATE   = XPCOM
++VBoxPython3_11_x86_INCS       = $(VBOX_PYTHON311_INC)
++VBoxPython3_11_x86_LIBS       = $(VBOX_PYTHON311_LIB_X86)
++  endif
++ endif
++endif
++
++ifdef VBOX_PYTHON311M_INC
++#
++# Python 3.11 version with pymalloc
++#
++DLLS += VBoxPython3_11m
++VBoxPython3_11m_EXTENDS    = VBoxPythonBase_m
++VBoxPython3_11m_EXTENDS_BY = appending
++VBoxPython3_11m_TEMPLATE   = XPCOM
++VBoxPython3_11m_INCS       = $(VBOX_PYTHON311M_INC)
++VBoxPython3_11m_LIBS       = $(VBOX_PYTHON311M_LIB)
++
++ ifdef VBOX_WITH_32_ON_64_MAIN_API
++  ifdef VBOX_PYTHON311M_LIB_X86
++DLLS += VBoxPython3_11m_x86
++VBoxPython3_11m_x86_EXTENDS    = VBoxPythonBase_x86_m
++VBoxPython3_11m_x86_EXTENDS_BY = appending
++VBoxPython3_11m_x86_TEMPLATE_  = XPCOM
++VBoxPython3_11m_x86_INCS       = $(VBOX_PYTHON311M_INC)
++VBoxPython3_11m_x86_LIBS       = $(VBOX_PYTHON311M_LIB_X86)
++  endif
++ endif
++endif
+ 
+ ifdef VBOX_PYTHONDEF_INC
+ #
+--- 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 >= 0x030a0000 && PY_VERSION_HEX < 0x030b0000
++#  if   PY_VERSION_HEX >= 0x030b0000 && PY_VERSION_HEX < 0x030c0000
++#   define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython3_11")
++#   define initVBoxPython MANGLE_MODULE_INIT(PyInit_VBoxPython3_11)
++
++#  elif   PY_VERSION_HEX >= 0x030a0000 && PY_VERSION_HEX < 0x030b0000
+ #   define MODULE_NAME    MANGLE_MODULE_NAME("VBoxPython3_10")
+ #   define initVBoxPython MANGLE_MODULE_INIT(PyInit_VBoxPython3_10)
+ 

diff --git a/app-emulation/virtualbox/virtualbox-6.1.42.ebuild 
b/app-emulation/virtualbox/virtualbox-6.1.42.ebuild
index 84c0abf767f9..0b6b25b3dcc0 100644
--- a/app-emulation/virtualbox/virtualbox-6.1.42.ebuild
+++ b/app-emulation/virtualbox/virtualbox-6.1.42.ebuild
@@ -15,7 +15,7 @@ EAPI=8
 #  trunk branch but not release branch.
 #
 #  See bug #785835, bug #856121.
-PYTHON_COMPAT=( python3_{9..10} )
+PYTHON_COMPAT=( python3_{9..11} )
 
 inherit desktop edo flag-o-matic java-pkg-opt-2 linux-info multilib optfeature 
pax-utils \
        python-single-r1 tmpfiles toolchain-funcs udev xdg
@@ -173,6 +173,7 @@ PATCHES=(
        # (see the rest of the ebuild's logic for the remainder) to handle
        # proper Python selection.
        "${FILESDIR}"/${PN}-6.1.34-r3-python.patch
+       "${FILESDIR}"/${PN}-6.1.42-python3_11.patch
 
        # 865361
        "${FILESDIR}"/${PN}-6.1.36-fcf-protection.patch

Reply via email to