summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: fc3e4f378d4970a3526ffd996f3f8723674053de (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
# Maintainer: Rhys Perry <rhysperry111@gmail.com>
# Based off of: community/bbswitch

pkgname=bbswitch-zen
pkgver=0.8
pkgrel=31
pkgdesc="Kernel module allowing to switch dedicated graphics card on Optimus laptops"
arch=('x86_64')
url="http://github.com/Bumblebee-Project/bbswitch"
license=('GPL')
provides=('bbswitch')
conflicts=('bbswitch-dkms' 'bbswitch-git-dkms')
depends=('linux-zen')
makedepends=('linux-zen-headers')
source=("bbswitch-${pkgver}.tar.gz::https://github.com/Bumblebee-Project/bbswitch/archive/v${pkgver}.tar.gz"
        "kernel-5.6.patch::https://github.com/Bumblebee-Project/bbswitch/commit/4dbde5385f9c77155cc1ca57ce83bf64f9af2c4a.patch")
md5sums=('5b116b31ace3604ddf9d1fc1f4bc5807'
         '65ddb95270e07f3d40002f3ca4fb10f8')
_verstring="$(pacman -Qi linux-zen | grep Version | tr -s " " | cut -d ' ' -f3)"
_kernname="$(echo ${_verstring} | cut -d '.' -f1)"."$(echo ${_verstring} | cut -d '.' -f2)"."$(echo ${_verstring} | cut -d '.' -f3)"-"$(echo ${_verstring} | cut -d '.' -f4)"-zen

prepare(){
  cd "bbswitch-$pkgver"
  patch --forward --strip=1 --input="${srcdir}/kernel-5.6.patch"
  echo -e '\033[1;31mWARNING:\033[0m \033[0;33mThis package MUST be rebuilt every time you upgrade your kernel.\n         I will try to update `pkgrel` as soon as an update comes out but this might take a few hours for me to notice.\n         If you do not rebuild expect errors\033[0m\033[0m'
}

build() {
  cd bbswitch-${pkgver}
  make -C /usr/lib/modules/${_kernname}/build M=$(pwd) modules
}

package() {
  cd bbswitch-${pkgver}
  _extradir="/usr/lib/modules/${_kernname}/extramodules"
  install -Dt "${pkgdir}${_extradir}" -m644 *.ko
  find "${pkgdir}" -name '*.ko' -exec xz {} +
}