pkgname=powkiddy-x55-mapper
pkgver=1.0.1
pkgrel=0
pkgdesc="Powkiddy X55 gamepad joiner/mapper"
url="https://github.com/vognev/x55-mapper"
arch="aarch64"
license="MIT"
options="!check"
makedepends="cargo"
source="powkiddy-x55-mapper-$pkgver.tar.gz::https://github.com/vognev/x55-mapper/archive/refs/tags/v$pkgver.tar.gz"
install="$pkgname.post-install $pkgname.pre-deinstall"
builddir="$srcdir/x55-mapper-$pkgver"

build() {
	cargo build --release --locked
}

package() {
	install -Dm755 contrib/postmarketos/powkiddy-x55-mapper.initd "$pkgdir"/etc/init.d/powkiddy-x55-mapper
	install -Dm644 contrib/postmarketos/99-disable-real-gamepad.rules -t "$pkgdir"/etc/udev/rules.d/
	install -Dm755 target/release/x55-mapper -t "$pkgdir"/usr/bin/
}

sha512sums="
ebec121a3c7b50c43feffed9082743580a90f0916c4d8e7dd832d8c21ae60b6b23ccd9c36c3b24ec13d17a8f0f50ece53d6b86b2adef8a82d841890394855f9b  powkiddy-x55-mapper-1.0.1.tar.gz
"
