# Maintainer: NavistAu <github@navistau.io>
pkgname=beachcomber
pkgver=0.7.0
pkgrel=1
pkgdesc="Daemon that caches shell environment state for instant prompt rendering"
arch=('x86_64' 'aarch64')
url="https://github.com/NavistAu/beachcomber"
license=('MIT')
depends=('gcc-libs')
makedepends=('cargo')
source=("$pkgname-$pkgver.tar.gz::https://github.com/NavistAu/$pkgname/archive/refs/tags/v$pkgver.tar.gz")
sha256sums=('SKIP')

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
}

check() {
    cd "$pkgname-$pkgver"
    export RUSTUP_TOOLCHAIN=stable
    export CARGO_TARGET_DIR=target
    cargo test --frozen -- --skip watcher_
}

package() {
    cd "$pkgname-$pkgver"
    install -Dm755 "target/release/comb" "$pkgdir/usr/bin/comb"
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
