summaryrefslogtreecommitdiff
path: root/libre/bumblebee/PKGBUILD
blob: 1c7f43930d4e8f0c0690d231b1e3def74fdafc4e (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
# Maintainer (Arch): Sven-Hendrik Haase <sh@lutzhaase.com>
# Maintainer: André Silva <emulatorman@parabola.nu>

pkgname=bumblebee
pkgver=3.2.1
pkgrel=6.parabola1
pkgdesc="NVIDIA Optimus support for GNU/Linux through VirtualGL, without nonfree nvidia driver support"
arch=('i686' 'x86_64' 'mips64el')
depends=('virtualgl' 'glib2' 'mesa-libgl')
makedepends=('help2man')
optdepends=('xf86-video-nouveau: nouveau driver'
            'nouveau-dri: 3D acceleration features of nouveau'
            'bbswitch: switch on/off discrete card'
            'primus: faster back-end for optirun')
if [ "$CARCH" = "x86_64" ]; then
     optdepends[${#optdepends[@]}]='lib32-virtualgl: run 32bit applications with optirun'
     optdepends[${#optdepends[@]}]='lib32-primus: faster back-end for optirun'
fi
replaces=('nvidia-libgl' 'nvidia-340xx-libgl' 'nvidia-304xx-libgl' "$pkgname-libre")
conflicts=('nvidia-libgl' 'nvidia-340xx-libgl' 'nvidia-304xx-libgl' "$pkgname-libre")
provides=('nvidia-libgl' 'nvidia-340xx-libgl' 'nvidia-304xx-libgl')
url="http://www.$pkgname-project.org"
license=("GPL3")
install="$pkgname.install"
backup=("etc/$pkgname/$pkgname.conf"
        "etc/$pkgname/xorg.conf.nouveau")
source=("http://www.$pkgname-project.org/${pkgname}-${pkgver}.tar.gz"
        "bumblebee-hexadecimal.patch::https://github.com/Bumblebee-Project/Bumblebee/commit/2073f8537412aa47755eb6f3f22a114403e5285b.patch"
        'libre.patch')
md5sums=('30974e677bb13e8a3825fd6f3e7d3b24'
         'd0a7d504a717e34b05fb4bc9ee68f881'
         '1daed1e00f74538add6c435dfa0569d1')

prepare() {
    cd "${srcdir}/${pkgname}-${pkgver}"

    # Remove nonfree references to nonfree nvidia driver and unnecessaries files
    rm -rv "README.markdown"
    rm -rv "conf/"{99-$pkgname-nvidia-dev.rules,xorg.conf.nvidia}
    rm -rv "doc"
    rm -rv "scripts/$pkgname-bugreport.in"
    patch -Np1 -i "${srcdir}/libre.patch"
}

build() {
    cd "${srcdir}/${pkgname}-${pkgver}"

    patch -Np1 < ${srcdir}/bumblebee-hexadecimal.patch

    ./configure \
        CONF_DRIVER=nouveau \
        --prefix=/usr \
        --sbindir=/usr/bin \
        --sysconfdir=/etc \
        --without-pidfile

    make
}

package() {
    cd "${srcdir}/${pkgname}-${pkgver}"

    make install DESTDIR="$pkgdir"

    # Install systemd unit
    install -D -m644 "scripts/systemd/${pkgname}d.service" "${pkgdir}/usr/lib/systemd/system/${pkgname}d.service"
    sed -i "s/sbin/bin/" "${pkgdir}/usr/lib/systemd/system/${pkgname}d.service"

    # Make bash_completion work
    mv -v "${pkgdir}/etc/bash_completion.d/$pkgname" "${pkgdir}/etc/bash_completion.d/optirun"
}