summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: fe8bd732fb4027889d23b5d1174edec7405ab0e7 (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
# Maintainer: hodasemi <michaelh.95 at t-online dot de>
# Maintainer: wheaney <wayne at xronlinux dot com>
_pkgbase=XRLinuxDriver
pkgname="xr-driver-git"
pkgver=1.1.0
pkgrel=2
pkgdesc="XR Linux Driver"
arch=('x86_64' 'aarch64')
url="https://github.com/wheaney/XRLinuxDriver"
license=('GPL-3.0')
install=hooks.install
makedepends=('cmake' 'make')
depends=('openssl' 'libevdev' 'libusb' 'json-c' 'curl' 'hidapi' 'wayland' 'systemd-libs')
source=("git+${url}#commit=53002afde8406eef7fe309206268ad6dc39e2da6")
md5sums=(SKIP)

build() {
    cd ${_pkgbase}

    # init submpdules
    git submodule update --init --recursive modules/xrealInterfaceLibrary

    # build xr driver
    mkdir build/
    cd build
    BREEZY_DESKTOP=1 cmake -DSYSTEM_INSTALL=1 ..
    make
}

package() {
    # copy xr driver
    install -Dm755 ${_pkgbase}/build/xrDriver "${pkgdir}"/usr/bin/xrDriver
    sed -i '/ExecStart/c\ExecStart=xrDriver' ${_pkgbase}/systemd/xr-driver.service
    sed -i '/WantedBy/c\WantedBy=default.target' ${_pkgbase}/systemd/xr-driver.service
    sed -i '/Environment/d' ${_pkgbase}/systemd/xr-driver.service
    install -Dm644 ${_pkgbase}/systemd/xr-driver.service "${pkgdir}"/usr/lib/systemd/user/xr-driver.service
    install -Dm755 ${_pkgbase}/bin/xr_driver_cli "${pkgdir}"/usr/bin/xr_driver_cli

    if compgen -G "${_pkgbase}/lib/${CARCH}/*.so" > /dev/null; then
        install -Dm755 ${_pkgbase}/lib/${CARCH}/*.so -t "${pkgdir}"/usr/lib/
    fi

    # udev rules
    install -Dm644 ${_pkgbase}/udev/70-viture-xr.rules "${pkgdir}"/usr/lib/udev/rules.d/70-viture-xr.rules
    install -Dm644 ${_pkgbase}/udev/70-xreal-xr.rules "${pkgdir}"/usr/lib/udev/rules.d/70-xreal-xr.rules
    install -Dm644 ${_pkgbase}/udev/70-rayneo-xr.rules "${pkgdir}"/usr/lib/udev/rules.d/70-rayneo-xr.rules
    install -Dm644 ${_pkgbase}/udev/70-rokid-xr.rules "${pkgdir}"/usr/lib/udev/rules.d/70-rokid-xr.rules
    install -Dm644 ${_pkgbase}/udev/70-uinput-xr.rules "${pkgdir}"/usr/lib/udev/rules.d/70-uinput-xr.rules

    # make sure uinput module is loaded
    install -Dm644 /dev/null "$pkgdir/usr/lib/modules-load.d/$pkgname.conf"
    echo "uinput" > "$pkgdir/usr/lib/modules-load.d/$pkgname.conf"
}