summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 56061e343b9bce8e3f0118a0e22ae5cd72d584d3 (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
# Maintainer: sukanka <su975853527@gmail.com>


pkgname=bbswitch-ati-git
pkgver=v0.8.2.g9dd2270
pkgrel=1
pkgdesc='kernel module allowing to switch also AMD integrated and Nvidia dedicated graphics card on Optimus laptops (Git version)'
arch=('i686' 'x86_64')
license=('GPL')
url='http://github.com/Bumblebee-Project/bbswitch'
provides=('bbswitch')
conflicts=('bbswitch' 'bbswitch-dkms' 'bbswitch-git-dkms')
makedepends=('linux-headers' 'git')
source=("${pkgname}::git+https://github.com/Bumblebee-Project/bbswitch.git#branch=develop"
'https://www.qua-it.org/XFCE/shots/share-with-pclos/pclos/bbswitch-v0.8-proc_ops-struct.patch'
)
sha256sums=('SKIP' 'SKIP')
install=bbswitch-ati.install

pkgver () {
  cd "${srcdir}/${pkgname}"
  git describe --always | sed 's|-|.|g'
}

build() {
    kernel_ver=$(uname -r |cut -f1 -d'-')
    cpu=$(cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq | cut -f2 -d' ')
    cd "${srcdir}/${pkgname}"
    if [ $kernel_ver > "5.6" ]; then 
        git apply "${srcdir}"/bbswitch-v0.8-proc_ops-struct.patch
        echo 12225555
    fi
    if [ "$cpu" = "AMD" ]; then
        echo "AMD integrated card detected"
        echo "${srcdir}/${pkgname}"/bbswitch.c
        sed -i 's/PCI_VENDOR_ID_INTEL/PCI_VENDOR_ID_ATI/g' "${srcdir}/${pkgname}"/bbswitch.c
    fi
    make
}

package() {
  cd ${srcdir}/${pkgname}
  _KERNELS=`uname -r`
  mkdir -p "${pkgdir}/usr/lib/modules/${_KERNELS}/extramodules"
        install -m644 bbswitch.ko "${pkgdir}/usr/lib/modules/${_KERNELS}/extramodules"
        gzip "${pkgdir}/usr/lib/modules/${_KERNELS}/extramodules/bbswitch.ko"
}