aboutsummaryrefslogtreecommitdiffstats
path: root/community/virtualbox-guest-modules-vanilla/APKBUILD
blob: b80f1ffa40fa07e3f4944fe5496dec2aeabbb393 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Maintainer: Ben Allen <bensallen@me.com>
# Contributor: Ben Allen <bensallen@me.com>

# when chaning _ver we *must* bump _rel
_name=virtualbox-guest-modules
_ver=5.2.2
_rel=0

_flavor=${FLAVOR:-vanilla}
_kpkg=linux-$_flavor
_kver=4.14.33
_krel=0

_kpkgver="$_kver-r$_krel"
_kabi=$_kver-$_krel-$_flavor
_kabi_virt=$_kver-$_krel-virt

pkgname=$_name-$_flavor
pkgver=$_kver
pkgrel=$(($_krel + $_rel))

pkgdesc="VirtualBox Additions guest kernel modules for $_flavor"
arch='x86 x86_64'
url='http://virtualbox.org'
license="GPL-2.0 custom"
makedepends="linux-vanilla-dev=$_kpkgver linux-virt-dev=$_kpkgver sed coreutils"
subpackages="$_name-virt:virt"
source="http://download.virtualbox.org/virtualbox/$_ver/VirtualBox-$_ver.tar.bz2
	vboxguest-log-use-c99.patch
	"
#provides="${_name}-grsec=${pkgver}-r${pkgrel}"
builddir="$srcdir"/VirtualBox-$_ver

prepare() {
	local i

	cd "$builddir"
	default_prepare
	# verify the kernel version
	local _kapkbuild=../../main/linux-$_flavor-/APKBUILD
	if [ -f $_kapkbuild ]; then
		(	. $_kapkbuild
			pkgname=$_name-$_flavor
			[ "$_kver" != "$pkgver" ] && die "please update _kver to $pkgver"
			[ "$_krel" != "$pkgrel" ] && die "please update _krel to $pkgrel"
			return 0
		)
	fi
	"$builddir"/src/VBox/Additions/linux/export_modules.sh \
		"$srcdir/vbox-kmod-$_ver.tar.gz"

	for i in $_kabi $_kabi_virt; do
		mkdir -p "$srcdir/$i"
		tar -C "$srcdir/$i" -zxf "$srcdir"/vbox-kmod-$_ver.tar.gz
	done
}

build() {
	local i
	for i in $_kabi $_kabi_virt; do
		cd "$srcdir/$i"
		# Build Kernel Modules
		make KERN_DIR=/lib/modules/${i}/build
	done
}

package() {
	local i module=
	for i in $_kabi $_kabi_virt; do
		cd "$srcdir/$i"
		for module in *.ko; do
			install -v -D -m644 ${module} \
				"$pkgdir/lib/modules/$i/misc/${module}"
		done
	done
}

virt() {
	pkgdesc="VirtualBox Additions kernel modules for virt"
	mkdir -p "$subpkgdir"/lib/modules/
	# vboxvideo.ko won't load with virt kernel as it doesn't have DRM
	rm "$pkgdir"/lib/modules/$_kabi_virt/misc/vboxvideo.ko
	mv "$pkgdir"/lib/modules/$_kabi_virt \
		"$subpkgdir"/lib/modules/
}

sha512sums="415956cfe987a20eb0a372288c29f0e388bd706a3b94ff69b92ef5bbf2e9aecd75761a56f5421ef97d165f756cd7fd46b9eaf16b74b7d2460b831d7f03aae7dc  VirtualBox-5.2.2.tar.bz2
bd934e9ed3d2324ef66e2539d2f3f6fab35a8858d670bba817b9cabfe66e85fe13a8594b35f4a8e639841f72fb0b8d12af38518ba25638da5ef338b259ab600b  vboxguest-log-use-c99.patch"