# Maintainer: Epsilon Null Operation <perpetualbits@gmail.com>
pkgname=apptop
pkgver=1.0.3
pkgrel=1
pkgdesc="Process-group performance monitor with Proxmox VM support and SSH drill-down"
arch=('x86_64' 'aarch64' 'riscv64')
url="https://github.com/perpetualbits/apptop"
license=('GPL3')
depends=()
makedepends=('rust' 'cargo')
options=('!lto')
source=("$pkgname-$pkgver.tar.gz::https://github.com/perpetualbits/apptop/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 --release --frozen
}

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