summaryrefslogtreecommitdiff
path: root/libre/virtualbox-libre-modules/PKGBUILD
blob: 45bbfb86d0014df961b3aa50fee3adb6a8627407 (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
# $Id$
# Maintainer: Ionut Biru <ibiru@archlinux.org>
# Maintainer: Sébastien Luttringer <seblu@archlinux.org>
# Maintainer (Parabola): Jorge López <jorginho@lavabit.com>
# Maintainer (Parabola): André Silva <emulatorman@lavabit.com>

pkgbase=virtualbox-libre-modules
pkgname=('virtualbox-libre-host-modules' 'virtualbox-libre-guest-modules')
pkgver=4.2.10
_extramodules=extramodules-3.8-LIBRE
pkgrel=3
arch=('i686' 'x86_64')
url='http://virtualbox.org'
license=('GPL')
makedepends=('linux-libre-headers'
             "virtualbox-libre-host-dkms>=$pkgver"
             "virtualbox-libre-guest-dkms>=$pkgver"
             'expac'
             'bc')

build() {
  _kernver="$(cat /usr/lib/modules/${_extramodules}/version)"

  # dkms need modification to be run as user
  cp -r /var/lib/dkms .
  echo "dkms_tree='$srcdir/dkms'" > dkms.conf
  # build host modules
  msg2 'Host modules'
  dkms --dkmsframework dkms.conf build "vboxhost/$pkgver" -k "$_kernver"
  # build guest modules
  msg2 'Guest modules'
  dkms --dkmsframework dkms.conf build "vboxguest/$pkgver" -k "$_kernver"
}

package_virtualbox-libre-host-modules(){
  _kernver="$(cat /usr/lib/modules/${_extramodules}/version)"

  pkgdesc='Host kernel modules for VirtualBox (built for the linux-libre kernel package)'
  depends=('linux-libre>=3.8' 'linux-libre<3.9')
  provides=("virtualbox-host-modules=${pkgver}")
  replaces=('virtualbox-host-modules' 'virtualbox-modules' 'virtualbox-libre-modules')
  conflicts=('virtualbox-host-modules' 'virtualbox-modules' 'virtualbox-libre-modules')
  install=virtualbox-libre-host-modules.install

  install -dm755 "$pkgdir/usr/lib/modules/$_extramodules"
  cd "dkms/vboxhost/$pkgver/$_kernver/$CARCH/module"
  install -m644 * "$pkgdir/usr/lib/modules/$_extramodules"
  find "$pkgdir" -name '*.ko' -exec gzip -9 {} +
  sed -ie "s/EXTRAMODULES='.*'/EXTRAMODULES='$_extramodules'/" "$startdir/virtualbox-libre-host-modules.install"
}

package_virtualbox-libre-guest-modules(){
  _kernver="$(cat /usr/lib/modules/${_extramodules}/version)"

  pkgdesc='Guest kernel modules for VirtualBox (built for the linux-libre kernel package)'
  license=('GPL')
  depends=('linux-libre>=3.8' 'linux-libre<3.9')
  provides=("virtualbox-guest-modules=${pkgver}")
  replaces=('virtualbox-guest-modules' 'virtualbox-archlinux-modules' 'virtualbox-parabola-modules')
  conflicts=('virtualbox-guest-modules' 'virtualbox-archlinux-modules' 'virtualbox-parabola-modules')
  install=virtualbox-libre-guest-modules.install

  install -dm755 "$pkgdir/usr/lib/modules/$_extramodules"
  cd "dkms/vboxguest/$pkgver/$_kernver/$CARCH/module"
  install -m644 * "$pkgdir/usr/lib/modules/$_extramodules"
  find "$pkgdir" -name '*.ko' -exec gzip -9 {} +
  sed -ie "s/EXTRAMODULES='.*'/EXTRAMODULES='$_extramodules'/" "$startdir/virtualbox-libre-guest-modules.install"
}

# vim:set ts=2 sw=2 et: