summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 55158ca3fd342e854849ec59fe700ecc8bf71d3f (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
# Maintainer: Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de>
pkgname=litra
pkgver=1.1.0
pkgrel=1
pkgdesc="Control your Logitech Litra lights from the command line."
arch=(i686 x86_64 armv7h aarch64)
url="https://crates.io/crates/$pkgname/$pkgver"
license=('MIT')
makedepends=(cargo)
depends=(
  glibc
  gcc-libs
  systemd-libs
)
source=(
    "$pkgname-$pkgver.tar.gz::https://static.crates.io/crates/$pkgname/$pkgname-$pkgver.crate"
    "litra.service"
)
md5sums=('9ba11a0ea24cc9c715d2d01b35e1a9fb'
         '58612b935a9197b6a3ffa8b8254228d0')

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
    cargo build --frozen --release --all-features
}

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

    export RUSTUP_TOOLCHAIN=stable
    cargo test --frozen --all-features
}

package() {
    install -Dm0644 -t "$pkgdir/usr/lib/systemd/system" "litra.service"

    cd "$pkgname-$pkgver"

    install -Dm0755 -t "$pkgdir/usr/bin/" "target/release/$pkgname"
    install -Dm0644 -t "$pkgdir/usr/lib/udev/rules.d" "99-litra.rules"
    install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname/" "LICENSE.md"
    install -Dm0644 -t "$pkgdir/usr/share/doc/$pkgname/" "README.md"
}