# Contributor: Sashanoraa <sasha@noraa.gay>
# Maintainer:
pkgname=stargazer-gmi
pkgver=1.3.0
pkgrel=1
pkgdesc="Fast and easy to use Gemini server"
url="https://sr.ht/~zethra/stargazer/"
arch="all"
license="AGPL-3.0-or-later"
makedepends="cargo cargo-auditable scdoc"
checkdepends="py3-cryptography"
subpackages="
	$pkgname-doc
	$pkgname-openrc
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="$pkgname-$pkgver.tar.gz::https://git.sr.ht/~zethra/stargazer/archive/$pkgver.tar.gz"
builddir="$srcdir/stargazer-$pkgver"
options="!check" # connection refused to localhost

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	CGFLAGS='--frozen --release' ./scripts/build
}

check() {
	CARGO_ARGS='--release' ./scripts/test --skip IPv6Address,SCGIVars
}

package() {
	DESTDIR="$pkgdir" ./scripts/install \
		--prefix=/usr --sysconfdir=/etc \
		--bashdir="$pkgdir"/usr/share/bash-completion/completions \
		--zshdir="$pkgdir"/usr/share/zsh/site-functions \
		--fishdir="$pkgdir"/usr/share/fish/vendor_completions.d

	install -Dvm644 ./contrib/init/stargazer.initd \
		"$pkgdir"/etc/init.d/stargazer
}

sha512sums="
3cb9ba38a258d446ee03892147da1e3982e9a2c2b5090fc3bda1b569b83ebebc49c0373e297c789e79615331a2621cf4ec612e4e2f56170061f50271b5909a32  stargazer-gmi-1.3.0.tar.gz
"
