summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 888facfc95262d6749b92a6df6a73c08eb7194a9 (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
86
87
88
89
90
91
# Maintainer: Yiyao Yu <yuydevel at protonmail dot com>

_pkgname=bumblebee
pkgname=${_pkgname}-forceunload
pkgver=3.2.1
pkgrel=20
pkgdesc="NVIDIA Optimus support for Linux through VirtualGL (with kernel module unload patch)"
arch=('x86_64')
depends=('virtualgl' 'glib2' 'mesa-libgl')
makedepends=('help2man')
optdepends=('bbswitch: switch on/off discrete card'
            'nvidia: NVIDIA kernel driver'
            'nvidia-390xx: NVIDIA kernel driver for old devices'
            'nvidia-340xx: NVIDIA kernel driver for even older devices'
            'primus: faster back-end for optirun'
            'lib32-virtualgl: run 32bit applications with optirun'
            'lib32-primus: faster back-end for optirun')
url="https://github.com/yawor/Bumblebee/tree/forceunload"
license=("GPL3")
provides=('bumblebee')
conflicts=('bumblebee')
install=bumblebee.install
backup=('etc/bumblebee/bumblebee.conf'
        'etc/bumblebee/xorg.conf.nouveau'
        'etc/bumblebee/xorg.conf.nvidia')
source=("https://www.bumblebee-project.org/${_pkgname}-${pkgver}.tar.gz"
        "0001-bb_nvidia_modeset-detection_bug699_01.patch::https://github.com/arafey/Bumblebee/commit/5636b24fa86a005a5d2e30bd794516db13ccba56.patch"
        "0002-bb_nvidia_modeset-detection_bug699_02.patch::https://github.com/arafey/Bumblebee/commit/09d537e8e5313cd0f2c7bf6620ca70454de8a04a.patch"
        "0003-bb_nvidia_umv_detection_bug699.patch::https://github.com/arafey/Bumblebee/commit/dbbf20a38aa2bffb10c4e8af583b34dff6bfe721.patch"
        "0004-bb_nvidia_drm_detection_bug699_01.patch::https://github.com/arafey/Bumblebee/commit/bcfe4dd16dd6194f1edbdc53b874a4f408343c5c.patch"
        "0005-bb_nvidia_drm_detection_bug699_02.patch::https://github.com/arafey/Bumblebee/commit/fcfe596eb13f62ca9dd7de272a5a87ae843b2a00.patch"
        "0006-bb_hexadicimal_bug573.patch::https://github.com/Bumblebee-Project/Bumblebee/commit/2073f8537412aa47755eb6f3f22a114403e5285b.patch"
        "0007-bb_mutebblogger.patch"
        "0008-libglvnd.patch"
        "0009-force_unload.patch"
        "bumblebee.conf"
        "bumblebee.sysusers")
sha256sums=('1018703b07e2f607a4641249d69478ce076ae5a1e9dd6cff5694d394fa7ee30e'
            'aff3528d17a77ff19b4e0a7a10682b8351456f11795f71ef62b315e774fb408a'
            '70ad9b3d8e0d70a504110651c6f5f3a1b1d3c4c44eeb0fd49a4463e99124a47b'
            '16fd522f412125b3c9b5709d78584744c70cb627e8baf8cd6025a71d278f79a6'
            '4676606012319ce7a9e3890d6e83445ae674f5ff2994925d59ec2229fbae5a14'
            '206f71c022b29a77227a3c7ba1f5cf68e219b957b5d807be9a30b6a6a7cafddc'
            '0b7c1f4bb2e27d131c6c21fd7006d075584917ac4259bd9899e6eca99efc0ece'
            'cbe3e1717bc80146b87d8f2ab1158ee9e094ea5bb2ca9a4a8c09c24b086a7792'
            'b260d64a53617807afe21560db0592d114d7775b182e13fb59349f0157c8dba4'
            '317091362c1cd92415cca74cd10ef9fd697145fc1ba3602e27abd6a045196dfc'
            '1c3d4f5d40245a23a5f1cb1f2f6bd4274ff3c5b3749f76a09255191328ae3193'
            '1bc209c21b4f6d1975ede4091829baf98d20b33100b9d21061393880bb391fd8')

build() {
    cd "${srcdir}/${_pkgname}-${pkgver}"
    for p in ${srcdir}/*.patch; do
        patch -Np1 -i "$p"
    done

    ./configure \
        CONF_DRIVER_MODULE_NVIDIA=nvidia \
        CONF_LDPATH_NVIDIA=/usr/lib/nvidia:/usr/lib32/nvidia:/usr/lib:/usr/lib32 \
        CONF_MODPATH_NVIDIA=/usr/lib/nvidia/xorg,/usr/lib/xorg/modules \
        --prefix=/usr \
        --sbindir=/usr/bin \
        --with-udev-rules=/usr/lib/udev/rules.d \
        --sysconfdir=/etc \
        --without-pidfile
    make
}

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

    # Install main app
    make install DESTDIR="$pkgdir" \
      completiondir=/usr/share/bash-completion/completions

    # Blacklist nvidia and nouveau modules
    # Reference: https://github.com/Bumblebee-Project/Bumblebee/issues/719
    install -Dm644 "${srcdir}/bumblebee.conf" "${pkgdir}/usr/lib/modprobe.d/bumblebee.conf"

    # Install systemd unit
    install -Dm644 "scripts/systemd/bumblebeed.service" "${pkgdir}/usr/lib/systemd/system/bumblebeed.service"
    sed -i "s/sbin/bin/" "${pkgdir}/usr/lib/systemd/system/bumblebeed.service"

    # Make bash_completion work
    mv -v "$pkgdir"/usr/share/bash-completion/completions/{bumblebee,optirun}

    # Fix for FS#59312
    sed -i "s/have/_have/" "${pkgdir}/usr/share/bash-completion/completions/optirun"

    install -Dm644 "$srcdir"/bumblebee.sysusers "$pkgdir"/usr/lib/sysusers.d/$_pkgname.conf
}