summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: bed574af6b92503e07e42793b13717a16498c9b8 (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
# Maintainer: Smoolak <smoolak@gmail.com>
# Contributor: Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de>

pkgname=litra
pkgver=3.3.0
pkgrel=1
pkgdesc="CLI and library to control Logitech Litra Glow, Beam and Beam LX lights"
arch=(x86_64 aarch64)
url="https://github.com/timrogers/litra-rs"
license=('MIT')
options=(!lto)
makedepends=(cargo)
depends=(
  glibc
  gcc-libs
  systemd-libs
  hidapi
)
source=("$pkgname-$pkgver.tar.gz::https://static.crates.io/crates/$pkgname/$pkgname-$pkgver.crate")
sha256sums=('849dec7670c99bc903edc120a1c64508b8af5cb38e683d8bc42dc99ae649d413')
install=litra.install

prepare() {
    cd "$pkgname-$pkgver"

    export RUSTUP_TOOLCHAIN=stable
    cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
    cd "$pkgname-$pkgver"

    export RUSTUP_TOOLCHAIN=stable
    export CARGO_TARGET_DIR=target
    # Link against system hidapi-hidraw
    export RUSTFLAGS="-C link-arg=-lhidapi-hidraw"
    cargo build --frozen --release --all-features
}

check() {
    cd "$pkgname-$pkgver"

    export RUSTUP_TOOLCHAIN=stable
    export CARGO_TARGET_DIR=target
    export RUSTFLAGS="-C link-arg=-lhidapi-hidraw"
    # Skip doctests which have linking issues with hidapi
    cargo test --frozen --all-features --lib --bins
}

package() {
    cd "$pkgname-$pkgver"

    install -Dm0755 -t "$pkgdir/usr/bin/" "target/release/$pkgname"
    install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname/" "LICENSE.md"
    install -Dm0644 -t "$pkgdir/usr/share/doc/$pkgname/" "README.md"

    # Install udev rules to a neutral location; .install script will copy if needed
    install -Dm0644 "99-litra.rules" "$pkgdir/usr/share/$pkgname/99-litra.rules"
}