Subject: [alpine-aports] [PATCH] community/virtualbox-guest-additions: X11 & OpenRC

From: Marian Buschsieweke <[email-masked]>
Date: Thu, 28 Mar 2019 16:49:57 +0100

- Added subpkg $pkgname-x11 (provides VBoxClient)
- Split of OpenRC as subpkg (as is state of the art)
---
 community/virtualbox-guest-additions/APKBUILD | 15 +++++--
 .../VBoxClient.patch                          | 39 +++++++++++++++++++
 .../virtualbox-guest-additions-localconfig    | 11 ++++--
 3 files changed, 57 insertions(+), 8 deletions(-)
 create mode 100644 community/virtualbox-guest-additions/VBoxClient.patch

diff --git a/community/virtualbox-guest-additions/APKBUILD b/community/virtualbox-guest-additions/APKBUILD
index 69d9b402ef..794fd6b1f8 100644
--- a/community/virtualbox-guest-additions/APKBUILD
+++ b/community/virtualbox-guest-additions/APKBUILD
@@ -4,14 +4,15 @@
 pkgname=virtualbox-guest-additions
 pkgver=6.0.4
 
-pkgrel=0
+pkgrel=1
 pkgdesc="VirtualBox Addtions userland components"
 arch='x86 x86_64'
 url='https://virtualbox.org/'
 license="GPL custom"
 install="$pkgname.pre-install"
-makedepends="sed kbuild lvm2-dev yasm nasm zlib-dev openssl-dev curl-dev libxslt"
+makedepends="sed kbuild lvm2-dev yasm nasm zlib-dev openssl-dev curl-dev libxslt libxrandr-dev"
 depends=""
+subpackages="$pkgname-x11 $pkgname-openrc"
 source="https://download.virtualbox.org/virtualbox/$pkgver/VirtualBox-$pkgver.tar.bz2
 	futimens.patch
 	musl-fix-headers.patch
@@ -19,6 +20,7 @@ source="https://download.virtualbox.org/virtualbox/$pkgver/VirtualBox-$pkgver.ta
 	musl-fix-stat-nsec.patch
 	musl-sched_yield.patch
 	glibc-symvers.patch
+	VBoxClient.patch
 	virtualbox-guest-additions-localconfig
 	$pkgname.initd
 	"
@@ -52,7 +54,11 @@ package() {
 	install -v -Dm755 "$builddir"/out/linux.*/release/bin/additions/VBoxService "$pkgdir/usr/sbin/VBoxService"
 	install -v -Dm755 "$builddir"/out/linux.*/release/bin/additions/VBoxControl "$pkgdir/usr/bin/VBoxControl"
 	install -v -Dm755 "$builddir"/out/linux.*/release/bin/additions/mount.vboxsf "$pkgdir/usr/sbin/mount.vboxsf"
-        install -v -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+	install -v -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+}
+
+x11() {
+	install -v -Dm755 "$builddir"/out/linux.*/release/bin/additions/VBoxClient "$subpkgdir/usr/sbin/VBoxClient"
 }
 
 sha512sums="c2e5418bafd5d50b46e1bc70280753c2fdfbf7248d782fc398771839950fb575eaea437e9699d56f4d8c92ea4dc9ba8bed74379565dac6114f7e9c45aecc9fdb  VirtualBox-6.0.4.tar.bz2
@@ -62,5 +68,6 @@ b1c47cb910ac751df7bd4bc10c5501e91d88a9b3e4fe181b02755d433df8e89a160a38422912266f
 2c329085915f0ffa43828a14d8b29d0d876e48e18a0190ad146cd0731af7eca11cdf41d2e533c9cc73aa75506b9b91e3a08f2272cd8884e0d929722730b99862  musl-fix-stat-nsec.patch
 56c5c3a0becd8f1886010f5f231aa1d2e129bf188f8220e111fb9d51c191a429940edec700f5286b46dadbb45b62e67ee4e09fec6bcea61a344fb65afcbd6756  musl-sched_yield.patch
 2b907920c32b4385e80b81ec755cb0931d3bb1dff23184ddc49e457f9dfafb2ddbd810418c003c3be82433b06de800fce77a07883fa46e51e6870d565a485add  glibc-symvers.patch
-43555e442f85424c957d51a737394c6f2ec0782e5b8701e3bc6a08d17ae2e8e6e9e85734d69853f7151f91f951a9a921c4f0c5d5f6b72e8379526c49f070d49b  virtualbox-guest-additions-localconfig
+9e2da29de4767e1276fb11191641a4f0ecc133a2113b5dd3cc9e17e59cabd8f192d118680d014641b3cd819d6d6faefbf298c1f0891426e261a9b8a8c69c2c52  VBoxClient.patch
+05aac36598cda11940a95c72045be78ec0fbcdfe95b7bd390229a85fb576ccfb6b5adcb479b361fa56755bea62deba4112b997c802d230c5f011c5a67e0c8f91  virtualbox-guest-additions-localconfig
 ad6ff256def558f5c6b772c62a3e7a6ccd067ae208491e02ce6738a501d02bcac214056825b804c19fd21b33f3752c62bd8572eb8764f6c5eb10534fa668bd38  virtualbox-guest-additions.initd"
diff --git a/community/virtualbox-guest-additions/VBoxClient.patch b/community/virtualbox-guest-additions/VBoxClient.patch
new file mode 100644
index 0000000000..80e6707bfc
--- /dev/null
+++ b/community/virtualbox-guest-additions/VBoxClient.patch
@@ -0,0 +1,39 @@
+diff -rupN VirtualBox-6.0.4-bak/src/VBox/Additions/x11/VBoxClient/Makefile.kmk VirtualBox-6.0.4/src/VBox/Additions/x11/VBoxClient/Makefile.kmk
+--- VirtualBox-6.0.4-bak/src/VBox/Additions/x11/VBoxClient/Makefile.kmk	2019-03-28 16:29:24.277508391 +0100
++++ VirtualBox-6.0.4/src/VBox/Additions/x11/VBoxClient/Makefile.kmk	2019-03-28 16:30:24.893944894 +0100
+@@ -72,14 +72,6 @@ VBoxClient_LIBS += \
+ 	supc++ \
+ 	gcc_eh
+ 
+-# This forces the memcpy references in the static libraries to go to
+-# __wrap_memcpy, which we can wrap around [email-masked].  I do not know
+-# how else to do that without recompiling or implementing our own memcpy.
+-ifeq ($(KBUILD_TARGET),linux)
+-VBoxClient_LDFLAGS.amd64 += \
+-	-Wl,--wrap=memcpy
+-endif
+-
+ ifdef VBOX_WITH_GUEST_PROPS
+ VBoxClient_DEFS += VBOX_WITH_GUEST_PROPS
+ endif
+diff -rupN VirtualBox-6.0.4-bak/src/VBox/Additions/x11/VBoxClient/chk_stubs.c VirtualBox-6.0.4/src/VBox/Additions/x11/VBoxClient/chk_stubs.c
+--- VirtualBox-6.0.4-bak/src/VBox/Additions/x11/VBoxClient/chk_stubs.c	2019-03-28 16:29:24.277508391 +0100
++++ VirtualBox-6.0.4/src/VBox/Additions/x11/VBoxClient/chk_stubs.c	2019-03-28 16:29:52.860733197 +0100
+@@ -43,17 +43,3 @@ void __stack_chk_fail(void)
+     fprintf(stderr, "Stack check failed!\n");
+     _exit(1);
+ }
+-
+-#ifdef __x86_64
+-/* Furthermore, wrap references to memcpy to force them to go to the right
+- * version.  We are forced to do it this way because the shared libraries
+- * supc++ and gcc_eh contain references which we cannot change. */
+-
+-extern void *__wrap_memcpy(void *dest, const void *src, size_t n);
+-
+-asm (".symver memcpy, [email-masked]");
+-void *__wrap_memcpy(void *dest, const void *src, size_t n)
+-{
+-    return memcpy(dest, src, n);
+-}
+-#endif
diff --git a/community/virtualbox-guest-additions/virtualbox-guest-additions-localconfig b/community/virtualbox-guest-additions/virtualbox-guest-additions-localconfig
index b7a0df804f..7637e255d9 100644
--- a/community/virtualbox-guest-additions/virtualbox-guest-additions-localconfig
+++ b/community/virtualbox-guest-additions/virtualbox-guest-additions-localconfig
@@ -29,11 +29,14 @@ VBOX_ONLY_ADDITIONS     := 1
 ## don't build with -Werror
 VBOX_WITH_WARNINGS_AS_ERRORS :=
 
+# use system xorg and gl headers
+VBOX_USE_SYSTEM_XORG_HEADERS = 1
+VBOX_USE_SYSTEM_GL_HEADERS = 1
+
+# no legacy X.org - use KMS
+VBOX_NO_LEGACY_XORG_X11 = 1
+
 ## Disable anything X11 related
-VBOX_X11_SEAMLESS_GUEST :=
-VBOX_WITH_X11_ADDITIONS :=
-WITH_X11 :=
-VBOX_WITH_DRAG_AND_DROP :=
 VBOX_WITH_PAM :=
 
 TOOL_YASM_AS := yasm
-- 
2.21.0

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