summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 2ddfe101a61b88a6a3bf0a5850ea495ac22e4e26 (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: Sabrina Andersen <sabrina@utd.tf>
pkgname=fw16-led-matrixd-git
pkgver=0.0.0
pkgrel=1
pkgdesc="A cross-platform daemon for controlling the Framework 16 LED Matrixes"
arch=('x86_64' 'i686')
url="https://github.com/NukingDragons/fw16-led-matrixd"
license=('MIT')
makedepends=('git' 'rust')
optdepends=('systemd: systemd service support')
conflicts=('fw16-led-matrixd')
backup=('etc/fw16-led-matrixd/config.toml')
options=('!debug')
source=($pkgname'::git+https://github.com/nukingdragons/fw16-led-matrixd')
sha256sums=('SKIP') # Skip for GIT repo

# Use the Cargo.toml version instead of the pkgver variable above
pkgver()
{
	cd "$pkgname"
	sed -z 's/.*version = "\([^"]*\)".*/\1/g' Cargo.toml
}

prepare()
{
	cd "$pkgname"

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

build()
{
	cd "$pkgname"

	export RUSTUP_TOOLCHAIN=nightly
	export CARGO_TARGET_DIR="target"
	cargo build --frozen --release --all-features
}

check()
{
	cd "$pkgname"

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

package()
{
	cd "$pkgname"

	install -Dm755 target/release/fw16-led-matrixd "${pkgdir}/usr/bin/fw16-led-matrixd"
	install -Dm755 target/release/ledcli "${pkgdir}/usr/bin/ledcli"
	install -Dm644 sample-posix-config.toml "${pkgdir}/etc/fw16-led-matrixd/config.toml"
	install -Dm644 daemon/fw16-led-matrixd.service "${pkgdir}/usr/lib/systemd/system/fw16-led-matrixd.service"
	install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}