# Maintainer: Kimiblock Moe

pkgname=bawn
pkgver=0.0.3
pkgrel=1
pkgdesc='Bawn is a transient Portable sandbox generator'
url='https://github.com/Kimiblock/bawn'
license=(GPL-3.0-or-later)
makedepends=('cargo' 'git')
arch=('i686' 'x86_64' 'armv6h' 'armv7h')
source=(git+https://github.com/Kimiblock/bawn.git#tag=${pkgver})
sha256sums=('09af46924bc9fbc938ed793351945810c8e5b1fcd05acc2ee4117ead8c32045c')
depends=(glibc libgcc)

prepare() {
	cd bawn
	export RUSTUP_TOOLCHAIN=stable
	cargo fetch --locked --target host-tuple
}

build() {
	cd bawn
	export RUSTUP_TOOLCHAIN=stable
	export CARGO_TARGET_DIR=target
	cargo build --frozen --release --all-features
}

check() {
	cd bawn
	export RUSTUP_TOOLCHAIN=stable
	cargo test --frozen --all-features
}

package() {
	package+=(portable)
	cd bawn
	install -Dm0755 -t "$pkgdir/usr/bin/" "target/release/bawn"
	# for custom license, e.g. MIT
	install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
