Mail archive
alpine-aports

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

From: Ben Allen <bensallen_at_me.com>
Date: Fri, 22 Jan 2016 04:40:25 +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.
---
Changes v1 -> v2:
  - Updated to VirtualBox 5.0.14
 testing/virtualbox-guest-additions/APKBUILD        | 95 ++++++++++++++++++++++
 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, 332 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..8891114
--- /dev/null
+++ b/testing/virtualbox-guest-additions/APKBUILD
_at_@ -0,0 +1,95 @@
+# Maintainer: Ben Allen <bensallen_at_me.com>
+# Contributor: Ben Allen <bensallen_at_me.com>
+
+_flavor=${FLAVOR:-grsec}
+
+pkgname=virtualbox-guest-additions
+pkgver=5.0.14
+
+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.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="e0a02426ad09b475e630881efe911423  VirtualBox-5.0.14.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
+867c31d95544f25deb3dfbac038d4cb0  virtualbox-guest-additions.initd"
+sha256sums="69abac7255b2251a18fd73c0b7c200d5f8ce72a59fa019b53a5cdbf7f2843002  VirtualBox-5.0.14.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
+f1c39ecf58e6dc8162066adbda6d5cec5a5fe4f5f1f6003b6201269b3f52f456  virtualbox-guest-additions.initd"
+sha512sums="5547da58b50c9cf5d096f81c005134e1f56c4fb55d4d40a6fbd1efe1fe1fbeebc0747f0903933da9238a24c63eeed2c6c15bfc5cae5ce6e3e2eb4a18511d6258  VirtualBox-5.0.14.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
+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
_at_@ -0,0 +1,16 @@
+--- ./src/VBox/Runtime/r3/posix/fileio2-posix.cpp.orig
++++ ./src/VBox/Runtime/r3/posix/fileio2-posix.cpp
+_at_@ -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
_at_@ -0,0 +1,10 @@
+--- ./src/VBox/Runtime/r3/linux/sysfs.cpp.orig
++++ ./src/VBox/Runtime/r3/linux/sysfs.cpp
+_at_@ -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
_at_@ -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
+_at_@ -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
_at_@ -0,0 +1,45 @@
+--- ./src/VBox/Runtime/r3/linux/thread-affinity-linux.cpp.orig
++++ ./src/VBox/Runtime/r3/linux/thread-affinity-linux.cpp
+_at_@ -32,6 +32,8 @@
+ # define _GNU_SOURCE
+ #endif
+ #include <features.h>
++
++#if defined(__GLIBC__)
+ #if __GLIBC_PREREQ(2,4)
+ 
+ #include <sched.h>
+_at_@ -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
+_at_@ -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
+_at_@ -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
_at_@ -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
+_at_@ -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));
+_at_@ -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;
+     }
+_at_@ -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
_at_@ -0,0 +1,11 @@
+--- ./src/libs/kStuff/kStuff/include/k/kDefs.h.orig
++++ ./src/libs/kStuff/kStuff/include/k/kDefs.h
+_at_@ -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
_at_@ -0,0 +1,26 @@
+--- ./src/VBox/Runtime/r3/posix/process-creation-posix.cpp.orig
++++ ./src/VBox/Runtime/r3/posix/process-creation-posix.cpp
+_at_@ -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
+_at_@ -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
_at_@ -0,0 +1,19 @@
+--- ./src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk.orig
++++ ./src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk
+_at_@ -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
_at_@ -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
_at_@ -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
_at_@ -0,0 +1,5 @@
+#!/bin/sh
+
+addgroup -S vboxsf 2>/dev/null
+
+exit 0
-- 
2.7.0
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Fri Jan 22 2016 - 04:40:25 GMT