PKGBUILD 1.11 KB
Newer Older
Neophytos's avatar
Neophytos committed
1

philm's avatar
philm committed
2
pkgname=bbswitch
Samir's avatar
Samir committed
3
pkgver=0.8
Luca Giambonini's avatar
Luca Giambonini committed
4
pkgrel=43
philm's avatar
philm committed
5
pkgdesc="kernel module allowing to switch dedicated graphics card on Optimus laptops"
6
arch=('x86_64')
Luca Giambonini's avatar
Luca Giambonini committed
7
url="http://github.com/Bumblebee-Project/bbswitch"
philm's avatar
philm committed
8 9
license=('GPL')
install=bbswitch.install
Luca Giambonini's avatar
Luca Giambonini committed
10
depends=("linux=4.17.12")
Luca Giambonini's avatar
Luca Giambonini committed
11
makedepends=("linux-headers=4.18.3")
Luca Giambonini's avatar
Luca Giambonini committed
12
_extramodules=extramodules-CHAKRA
Neophytos's avatar
Neophytos committed
13
source=("https://github.com/Bumblebee-Project/bbswitch/archive/v${pkgver}.tar.gz")
Samir's avatar
Samir committed
14 15 16 17 18 19
md5sums=('5b116b31ace3604ddf9d1fc1f4bc5807')

prepare() {
  #automatically update bbswitch.install
  sed -i -e "s/EXTRAMODULES='.*'/EXTRAMODULES='${_extramodules}'/" "${startdir}/bbswitch.install"
}
philm's avatar
philm committed
20 21 22

build() {
  cd ${srcdir}/${pkgname}-${pkgver}
Luca Giambonini's avatar
Luca Giambonini committed
23 24 25 26
  KERNEL_VERSION=$(</usr/lib/modules/$_extramodules/version)
  msg2 "Kernel = $KERNEL_VERSION"

  make KDIR="/usr/lib/modules/$KERNEL_VERSION/build/"
philm's avatar
philm committed
27 28 29
}

package() {
Samir's avatar
Samir committed
30 31
  cd ${srcdir}/${pkgname}-${pkgver}
  msg2 "Building module for $_kver..."
philm's avatar
philm committed
32

Samir's avatar
Samir committed
33 34
  # KDIR is necessary even when cleaning
  #make KDIR=/usr/src/linux-${_kver} clean
35 36
  install -Dm644 bbswitch.ko $pkgdir/usr/lib/modules/${_extramodules}/bbswitch.ko
  gzip "${pkgdir}/usr/lib/modules/${_extramodules}/bbswitch.ko"
Phil's avatar
Phil committed
37
}