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
# Contributor : Thomas Baechler <[email protected]>
# Contributor : Natrio <[email protected]>

pkgname=nvidia-173xx-lts
pkgver=173.14.31
_kbr="3.0"
_kmin=$_kbr
_kless="3.1"
_extramodules=extramodules-${_kbr}-lts
_kernver="$(cat /lib/modules/${_extramodules}/version)"
pkgrel=7
pkgdesc="NVIDIA drivers for linux-lts, 173xx branch."
arch=('i686' 'x86_64')
[ "$CARCH" = "i686"   ] && ARCH=x86
[ "$CARCH" = "x86_64" ] && ARCH=x86_64
url="http://www.nvidia.com/"
depends=("linux-lts>=$_kmin" "linux-lts<$_kless" "nvidia-173xx-utils")
makedepends=("linux-lts-headers>=$_kmin" "linux-lts-headers<$_kless")
conflicts=('nvidia-96xx' 'nvidia')
license=('custom')
install=nvidia.install
source=("http://download.nvidia.com/XFree86/Linux-$ARCH/${pkgver}/NVIDIA-Linux-$ARCH-${pkgver}-pkg0.run"
"generated.patch")
options=(!strip)
md5sums=('01cd3b91196cd4495f56c34494f310b5'
         '6ecffbafdffdd38756185377de4ede31')
[ "$CARCH" = "x86_64" ] && md5sums[0]='d53e8faf8ac90ad98b8998f25f121535'

build() {
        cd $srcdir
        sh NVIDIA-Linux-$ARCH-${pkgver}-pkg0.run --extract-only
        cd NVIDIA-Linux-$ARCH-${pkgver}-pkg0
        cd usr/src/nv/
        patch -p1 -i "${srcdir}/generated.patch" || exit 1
        ln -s Makefile.kbuild Makefile
        make SYSSRC=/lib/modules/${_kernver}/build/ module
}

package() {
        cd $srcdir/NVIDIA-Linux-$ARCH-${pkgver}-pkg0/usr/src/nv/
        mkdir -p $pkgdir/lib/modules/${_extramodules}/
        install -m644 nvidia.ko $pkgdir/lib/modules/${_extramodules}/
        mkdir -p $pkgdir/etc/modprobe.d
        echo "blacklist nouveau" >> $pkgdir/etc/modprobe.d/nouveau_blacklist.conf
        sed -i -e "s/EXTRAMODULES='.*'/EXTRAMODULES='${_extramodules}'/" $startdir/nvidia.install
        # gzip -9 module
        gzip "${pkgdir}/lib/modules/${_extramodules}/nvidia.ko"
}