summaryrefslogtreecommitdiff
path: root/libre/virtualbox-libre-modules-lts/PKGBUILD
blob: 07cb8a71e4e000f9550274b4edf54b814a91ab76 (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
# $Id: PKGBUILD 93525 2013-07-05 00:46:26Z seblu $
# Maintainer: Bartłomiej Piotrowski <nospam@bpiotrowski.pl>
# Contributor: Ionut Biru <ibiru@archlinux.org>
# Contributor: Sébastien Luttringer <seblu@aur.archlinux.org>
# Maintainer (Parabola): André Silva <emulatorman@lavabit.com>
# Contributor (Parabola): Jorge López <jorginho@lavabit.com>

pkgbase=virtualbox-libre-modules-lts
pkgname=('virtualbox-libre-host-modules-lts' 'virtualbox-libre-guest-modules-lts')
pkgver=4.2.16
pkgrel=1
arch=('i686' 'x86_64')
url='http://virtualbox.org'
license=('GPL')
makedepends=('linux-libre-lts'
             'linux-libre-lts-headers'
             "virtualbox-libre-host-dkms>=$pkgver"
             "virtualbox-libre-guest-dkms>=$pkgver"
             'expac'
             'sed'
             'bc')

build() {
  _kernmaj=$(expac -Q '%v' linux-libre-lts|sed -r 's/([[:digit:]]+\.[[:digit:]]+).*/\1/')
  _kernver=$(< /usr/lib/modules/extramodules-$_kernmaj-LIBRE-LTS/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-lts(){
  _kernmaj=$(expac -Q '%v' linux-libre-lts|sed -r 's/([[:digit:]]+\.[[:digit:]]+).*/\1/')
  _kernver=$(< /usr/lib/modules/extramodules-$_kernmaj-LIBRE-LTS/version)
  pkgdesc='Host kernel modules for VirtualBox (built for the linux-libre-lts kernel package)'
#  depends=("linux-libre-lts>=${_kernver%.*}" "linux-libre-lts<$(echo "${_kernver%.*}+0.1"|bc)")
  depends=('linux-libre-lts>=3.0' 'linux-libre-lts<3.1')
  replaces=('virtualbox-host-modules-lts' 'virtualbox-modules-lts' 'virtualbox-libre-modules-lts')
  conflicts=('virtualbox-host-modules-lts' 'virtualbox-modules-lts' 'virtualbox-libre-modules-lts')
  provides=("virtualbox-host-modules-lts=$pkgver" "virtualbox-libre-host-modules=$pkgver")
  install=virtualbox-libre-host-modules-lts.install

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

package_virtualbox-libre-guest-modules-lts(){
  _kernmaj=$(expac -Q '%v' linux-libre-lts|sed -r 's/([[:digit:]]+\.[[:digit:]]+).*/\1/')
  _kernver=$(< /usr/lib/modules/extramodules-$_kernmaj-LIBRE-LTS/version)
  pkgdesc='Guest kernel modules for VirtualBox (built for the linux-libre-lts kernel package)'
  license=('GPL')
#  depends=("linux-libre-lts>=${_kernver%.*}" "linux-libre-lts<$(echo "${_kernver%.*}+0.1"|bc)")
  depends=('linux-libre-lts>=3.0' 'linux-libre-lts<3.1')
  replaces=('virtualbox-guest-modules-lts' 'virtualbox-archlinux-modules-lts' 'virtualbox-libre-parabola-modules-lts')
  conflicts=('virtualbox-guest-modules-lts' 'virtualbox-archlinux-modules-lts' 'virtualbox-libre-parabola-modules-lts')
  provides=("virtualbox-guest-modules-lts=$pkgver" "virtualbox-libre-host-modules=$pkgver")
  install=virtualbox-libre-guest-modules-lts.install

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

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