# Contributor: Orhun Parmaksız <orhunparmaksiz@gmail.com>
# Maintainer: Orhun Parmaksız <orhunparmaksiz@gmail.com>
pkgname=linuxwave
pkgver=0.3.0
pkgrel=0
pkgdesc="Generate music from the entropy of Linux"
url="https://github.com/orhun/linuxwave"
license="MIT"
arch="x86_64 aarch64" # Limited by zig aport
makedepends="zig"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/orhun/linuxwave/releases/download/v$pkgver/v$pkgver.tar.gz"
builddir="$srcdir/$pkgname"

# We may want other than "baseline" for other targets, when enabled by zig
case "$CARCH" in
aarch64 | x86_64) cputarget=baseline ;;
esac

build() {
	zig build -Doptimize=ReleaseSafe -Dpie=true -Drelro=true ${cputarget:+-Dcpu="$cputarget"}
}

check() {
	zig build test
}

package() {
	install -Dm755 "zig-out/bin/$pkgname" -t "$pkgdir/usr/bin"
	install -Dm644 "man/$pkgname.1" -t "$pkgdir/usr/share/man/man1"
	install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
}

sha512sums="
c9b70d8f7d942cbc0f04e3fb310bc6b75a75f8f84494e77fb5f2e21407696f4401d54f061f2f25d6f9d81fab98b2f3b3dad363e3f4439b25597a97ae0361be13  linuxwave-0.3.0.tar.gz
"
