# Maintainer: George Hu <integral@archlinux.org>

pkgname=counts
pkgver=1.0.7
pkgrel=1
pkgdesc="A tool for ad hoc profiling"
arch=('x86_64' 'aarch64' 'riscv64')
url="https://github.com/nnethercote/${pkgname}"
license=('Unlicense')
makedepends=('cargo')
source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/${pkgver}.tar.gz")
sha256sums=('a5685538819838ba2fba0b78d11b5d80e37753b9015735f71f0c2065442fe9d8')

prepare() {
	cd "${pkgname}-${pkgver}/"
	cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
	cd "${pkgname}-${pkgver}/"
	cargo build --frozen --release --all-features
}

check() {
	cd "${pkgname}-${pkgver}/"
	cargo test --frozen --all-features
}

package() {
	install -Dm755 "${pkgname}-${pkgver}/target/release/${pkgname}" -t "${pkgdir}/usr/bin/"
}
