commit:     9670bfc86462af15a9d05b170b72ad68168b2580
Author:     Ian Stakenvicius <axs <AT> gentoo <DOT> org>
AuthorDate: Tue May  3 20:03:45 2016 +0000
Commit:     Ian Stakenvicius <axs <AT> gentoo <DOT> org>
CommitDate: Tue May  3 20:27:54 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9670bfc8

x11-drivers/xf86-video-virtualbox-5.0.20: build kernel module with help of 
upstream Makefiles.

This commit builds on the prior work of Polynomial-C to compile vboxvideo.ko
using the upstream Makefile.module.kms.  A small patch is necessary to add a 
missing
include path to the build, and the rest of the changes are the addition of 
necessary
symlinks to allow the build to proceed.

Package-Manager: portage-2.2.26

 ...deo-virtualbox-5.0.20-Makefile.module.kms.patch | 11 +++++
 .../xf86-video-virtualbox-5.0.20.ebuild            | 51 +++++++++++-----------
 2 files changed, 37 insertions(+), 25 deletions(-)

diff --git 
a/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-5.0.20-Makefile.module.kms.patch
 
b/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-5.0.20-Makefile.module.kms.patch
new file mode 100644
index 0000000..dd05a4a
--- /dev/null
+++ 
b/x11-drivers/xf86-video-virtualbox/files/xf86-video-virtualbox-5.0.20-Makefile.module.kms.patch
@@ -0,0 +1,11 @@
+--- a/src/VBox/Additions/linux/drm/Makefile.module.kms 2016-04-28 
09:08:06.000000000 -0400
++++ b/src/VBox/Additions/linux/drm/Makefile.module.kms 2016-05-03 
15:11:22.134971872 -0400
+@@ -38,7 +38,7 @@
+  MANGLING := $(KBUILD_EXTMOD)/include/VBox/VBoxGuestMangling.h
+ endif
+ MOD_CFLAGS = -Wno-declaration-after-statement -fshort-wchar -include 
$(MANGLING)
+-MOD_INCL   = $(addprefix -I$(KBUILD_EXTMOD),/ /include)
++MOD_INCL   = $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux)
+ # What on earth is this?
+ MOD_INCL  += $(addprefix -I$(KBUILD_EXTMOD)/vboxvideo,/ /include)
+ MOD_INCL  += -Iinclude/drm

diff --git 
a/x11-drivers/xf86-video-virtualbox/xf86-video-virtualbox-5.0.20.ebuild 
b/x11-drivers/xf86-video-virtualbox/xf86-video-virtualbox-5.0.20.ebuild
index 24d85e9..5dbf6db 100644
--- a/x11-drivers/xf86-video-virtualbox/xf86-video-virtualbox-5.0.20.ebuild
+++ b/x11-drivers/xf86-video-virtualbox/xf86-video-virtualbox-5.0.20.ebuild
@@ -73,14 +73,19 @@ pkg_setup() {
 }
 
 src_prepare() {
-       # Prepare the vboxvideo_drm Makefiles
-       #cp "${FILESDIR}/Makefile.inc" "${MODULES_SRC_DIR}" || die
-       ln -s Makefile.module.kms "${MODULES_SRC_DIR}/Makefile" || die
-       #sed '/^include.*header/ainclude $(obj)/Makefile.inc' \
-       #       -i "${MODULES_SRC_DIR}/Makefile.module.kms" || die
-       for incfile in Makefile.include.{head,foot}er ; do
-               ln -s "${S}/src/VBox/Installer/linux/${incfile}" \
-                       "${MODULES_SRC_DIR}/${incfile}" || die
+       # Prepare the vboxvideo_drm Makefiles and build dir
+       eapply "${FILESDIR}"/${P}-Makefile.module.kms.patch
+       ln -sf Makefile.module.kms "${MODULES_SRC_DIR}"/Makefile || die
+       # All of these are expected to be in $(KBUILD_EXTMOD)/ so symlink them 
into place
+       local incfile incfiles=(
+               include
+               src/VBox/Runtime/r0drv
+               src/VBox/Installer/linux/Makefile.include.{head,foot}er
+               out/linux.${ARCH}/release/{product,version,revision}-generated.h
+       )
+       for incfile in ${incfiles[@]} ; do
+               ln -sf "${S}"/${incfile} \
+                       "${MODULES_SRC_DIR}"/${incfile##*/} || die
        done
 
        # Remove shipped binaries (kBuild,yasm), see bug #232775
@@ -118,18 +123,14 @@ src_configure() {
 }
 
 src_compile() {
-       local targets=()
-
-       targets=(
+       local each targets=(
                Runtime
                Additions/common/VBoxGuestLib
                GuestHost/OpenGL
                Additions/x11/x11stubs
                Additions/common/crOpenGL
                Additions/x11/vboxvideo
-               #Additions/linux/drm
        )
-
        for each in ${targets[@]} ; do
                pushd "${S}"/src/VBox/${each} $>/dev/null || die
                MAKE="kmk" \
@@ -142,18 +143,18 @@ src_compile() {
 
        if use dri ; then
                local 
objdir="out/linux.${ARCH}/release/obj/vboxvideo_drv_system/src/VBox"
-               ln -s "${S}"/${objdir}/Additions/common/VBoxVideo/HGSMIBase.o \
-                       ${MODULES_SRC_DIR} || die
-               ln -s "${S}"/${objdir}/GuestHost/HGSMI/HGSMICommon.o \
-                       ${MODULES_SRC_DIR} || die
-               ln -s "${S}"/${objdir}/GuestHost/HGSMI/HGSMIMemAlloc.o \
-                       ${MODULES_SRC_DIR} || die
-               ln -s "${S}"/${objdir}/Runtime/common/alloc/heapoffset.o \
-                       ${MODULES_SRC_DIR} || die
-               ln -s "${S}"/${objdir}/Additions/common/VBoxVideo/Modesetting.o 
\
-                       ${MODULES_SRC_DIR} || die
-               ln -s "${S}"/${objdir}/Additions/common/VBoxVideo/VBVABase.o \
-                       ${MODULES_SRC_DIR} || die
+               # see the vboxvideo_drm_SOURCES list in Makefile.kmk for the 
below
+               targets=(
+                       Additions/common/VBoxVideo/HGSMIBase.o
+                       Additions/common/VBoxVideo/Modesetting.o
+                       Additions/common/VBoxVideo/VBVABase.o
+                       GuestHost/HGSMI/HGSMICommon.o
+                       GuestHost/HGSMI/HGSMIMemAlloc.o
+                       Runtime/common/alloc/heapoffset.o
+               )
+               for each in ${targets[@]} ; do
+                       ln -sf "${S}"/${objdir}/${each} 
"${MODULES_SRC_DIR}"/${each##*/} || die
+               done
 
                # Now creating the kernel modules. We must do this _after_
                # we compiled the user-space tools as we need two of the

Reply via email to