From 1a528fb606a0a5eb772fe615688a4986ff4d5a44 Mon Sep 17 00:00:00 2001 From: Viorel Munteanu Date: Sat, 10 Feb 2024 10:09:31 +0200 Subject: Move patches from ${FILESDIR} to the patchset Move patches to the patchset to be able to share them between packages. Signed-off-by: Viorel Munteanu --- ...tualbox-6.1.26-configure-include-qt5-path.patch | 15 ++ patches/016_virtualbox-6.1.34-r3-python.patch | 18 +++ patches/017_virtualbox-6.1.36-fcf-protection.patch | 16 ++ ...18_virtualbox-7.0.0-fix-compilation-clang.patch | 44 ++++++ ...9_virtualbox-7.0.10-fix-binutils-hardened.patch | 35 +++++ patches/020_virtualbox-7.0.10-python.patch | 18 +++ patches/021_virtualbox-7.0.14-libxml2-2.12.patch | 43 ++++++ patches/022_virtualbox-7.0.6-fix-libxml2.patch | 169 +++++++++++++++++++++ patches/023_virtualbox-7.0.6-gcc-13.patch | 28 ++++ patches/024_virtualbox-7.0.8-mtune-keep-size.patch | 13 ++ 10 files changed, 399 insertions(+) create mode 100644 patches/015_virtualbox-6.1.26-configure-include-qt5-path.patch create mode 100644 patches/016_virtualbox-6.1.34-r3-python.patch create mode 100644 patches/017_virtualbox-6.1.36-fcf-protection.patch create mode 100644 patches/018_virtualbox-7.0.0-fix-compilation-clang.patch create mode 100644 patches/019_virtualbox-7.0.10-fix-binutils-hardened.patch create mode 100644 patches/020_virtualbox-7.0.10-python.patch create mode 100644 patches/021_virtualbox-7.0.14-libxml2-2.12.patch create mode 100644 patches/022_virtualbox-7.0.6-fix-libxml2.patch create mode 100644 patches/023_virtualbox-7.0.6-gcc-13.patch create mode 100644 patches/024_virtualbox-7.0.8-mtune-keep-size.patch diff --git a/patches/015_virtualbox-6.1.26-configure-include-qt5-path.patch b/patches/015_virtualbox-6.1.26-configure-include-qt5-path.patch new file mode 100644 index 0000000..57752c4 --- /dev/null +++ b/patches/015_virtualbox-6.1.26-configure-include-qt5-path.patch @@ -0,0 +1,15 @@ +https://www.virtualbox.org/changeset/90377/vbox +https://bugs.gentoo.org/805350 +https://bugs.gentoo.org/805365 + +--- VirtualBox-6.1.26/configure ++++ VirtualBox-6.1.26/configure +@@ -1624,6 +1624,8 @@ EOF + else + # Strip .../QtCore as we add components ourself: + INCQT5=`echo "$INCQT5"|$KBUILD_SED 's|\([^ ]*\)/QtCore|\1|g; s| $||g'` ++ # Strip .../QtGui as we add components ourself: ++ INCQT5=`echo "$INCQT5"|$KBUILD_SED 's|\([^ ]*\)/QtGui|\1|g; s| $||g'` + # store only the first path, remove all other paths + # most likely pkg-config gave us -I/usr/include/qt5 -I/usr/include/qt5/QtCore + INCQT5=`echo "$INCQT5"|$KBUILD_SED 's|\([^ ]*\) .*|\1|'` diff --git a/patches/016_virtualbox-6.1.34-r3-python.patch b/patches/016_virtualbox-6.1.34-r3-python.patch new file mode 100644 index 0000000..0f5c967 --- /dev/null +++ b/patches/016_virtualbox-6.1.34-r3-python.patch @@ -0,0 +1,18 @@ +# 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. +diff --git a/configure b/configure +index fd2e296..695f6a7 100755 +--- a/configure ++++ b/configure +@@ -1987,6 +1987,9 @@ check_python() + { + test_header "Python support" + ++ # We force the right implementation in the ebuild instead ++ return ++ + # On darwin this is a on/off decision only + if [ "$OS" = "darwin" ]; then + echo "enabled" diff --git a/patches/017_virtualbox-6.1.36-fcf-protection.patch b/patches/017_virtualbox-6.1.36-fcf-protection.patch new file mode 100644 index 0000000..14b11f7 --- /dev/null +++ b/patches/017_virtualbox-6.1.36-fcf-protection.patch @@ -0,0 +1,16 @@ +Bug https://bugs.gentoo.org/865361 + +gcc does not support -fcf-protection for i386 (needs i686+), +so disable it when building iPxeBaseBin. + +--- a/src/VBox/Devices/PC/ipxe/Makefile.kmk ++++ b/src/VBox/Devices/PC/ipxe/Makefile.kmk +@@ -176,6 +177,8 @@ + + iPxeBaseBin_TEMPLATE = iPxe + ++ iPxeBaseBin_CFLAGS = -fcf-protection=none ++ + iPxeBaseBin_INCS = \ + src \ + src/include \ diff --git a/patches/018_virtualbox-7.0.0-fix-compilation-clang.patch b/patches/018_virtualbox-7.0.0-fix-compilation-clang.patch new file mode 100644 index 0000000..c3e34f8 --- /dev/null +++ b/patches/018_virtualbox-7.0.0-fix-compilation-clang.patch @@ -0,0 +1,44 @@ +clang does not have syslimits.h, it is gcc specific +and it is useless anyway since is already included +so just remove it + +Cannot use PFNRT here on clang because of the exception specification + +--- a/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceLibCWrappers.h ++++ b/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceLibCWrappers.h +@@ -34,8 +34,6 @@ + # include /* Workaround for syslimit.h bug in gcc 4.8.3 on gentoo. */ + # ifdef RT_OS_DARWIN + # include /* PATH_MAX */ +-# elif !defined(RT_OS_SOLARIS) && !defined(RT_OS_FREEBSD) +-# include /* PATH_MAX */ + # endif + # include /* basename */ + # include +--- a/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.h ++++ b/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.h +@@ -97,7 +97,11 @@ + /** Load OpenGL library and initialize function pointers. */ + int glLdrInit(PPDMDEVINS pDevIns); + /** Resolve an OpenGL function name. */ ++#ifdef __clang__ ++void* glLdrGetProcAddress(const char *pszSymbol); ++#else // !__clang__ + PFNRT glLdrGetProcAddress(const char *pszSymbol); ++#endif // !__clang__ + /** Get pointers to extension function. They are available on Windows only when OpenGL context is set. */ + int glLdrGetExtFunctions(PPDMDEVINS pDevIns); + +--- a/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.cpp ++++ b/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.cpp +@@ -35,6 +35,10 @@ + #include + #include + ++#ifdef __clang__ ++# define PFNRT void* ++#endif ++ + #ifdef RT_OS_WINDOWS + # define OGLGETPROCADDRESS MyWinGetProcAddress + DECLINLINE(PFNRT) MyWinGetProcAddress(const char *pszSymbol) diff --git a/patches/019_virtualbox-7.0.10-fix-binutils-hardened.patch b/patches/019_virtualbox-7.0.10-fix-binutils-hardened.patch new file mode 100644 index 0000000..1a5f85f --- /dev/null +++ b/patches/019_virtualbox-7.0.10-fix-binutils-hardened.patch @@ -0,0 +1,35 @@ +Fix building with sys-devel/binutils-2.41-r1[hardened]: read-only segment has dynamic relocations. +https://bugs.gentoo.org/913109 + +--- a/src/VBox/Runtime/Makefile.kmk ++++ b/src/VBox/Runtime/Makefile.kmk +@@ -3238,6 +3238,7 @@ + endif + endif + RuntimeR0_INCS = include ++RuntimeR0_LDFLAGS.linux = -z notext + RuntimeR0_SOURCES := \ + $(if $(VBOX_ONLY_VALIDATIONKIT),,../VMM/VBoxVMM.d) \ + common/checksum/crc32c.cpp \ +--- a/src/VBox/VMM/Makefile.kmk ++++ b/src/VBox/VMM/Makefile.kmk +@@ -603,6 +603,8 @@ + VMMR0_DEFS.darwin.amd64 += VBOX_WITH_NATIVE_NEM VBOX_WITH_NEM_R0 + endif + ++ VMMR0_LDFLAGS.linux += -z notext ++ + $(call VBOX_SET_VER_INFO_R0,VMMR0,VirtualBox VMM - ring-0 context parts) # Version info / description. + + if "$(USERNAME)" == "bird" && "$(KBUILD_TARGET)" == "win" +--- a/src/VBox/ExtPacks/VBoxDTrace/Makefile.kmk ++++ b/src/VBox/ExtPacks/VBoxDTrace/Makefile.kmk +@@ -258,7 +258,7 @@ + VBoxDTraceR0_TEMPLATE = VBoxR0ExtPackDTrace + VBoxDTraceR0_DEFS = IN_VBOXDTRACE_R0 IN_RT_R0 + ifeq ($(VBOX_LDR_FMT),elf) +- VBoxDTraceR0_LDFLAGS = -e ModuleInit ++ VBoxDTraceR0_LDFLAGS = -e ModuleInit -z notext + endif + VBoxDTraceR0_INCS = \ + include \ diff --git a/patches/020_virtualbox-7.0.10-python.patch b/patches/020_virtualbox-7.0.10-python.patch new file mode 100644 index 0000000..f972580 --- /dev/null +++ b/patches/020_virtualbox-7.0.10-python.patch @@ -0,0 +1,18 @@ +Virtualbox 7.x will only build a lib named VBoxPython3.so, regardless of the +actual python version used when compiling. Remove VBoxPython3m.so, we don't +use it. + +--- a/src/libs/xpcom18a4/python/Makefile.kmk ++++ b/src/libs/xpcom18a4/python/Makefile.kmk +@@ -693,11 +693,6 @@ + VBoxPython3_EXTENDS = VBoxPythonBase + VBoxPython3_DEFS = $(filter-out VBOX_PYXPCOM_VERSIONED,$(VBoxPythonBase_DEFS)) Py_LIMITED_API=0x03030000 + VBoxPython3_INCS = $(VBoxPythonBase_INCS) $(VBOX_PYTHON$(VBOX_PYTHON_LIMITED_API_VER)_INC) +- +- DLLS += VBoxPython3m +- VBoxPython3m_EXTENDS = VBoxPythonBase_m +- VBoxPython3m_DEFS = $(filter-out VBOX_PYXPCOM_VERSIONED,$(VBoxPythonBase_m_DEFS)) Py_LIMITED_API=0x03030000 +- VBoxPython3m_INCS = $(VBoxPythonBase_m_INCS) $(VBOX_PYTHON$(VBOX_PYTHON_LIMITED_API_VER)_INC) + endif + endif # VBOX_WITH_PYTHON_LIMITED_API + diff --git a/patches/021_virtualbox-7.0.14-libxml2-2.12.patch b/patches/021_virtualbox-7.0.14-libxml2-2.12.patch new file mode 100644 index 0000000..a523bad --- /dev/null +++ b/patches/021_virtualbox-7.0.14-libxml2-2.12.patch @@ -0,0 +1,43 @@ +Bug: https://bugs.gentoo.org/922445 + +The change in libxml2 is not backwards compatibe. +A patch like the one in arch does not work with 2.11, so just cast the argument to maintain compatibility with both. + +The upstream change is in include/libxml/xmlerror.h: + + typedef xmlError *xmlErrorPtr; + +-typedef void (*xmlStructuredErrorFunc) (void *userData, xmlErrorPtr error); ++typedef void (*xmlStructuredErrorFunc) (void *userData, const xmlError *error); + +See also: https://gitlab.archlinux.org/archlinux/packaging/packages/virtualbox/-/blob/main/019-libxml-2-12.patch?ref_type=heads + +--- a/src/VBox/Runtime/r3/xml.cpp ++++ b/src/VBox/Runtime/r3/xml.cpp +@@ -1870,7 +1870,7 @@ + throw std::bad_alloc(); + /* per-thread so it must be here */ + xmlSetGenericErrorFunc(NULL, xmlParserBaseGenericError); +- xmlSetStructuredErrorFunc(NULL, xmlParserBaseStructuredError); ++ xmlSetStructuredErrorFunc(NULL, (xmlStructuredErrorFunc)xmlParserBaseStructuredError); + } + + XmlParserBase::~XmlParserBase() +@@ -1931,7 +1931,7 @@ + pcszFilename, + NULL, // encoding = auto + options))) +- throw XmlError(xmlCtxtGetLastError(m_ctxt)); ++ throw XmlError((xmlErrorPtr)xmlCtxtGetLastError(m_ctxt)); + + doc.refreshInternals(); + } +@@ -2191,7 +2191,7 @@ + pcszFilename, + NULL, // encoding = auto + options))) +- throw XmlError(xmlCtxtGetLastError(m_ctxt)); ++ throw XmlError((xmlErrorPtr)xmlCtxtGetLastError(m_ctxt)); + + doc.refreshInternals(); + } diff --git a/patches/022_virtualbox-7.0.6-fix-libxml2.patch b/patches/022_virtualbox-7.0.6-fix-libxml2.patch new file mode 100644 index 0000000..9da2891 --- /dev/null +++ b/patches/022_virtualbox-7.0.6-fix-libxml2.patch @@ -0,0 +1,169 @@ +With dev-libs/libxml2-2.11, xi:include errors out if it can't find a file, so add an empty fallback. +Used to work with dev-libs/libxml2-2.10. + +Upstream has removed user_ and overview_ altogether in the next release as part of a larger docs change, +so this no longer applies. + +See also: https://bugs.gentoo.org/906309 + +--- a/doc/manual/en_US/user_VBoxManage.xml ++++ b/doc/manual/en_US/user_VBoxManage.xml +@@ -242,107 +242,107 @@ + on your particular host. + + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + +- ++ + + + Each time VBoxManage is invoked, only one diff --git a/patches/023_virtualbox-7.0.6-gcc-13.patch b/patches/023_virtualbox-7.0.6-gcc-13.patch new file mode 100644 index 0000000..ed3a2d0 --- /dev/null +++ b/patches/023_virtualbox-7.0.6-gcc-13.patch @@ -0,0 +1,28 @@ +Add a few missing includes. + +Bug: https://bugs.gentoo.org/892852 + +--- a/src/libs/dxvk-native-1.9.2a/src/util/util_matrix.cpp ++++ b/src/libs/dxvk-native-1.9.2a/src/util/util_matrix.cpp +@@ -1,3 +1,4 @@ ++#include + #include "util_matrix.h" + + namespace dxvk { +@@ -229,4 +230,4 @@ + return os; + } + +-} +\ No newline at end of file ++} +--- a/src/libs/dxvk-native-1.9.2a/src/util/util_vector.h ++++ b/src/libs/dxvk-native-1.9.2a/src/util/util_vector.h +@@ -1,6 +1,7 @@ + #pragma once + + #include ++#include + + #include "util_bit.h" + #include "util_math.h" diff --git a/patches/024_virtualbox-7.0.8-mtune-keep-size.patch b/patches/024_virtualbox-7.0.8-mtune-keep-size.patch new file mode 100644 index 0000000..e37d9d6 --- /dev/null +++ b/patches/024_virtualbox-7.0.8-mtune-keep-size.patch @@ -0,0 +1,13 @@ +Force -mtune=i386. Random -mtune can lead to iPxeBiosBin.rom getting too +large (larger than 56k). This can happen because we support custom CFLAGS. + +--- a/src/VBox/Devices/PC/ipxe/Makefile.kmk ++++ b/src/VBox/Devices/PC/ipxe/Makefile.kmk +@@ -125,6 +125,7 @@ + -ffreestanding \ + -ffunction-sections \ + -march=i386 \ ++ -mtune=i386 \ + -fomit-frame-pointer \ + -fstrength-reduce \ + -falign-jumps=1 \ -- cgit v1.2.3-65-gdbad