summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d028d6117683ce2e31c3c563cf227dceb510ca47 (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
75
76
77
78
79
80
81
82
83
84
85
# Maintainer:         Alexander Blinne "Sunday" <alexander at blinne dot net>
# Original Submitter: Wessel Dirksen "p-we" <wdirksen at gmail dot com>

pkgname=tbs-dvb-drivers
pkgver=v170330_4.10.11_1_ARCH
pkgrel=1
pkgdesc="TBS proprietary DVB drivers + firmware"
url="http://www.tbsdtv.com"
arch=('i686' 'x86_64')
license=('GPL')
makedepends=('linux-headers' 'wget' 'moreutils' 'coreutils')
optdepends=('linuxtv-dvb-apps: handy DVB tools' 'v4l-utils: hardware support for some cards')
conflicts=('ffdecsawrapper' 'tbs-linux-drivers' 'tbs-dvb-drivers')
provides=('tbs-dvb-drivers')
install='tbs-dvb-drivers.install'

_tbsver=v170330
source=("http://www.tbsdtv.com/download/document/common/tbs-linux-drivers_$_tbsver.zip"
	'tbs-dvb-drivers.install') 

sha256sums=('50a21c0f37c2bf185b377f5287872a86f404988481a67ce391ff1ce28ce37636'
            '3fdfa6f14af91b3301f0f29c2a2386a7f84504688c766e714287ad8d450e2a57')

pkgver() {

        _kernel=`uname -r | sed -r 's/-/_/g'`
        echo "$_tbsver"_"$_kernel"

}

prepare() {

        cd $srcdir
        tar xjf linux-tbs-drivers.tar.bz2
        chmod -R u+rwX $srcdir/linux-tbs-drivers
}

build() {

        cd $srcdir/linux-tbs-drivers
        make distclean

        if [ `uname -m` == "x86_64" ]; then
            ./v4l/tbs-x86_64.sh
        else
            ./v4l/tbs-x86_r3.sh
        fi

        if [ -z "$_kernel" ]
        then
                _kernel=`uname -r`
        fi

        make

}

package() {
        _kernver=`uname -r`

        for r in /lib/modules/*; do
            s=${r:13}
            if [[ ${s:0:3} = "ext" ]]; then
                if [[ `cat ${r}/version | grep -c ${_kernver}` != 0 ]]; then
                    _destidir=${s}
                fi
            elif [[ ${s} = ${_kernver} ]] && [[ ! -e ${r}/extramodules ]]; then
                _destidir=${_kernver}/video
            fi  
        done

        mkdir -p $pkgdir/usr/lib/modules/${_destidir}/tbs
        mkdir -p $pkgdir/usr/lib/firmware

        install -m0644 $srcdir/*dvb*.fw  $pkgdir/usr/lib/firmware
        find "$srcdir/linux-tbs-drivers" -name '*.ko' -exec cp {} $pkgdir/usr/lib/modules/${_destidir}/tbs \;

        echo ""
        msg "Compressing modules, this will take awhile..."
        echo ""
        find "$pkgdir" -name '*.ko' -print0 | xargs -0 -P`nproc` -n10 gzip -9

        chmod -R go-w $pkgdir/usr/lib/modules/${_destidir}/tbs

}