# Maintainer: bl <bendik@lynghaug.me>
# Built from the checkout it sits in: .gitea/workflows/release.yml runs makepkg
# at the repo root on a v* tag, natively per arch, and uploads to the [uhhm]
# registry. pkgver must match Cargo.toml and the tag; CI checks all three.
#
# source=() and $startdir on purpose: makepkg's own $srcdir is ./src, which is
# where the Rust sources live, so copying into it would nest src/src. Cargo
# builds in place into ./target (gitignored) instead.

pkgname=presence
pkgver=0.1.1
pkgrel=1
pkgdesc="BLE proximity events for a kiosk screen, swayidle style"
arch=('x86_64' 'aarch64')
url="https://project.uhhm.no/uhhm/presence"
license=('MIT')
depends=('bluez' 'dbus' 'gcc-libs' 'glibc')
makedepends=('cargo')
source=()

build() {
    cd "$startdir"
    CARGO_TARGET_DIR="$startdir/target" cargo build --release --locked
}

package() {
    cd "$startdir"
    install -Dm755 target/release/presence "$pkgdir/usr/bin/presence"
    install -Dm644 README.md "$pkgdir/usr/share/doc/presence/README.md"
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/presence/LICENSE"
    install -Dm644 config.example "$pkgdir/usr/share/doc/presence/config.example"
    install -Dm644 presence.service "$pkgdir/usr/lib/systemd/user/presence.service"
}
