Subject: [alpine-aports] [PATCH 1/2] testing/virtualbox-guest-additions: new aport

From: Ben Allen <[email-masked]>
Date: Sat, 16 Jan 2016 09:02:52 +0000

- Userland components to VirtualBox's guest additions, eg. VBoxService, VBoxControl, mount.vboxsf, and a basic init script.
- Creates vboxsf group on install to allow VBoxService to auto-mount shared folders.
---
 testing/virtualbox-guest-additions/APKBUILD        | 99 ++++++++++++++++++++++
 testing/virtualbox-guest-additions/futimens.patch  | 16 ++++
 .../musl-fix-headers.patch                         | 10 +++
 .../musl-fix-stat-nsec.patch                       | 11 +++
 .../virtualbox-guest-additions/musl-no-glibc.patch | 45 ++++++++++
 .../musl-sched_yield.patch                         | 32 +++++++
 .../uclibc-gnu_linux.patch                         | 11 +++
 .../virtualbox-guest-additions/uclibc-spawn.patch  | 26 ++++++
 .../vboxguestlib-makefile-nox11.patch              | 19 +++++
 .../virtualbox-guest-additions-localconfig         | 37 ++++++++
 .../virtualbox-guest-additions.initd               | 25 ++++++
 .../virtualbox-guest-additions.pre-install         |  5 ++
 12 files changed, 336 insertions(+)
 create mode 100644 testing/virtualbox-guest-additions/APKBUILD
 create mode 100644 testing/virtualbox-guest-additions/futimens.patch
 create mode 100644 testing/virtualbox-guest-additions/musl-fix-headers.patch
 create mode 100644 testing/virtualbox-guest-additions/musl-fix-stat-nsec.patch
 create mode 100644 testing/virtualbox-guest-additions/musl-no-glibc.patch
 create mode 100644 testing/virtualbox-guest-additions/musl-sched_yield.patch
 create mode 100644 testing/virtualbox-guest-additions/uclibc-gnu_linux.patch
 create mode 100644 testing/virtualbox-guest-additions/uclibc-spawn.patch
 create mode 100644 testing/virtualbox-guest-additions/vboxguestlib-makefile-nox11.patch
 create mode 100644 testing/virtualbox-guest-additions/virtualbox-guest-additions-localconfig
 create mode 100644 testing/virtualbox-guest-additions/virtualbox-guest-additions.initd
 create mode 100644 testing/virtualbox-guest-additions/virtualbox-guest-additions.pre-install

diff --git a/testing/virtualbox-guest-additions/APKBUILD b/testing/virtualbox-guest-additions/APKBUILD
new file mode 100644
index 0000000..79fb9dd
--- /dev/null
+++ b/testing/virtualbox-guest-additions/APKBUILD
@@ -0,0 +1,99 @@
+# Maintainer: 
+# Contributor: Ben Allen <[email-masked]>
+
+_flavor=${FLAVOR:-grsec}
+
+pkgname=virtualbox-guest-additions
+pkgver=5.0.12
+
+pkgrel=0
+pkgdesc="VirtualBox Addtions userland components"
+arch='x86_64'
+url='http://virtualbox.org'
+license="GPL custom"
+install="$pkgname.pre-install"
+makedepends="sed kbuild lvm2-dev yasm zlib-dev openssl-dev curl-dev"
+depends="virtualbox-guest-modules-$_flavor"
+source="http://download.virtualbox.org/virtualbox/$pkgver/VirtualBox-$pkgver.tar.bz2
+	futimens.patch 
+	musl-fix-headers.patch
+	musl-no-glibc.patch
+	musl-fix-stat-nsec.patch
+	musl-sched_yield.patch
+	uclibc-gnu_linux.patch
+	vboxguestlib-makefile-nox11.patch
+	virtualbox-guest-additions-localconfig
+	$pkgname.pre-install
+	$pkgname.initd
+	"
+
+_builddir="$srcdir"/VirtualBox-$pkgver
+
+prepare() {
+	cd "$_builddir"
+	rm -rf $_builddir/kBuild/bin $_builddir/tools
+	local i
+	for i in $source; do
+		case $i in
+		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+		esac
+	done
+	cp $srcdir/$pkgname-localconfig LocalConfig.kmk
+}
+
+build() {
+	cd "$_builddir"
+	./configure --nofatal \
+		--disable-dbus \
+		--disable-xpcom \
+		--disable-sdl-ttf \
+		--disable-pulse \
+		--disable-alsa \
+		--disable-kmods \
+		--build-headless
+	source env.sh
+	# Build Guest Additions
+	kmk KBUILD_VERBOSE=2
+}
+
+package() {
+	cd "$_builddir"
+	install -v -Dm755 "$_builddir/out/linux.amd64/release/bin/additions/VBoxService" "$pkgdir/usr/sbin/VBoxService"
+	install -v -Dm755 "$_builddir/out/linux.amd64/release/bin/additions/VBoxControl" "$pkgdir/usr/bin/VBoxControl"
+	install -v -Dm755 "$_builddir/out/linux.amd64/release/bin/additions/mount.vboxsf" "$pkgdir/usr/sbin/mount.vboxsf"
+        install -v -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+}
+
+md5sums="5912835882ef547e0559c7e73bc85828  VirtualBox-5.0.12.tar.bz2
+10f65154d3ff17d88fad5ed384e20276  futimens.patch
+81a2ebe27e166219a03858f87eb57518  musl-fix-headers.patch
+2d8119cc2bb88a1dc8e1bcd2a6abf36e  musl-no-glibc.patch
+9b6a45f250956232f33911ea26d1355e  musl-fix-stat-nsec.patch
+00f38b765810aaa7f8c652ca81106126  musl-sched_yield.patch
+072ee2114b3771e7bdbff5211f342755  uclibc-gnu_linux.patch
+b5e6069e20db86cb2e00f1431b202ca4  vboxguestlib-makefile-nox11.patch
+8a6525395f4791b8261f245be1eec552  virtualbox-guest-additions-localconfig
+2e276bee246aee6f7cd43d509288dd07  virtualbox-guest-additions.pre-install
+867c31d95544f25deb3dfbac038d4cb0  virtualbox-guest-additions.initd"
+sha256sums="de0362b1d404d1ca0298db1984acb6f0f1c6210313aeb744fea345ad9201e86e  VirtualBox-5.0.12.tar.bz2
+deaa739129ec23a05d5aa43ad8af3e93086ca340696fde3e5d1539e1c7347adb  futimens.patch
+d5085e8921b5fa7dca26d2a8da6d1174f7971491c356b6bea5126e6dda0d863c  musl-fix-headers.patch
+d0bc2e84675741a54b42b59c9746f255799264512b11a565ce3d435f1398a874  musl-no-glibc.patch
+aab58b5dd854551c52063876e8b4186892ba0b3cf9d907c3abe9cff93b8be7fc  musl-fix-stat-nsec.patch
+a7cb381cdf405d25112fd245e7cdb6728a87361896ce545be3cb8e2d234e4d9d  musl-sched_yield.patch
+1bf547f849bf325e443f74ce7fbfb3657d9b2918b4c888efac304eac929a0fae  uclibc-gnu_linux.patch
+19d156225f205245abeca94aac72b90d6dec2d830b4fb30b6c6ce790011e97ac  vboxguestlib-makefile-nox11.patch
+555a92cc4741419f7ffd6b9698600b85dc14ddfc6fed6df792d13caf7116e2af  virtualbox-guest-additions-localconfig
+e0dc53e014bc3ae12b1ed788aa9c3f3f14fe3e4826de814d881b35bd6062e0f4  virtualbox-guest-additions.pre-install
+f1c39ecf58e6dc8162066adbda6d5cec5a5fe4f5f1f6003b6201269b3f52f456  virtualbox-guest-additions.initd"
+sha512sums="eef01d1a5121905d2fbfcd48081f18db06433187bfbfea6a006b3adea11cad8c8351025fd19fa115c132231592330b17bfeba033a3a168f3064176a3f7586d7a  VirtualBox-5.0.12.tar.bz2
+1da850bc30399ecde501eba5403ef1add1ae108d38394b01cd7f5cdf0462b855793d564d3adc1f770983b36529d77f3f7b0269fb65152468084a0a44c38e1638  futimens.patch
+0169a620d62aa3de8124e0084f4b747b602fbdcab7892fe075606459e0200d412321c86da4c5d98309f4d7479ae1b5267ed28bea6c6e64fd8be88cab74f8e94c  musl-fix-headers.patch
+b1c47cb910ac751df7bd4bc10c5501e91d88a9b3e4fe181b02755d433df8e89a160a38422912266f0cc51ba0c09854dad513ba6f2634fc76c59cee7989b259eb  musl-no-glibc.patch
+2c329085915f0ffa43828a14d8b29d0d876e48e18a0190ad146cd0731af7eca11cdf41d2e533c9cc73aa75506b9b91e3a08f2272cd8884e0d929722730b99862  musl-fix-stat-nsec.patch
+31cd99ccb5e609ec598d78f0402a5c6522731ce3e84e52c4318441acdc27d3537abfcb2ab136bf8de1f614a1c81bff1200fbed986daebd5d30b8590d115c4edb  musl-sched_yield.patch
+d2bba9de80c40bc258b025a8e3395a4b0b7781d70d5528993f0fff57e9fc015306b483d4da14e22aed3f188ffda8685aa51e13943f48c17ae18a2a66d15d7bbb  uclibc-gnu_linux.patch
+0ced8df03a354e211fd0631d3971246d75de3a60c2347b5fe33236405d55911422d53eb7c679ae6fc18dc8f57c245d5701fa02ae740d1f0bd1e1cbb0b715bf2f  vboxguestlib-makefile-nox11.patch
+1b14e0239e91d2d1515250272eb485b442d785dac98bdd7b1cca2fad123f853fe138b6cfad2566c8cb35cab3b77151a49a9422fbad3c13489fa12f3f43d550b9  virtualbox-guest-additions-localconfig
+a7b6fb6095fde7dc4390aef94ba665343fbd18e694b52d1e9d519571ed3e69b8d870c691eb26155f672ac9766a796aa217e7823e174b1dcc6feb1ae286a222a3  virtualbox-guest-additions.pre-install
+fba476784d6660333c97b443eadb3d426ffc6fa39cdf0df79a82f3039c6a45b7c3203a4870c09f44aa5c4cf3e32eb495281a7b14e325fdea077a2268b59af827  virtualbox-guest-additions.initd"
diff --git a/testing/virtualbox-guest-additions/futimens.patch b/testing/virtualbox-guest-additions/futimens.patch
new file mode 100644
index 0000000..f85e1ae
--- /dev/null
+++ b/testing/virtualbox-guest-additions/futimens.patch
@@ -0,0 +1,16 @@
+--- ./src/VBox/Runtime/r3/posix/fileio2-posix.cpp.orig
++++ ./src/VBox/Runtime/r3/posix/fileio2-posix.cpp
+@@ -165,7 +165,12 @@
+ 
+     /* XXX this falls back to utimes("/proc/self/fd/...",...) for older kernels/glibcs and this
+      * will not work for hardened builds where this directory is owned by root.root and mode 0500 */
+-    if (futimes(RTFileToNative(hFile), aTimevals))
++    struct timespec aTimespecs[2] = {
++    	{ aTimevals[0].tv_sec, aTimevals[0].tv_usec * 1000 },
++    	{ aTimevals[1].tv_sec, aTimevals[1].tv_usec * 1000 },
++    };
++
++    if (futimens(RTFileToNative(hFile), aTimespecs))
+     {
+         int rc = RTErrConvertFromErrno(errno);
+         Log(("RTFileSetTimes(%RTfile,%p,%p,,): returns %Rrc\n", hFile, pAccessTime, pModificationTime, rc));
diff --git a/testing/virtualbox-guest-additions/musl-fix-headers.patch b/testing/virtualbox-guest-additions/musl-fix-headers.patch
new file mode 100644
index 0000000..8eaa63c
--- /dev/null
+++ b/testing/virtualbox-guest-additions/musl-fix-headers.patch
@@ -0,0 +1,10 @@
+--- ./src/VBox/Runtime/r3/linux/sysfs.cpp.orig
++++ ./src/VBox/Runtime/r3/linux/sysfs.cpp
+@@ -40,7 +40,6 @@
+ 
+ #include <unistd.h>
+ #include <stdio.h>
+-#include <sys/sysctl.h>
+ #include <sys/stat.h>
+ #include <sys/fcntl.h>
+ #include <errno.h>
diff --git a/testing/virtualbox-guest-additions/musl-fix-stat-nsec.patch b/testing/virtualbox-guest-additions/musl-fix-stat-nsec.patch
new file mode 100644
index 0000000..d0d073e
--- /dev/null
+++ b/testing/virtualbox-guest-additions/musl-fix-stat-nsec.patch
@@ -0,0 +1,11 @@
+--- VirtualBox-5.0.12/src/VBox/Runtime/include/internal/fs.h.orig
++++ VirtualBox-5.0.12/src/VBox/Runtime/include/internal/fs.h
+@@ -49,8 +49,6 @@
+ #ifdef RT_OS_LINUX
+ # ifdef __USE_MISC
+ #  define HAVE_STAT_TIMESPEC_BRIEF
+-# else
+-#  define HAVE_STAT_NSEC
+ # endif
+ #endif
+ 
diff --git a/testing/virtualbox-guest-additions/musl-no-glibc.patch b/testing/virtualbox-guest-additions/musl-no-glibc.patch
new file mode 100644
index 0000000..fe4cc79
--- /dev/null
+++ b/testing/virtualbox-guest-additions/musl-no-glibc.patch
@@ -0,0 +1,45 @@
+--- ./src/VBox/Runtime/r3/linux/thread-affinity-linux.cpp.orig
++++ ./src/VBox/Runtime/r3/linux/thread-affinity-linux.cpp
+@@ -32,6 +32,8 @@
+ # define _GNU_SOURCE
+ #endif
+ #include <features.h>
++
++#if defined(__GLIBC__)
+ #if __GLIBC_PREREQ(2,4)
+ 
+ #include <sched.h>
+@@ -87,6 +89,11 @@
+ 
+     return VINF_SUCCESS;
+ }
++
++#else
++# include "../../generic/RTThreadGetAffinity-stub-generic.cpp"
++# include "../../generic/RTThreadSetAffinity-stub-generic.cpp"
++#endif
+ 
+ #else
+ # include "../../generic/RTThreadGetAffinity-stub-generic.cpp"
+--- ./src/VBox/Runtime/r3/linux/semeventmulti-linux.cpp.orig
++++ ./src/VBox/Runtime/r3/linux/semeventmulti-linux.cpp
+@@ -26,7 +26,7 @@
+ 
+ 
+ #include <features.h>
+-#if __GLIBC_PREREQ(2,6) && !defined(IPRT_WITH_FUTEX_BASED_SEMS)
++#if defined(__GLIBC__) && !defined(IPRT_WITH_FUTEX_BASED_SEMS)
+ 
+ /*
+  * glibc 2.6 fixed a serious bug in the mutex implementation. We wrote this
+--- ./src/VBox/Runtime/r3/linux/semevent-linux.cpp.orig
++++ ./src/VBox/Runtime/r3/linux/semevent-linux.cpp
+@@ -25,7 +25,7 @@
+  */
+ 
+ #include <features.h>
+-#if __GLIBC_PREREQ(2,6) && !defined(IPRT_WITH_FUTEX_BASED_SEMS)
++#if defined(__GLIBC__) && !defined(IPRT_WITH_FUTEX_BASED_SEMS)
+ 
+ /*
+  * glibc 2.6 fixed a serious bug in the mutex implementation. We wrote this
diff --git a/testing/virtualbox-guest-additions/musl-sched_yield.patch b/testing/virtualbox-guest-additions/musl-sched_yield.patch
new file mode 100644
index 0000000..9a807ac
--- /dev/null
+++ b/testing/virtualbox-guest-additions/musl-sched_yield.patch
@@ -0,0 +1,32 @@
+--- VirtualBox-5.0.12/src/VBox/Runtime/r3/posix/thread2-posix.cpp.orig
++++ VirtualBox-5.0.12/src/VBox/Runtime/r3/posix/thread2-posix.cpp
+@@ -65,7 +65,7 @@
+ #elif defined(RT_OS_SOLARIS) || defined(RT_OS_HAIKU)
+         sched_yield();
+ #else
+-        if (!pthread_yield())
++        if (!sched_yield())
+ #endif
+         {
+             LogFlow(("RTThreadSleep: returning %Rrc (cMillies=%d)\n", VINF_SUCCESS, cMillies));
+@@ -104,7 +104,7 @@
+ #elif defined(RT_OS_SOLARIS) || defined(RT_OS_HAIKU)
+         sched_yield();
+ #else
+-        if (!pthread_yield())
++        if (!sched_yield())
+ #endif
+             return VINF_SUCCESS;
+     }
+@@ -130,10 +130,8 @@
+ #endif
+ #ifdef RT_OS_DARWIN
+     pthread_yield_np();
+-#elif defined(RT_OS_SOLARIS) || defined(RT_OS_HAIKU)
+-    sched_yield();
+ #else
+-    pthread_yield();
++    sched_yield();
+ #endif
+ #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
+     u64TS = ASMReadTSC() - u64TS;
diff --git a/testing/virtualbox-guest-additions/uclibc-gnu_linux.patch b/testing/virtualbox-guest-additions/uclibc-gnu_linux.patch
new file mode 100644
index 0000000..b227d55
--- /dev/null
+++ b/testing/virtualbox-guest-additions/uclibc-gnu_linux.patch
@@ -0,0 +1,11 @@
+--- ./src/libs/kStuff/kStuff/include/k/kDefs.h.orig
++++ ./src/libs/kStuff/kStuff/include/k/kDefs.h
+@@ -82,7 +82,7 @@
+ #  define K_OS      K_OS_DRAGONFLY
+ # elif defined(__FreeBSD__) /*??*/
+ #  define K_OS      K_OS_FREEBSD
+-# elif defined(__gnu_linux__)
++# elif defined(__linux__)
+ #  define K_OS      K_OS_LINUX
+ # elif defined(__NetBSD__) /*??*/
+ #  define K_OS      K_OS_NETBSD
diff --git a/testing/virtualbox-guest-additions/uclibc-spawn.patch b/testing/virtualbox-guest-additions/uclibc-spawn.patch
new file mode 100644
index 0000000..98b4e8a
--- /dev/null
+++ b/testing/virtualbox-guest-additions/uclibc-spawn.patch
@@ -0,0 +1,26 @@
+--- ./src/VBox/Runtime/r3/posix/process-creation-posix.cpp.orig
++++ ./src/VBox/Runtime/r3/posix/process-creation-posix.cpp
+@@ -48,6 +48,9 @@
+  * whether it is started detached or not. */
+ # define HAVE_POSIX_SPAWN 1
+ #endif
++#if defined(__UCLIBC__)
++#undef HAVE_POSIX_SPAWN
++#endif
+ #ifdef HAVE_POSIX_SPAWN
+ # include <spawn.h>
+ #endif
+@@ -103,11 +106,9 @@
+     if (spwd)
+         pw->pw_passwd = spwd->sp_pwdp;
+ 
+-    /* be reentrant */
+-    struct crypt_data *data = (struct crypt_data*)RTMemTmpAllocZ(sizeof(*data));
+-    char *pszEncPasswd = crypt_r(pszPasswd, pw->pw_passwd, data);
++    /* NOT reentrant */
++    char *pszEncPasswd = crypt(pszPasswd, pw->pw_passwd);
+     int fCorrect = !strcmp(pszEncPasswd, pw->pw_passwd);
+-    RTMemTmpFree(data);
+     if (!fCorrect)
+         return VERR_PERMISSION_DENIED;
+ 
diff --git a/testing/virtualbox-guest-additions/vboxguestlib-makefile-nox11.patch b/testing/virtualbox-guest-additions/vboxguestlib-makefile-nox11.patch
new file mode 100644
index 0000000..44b2efd
--- /dev/null
+++ b/testing/virtualbox-guest-additions/vboxguestlib-makefile-nox11.patch
@@ -0,0 +1,19 @@
+--- ./src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk.orig
++++ ./src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk
+@@ -38,16 +38,6 @@
+ LIBRARIES += \
+ 	VBoxGuestR3Lib \
+ 	VBoxGuestR3LibShared
+-ifndef VBOX_ONLY_VALIDATIONKIT
+- if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd)
+-  LIBRARIES += \
+-  	VBoxGuestR3LibXFree86
+- endif
+- if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd solaris)
+-  LIBRARIES += \
+-  	VBoxGuestR3LibXOrg
+- endif
+-endif
+ LIBRARIES.win.amd64 += VBoxGuestR3Lib-x86 VBoxGuestR3LibShared-x86
+ 
+ 
diff --git a/testing/virtualbox-guest-additions/virtualbox-guest-additions-localconfig b/testing/virtualbox-guest-additions/virtualbox-guest-additions-localconfig
new file mode 100644
index 0000000..bcc7972
--- /dev/null
+++ b/testing/virtualbox-guest-additions/virtualbox-guest-additions-localconfig
@@ -0,0 +1,37 @@
+# -*- Makefile -*-
+#
+# Overwrite some default kBuild settings
+#
+
+#
+# Copyright (C) 2006-2008 Sun Microsystems, Inc.
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License as published by the Free Software Foundation,
+# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
+# distribution. VirtualBox OSE is distributed in the hope that it will
+# be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+
+# don't build testcases to save time, they are not needed for the package
+VBOX_WITH_TESTCASES     :=
+VBOX_WITH_VALIDATIONKIT :=
+
+KBUILD_MSG_STYLE        := brief
+
+## paths, origin, hardening
+VBOX_WITH_HARDENING        := 2
+VBOX_WITH_ORIGIN           :=
+VBOX_ONLY_ADDITIONS     := 1
+
+## don't build with -Werror
+VBOX_WITH_WARNINGS_AS_ERRORS :=
+
+## Disable anything X11 related
+VBOX_X11_SEAMLESS_GUEST :=
+VBOX_WITH_X11_ADDITIONS :=
+WITH_X11 :=
+VBOX_WITH_DRAG_AND_DROP :=
+VBOX_WITH_PAM :=
diff --git a/testing/virtualbox-guest-additions/virtualbox-guest-additions.initd b/testing/virtualbox-guest-additions/virtualbox-guest-additions.initd
new file mode 100644
index 0000000..5f990ec
--- /dev/null
+++ b/testing/virtualbox-guest-additions/virtualbox-guest-additions.initd
@@ -0,0 +1,25 @@
+#!/sbin/openrc-run
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+pidfile="/var/run/vboxguest-service.pid"
+command="/usr/sbin/VBoxService"
+command_args="--foreground"
+start_stop_daemon_args="--make-pidfile --pidfile ${pidfile} --background"
+
+depend() {
+        need localmount
+}
+
+start_pre() {
+	einfo "Loading kernel modules"
+	/sbin/modprobe vboxguest 2>&1
+	/sbin/modprobe vboxsf 2>&1
+}
+
+stop_post() {
+	einfo "Removing kernel modules"
+	/sbin/modprobe -r vboxsf 2>&1
+	/sbin/modprobe -r vboxguest 2>&1
+}
diff --git a/testing/virtualbox-guest-additions/virtualbox-guest-additions.pre-install b/testing/virtualbox-guest-additions/virtualbox-guest-additions.pre-install
new file mode 100644
index 0000000..dc2d87d
--- /dev/null
+++ b/testing/virtualbox-guest-additions/virtualbox-guest-additions.pre-install
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+addgroup -S vboxsf 2>/dev/null
+
+exit 0
-- 
2.7.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Ben Allen <[email-masked]>
Date: Sat, 16 Jan 2016 09:02:53 +0000

- Virtualbox Guest Additions kernel modules: vboxguest and vboxsf.
---
 .../10-vboxguest-Makefile.patch                    | 11 ++++
 testing/virtualbox-guest-modules/APKBUILD          | 71 ++++++++++++++++++++++
 2 files changed, 82 insertions(+)
 create mode 100644 testing/virtualbox-guest-modules/10-vboxguest-Makefile.patch
 create mode 100644 testing/virtualbox-guest-modules/APKBUILD

diff --git a/testing/virtualbox-guest-modules/10-vboxguest-Makefile.patch b/testing/virtualbox-guest-modules/10-vboxguest-Makefile.patch
new file mode 100644
index 0000000..2e1b591
--- /dev/null
+++ b/testing/virtualbox-guest-modules/10-vboxguest-Makefile.patch
@@ -0,0 +1,11 @@
+--- VirtualBox-5.0.12/vboxguest/Makefile.orig
++++ VirtualBox-5.0.12/vboxguest/Makefile
+@@ -108,7 +108,7 @@
+ 
+ MOD_DEFS = -DVBOX -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_GUEST \
+             -DIN_GUEST_R0 -DIN_MODULE -DRT_WITH_VBOX -DVBGL_VBOXGUEST \
+-            -DVBOX_WITH_HGCM
++            -DVBOX_WITH_HGCM -DLOG_USE_C99
+ ifeq ($(BUILD_TARGET_ARCH),amd64)
+  MOD_DEFS  += -DRT_ARCH_AMD64
+ else
diff --git a/testing/virtualbox-guest-modules/APKBUILD b/testing/virtualbox-guest-modules/APKBUILD
new file mode 100644
index 0000000..3449bd5
--- /dev/null
+++ b/testing/virtualbox-guest-modules/APKBUILD
@@ -0,0 +1,71 @@
+# Maintainer: 
+# Contributor: Ben Allen <[email-masked]>
+
+_flavor=${FLAVOR:-grsec}
+_kpkg=linux-$_flavor
+_kver=4.1.15
+_kpkgrel=4
+
+# when chaning _ver we *must* bump _mypkgrel
+_ver=5.0.12
+_mypkgrel=0
+_name=virtualbox-guest-modules
+
+# verify the kernel version before entering chroot
+_kapkbuild=../../linux-${_flavor}/APKBUILD
+if [ -f $_kapkbuild ]; then
+	. $_kapkbuild
+	pkgname=$_name-$_flavor
+	[ "$_kver" != "$pkgver" ] && die "please update _kver to $pkgver"
+	[ "$_kpkgrel" != "$pkgrel" ] && die "please update _kpkgrel to $pkgrel"
+fi
+
+_kpkgver="$_kver-r$_kpkgrel"
+_abi_release=${_kver}-${_kpkgrel}-${_flavor}
+
+pkgname=${_name}-${_flavor}
+pkgver=$_kver
+pkgrel=$(($_kpkgrel + $_mypkgrel))
+pkgdesc="VirtualBox Additions kernel modules for $_flavor "
+arch='x86_64'
+url='http://virtualbox.org'
+license="GPL custom"
+makedepends="linux-grsec-dev sed"
+source="http://download.virtualbox.org/virtualbox/$_ver/VirtualBox-$_ver.tar.bz2
+	10-vboxguest-Makefile.patch"
+
+_builddir="$srcdir"/VirtualBox-$_ver
+
+prepare() {
+	cd "$_builddir"
+	$_builddir/src/VBox/Additions/linux/export_modules "$_builddir/vbox-kmod.tar.gz"
+	tar -xf "$_builddir/vbox-kmod.tar.gz" 
+	local i
+	for i in $source; do
+		case $i in
+		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+		esac
+	done
+}
+
+build() {
+	cd "$_builddir"
+	# Build Kernel Modules
+	make KERN_DIR=/lib/modules/${_abi_release}/build
+}
+
+package() {
+	cd "$_builddir"
+	local module=
+	for module in vboxsf vboxguest; do
+		install -v -D -m644 ${module}.ko \
+			"$pkgdir/lib/modules/${_abi_release}/misc/${module}.ko"
+	done
+}
+
+md5sums="5912835882ef547e0559c7e73bc85828  VirtualBox-5.0.12.tar.bz2
+34c8e3cb497d86be4281dcd62b3b3b4f  10-vboxguest-Makefile.patch"
+sha256sums="de0362b1d404d1ca0298db1984acb6f0f1c6210313aeb744fea345ad9201e86e  VirtualBox-5.0.12.tar.bz2
+440a4c15e7de4ad9087fedc64c045c6a28f31c59c787ad7a8a34ea65b72f8499  10-vboxguest-Makefile.patch"
+sha512sums="eef01d1a5121905d2fbfcd48081f18db06433187bfbfea6a006b3adea11cad8c8351025fd19fa115c132231592330b17bfeba033a3a168f3064176a3f7586d7a  VirtualBox-5.0.12.tar.bz2
+38f774b8b2242687dc6327bd4c2fc6951207758fb2e25dd46550861c09a3f2b8efad1a8414529146fbbb8a89cf2eb3ad44b00fbdbbeafd3f8c69ba4cb91decf0  10-vboxguest-Makefile.patch"
-- 
2.7.0

---