# Template file for 'greetd'
pkgname=greetd
version=0.10.3
revision=2
build_style=cargo
conf_files="/etc/greetd/config.toml"
hostmakedepends="pkg-config scdoc"
makedepends="pam-devel"
short_desc="Minimal and flexible login manager daemon"
maintainer="cinerea0 <cinerea0@protonmail.com>"
license="GPL-3.0-or-later"
homepage="https://git.sr.ht/~kennylevinsen/greetd"
changelog="https://git.sr.ht/~kennylevinsen/greetd/refs"
distfiles="https://git.sr.ht/~kennylevinsen/greetd/archive/${version}.tar.gz"
checksum=ee5cb70e0add4ca9c9fe57e47581ab0002d44c07743fb5492469f3b570db640b

system_accounts="_greeter"
_greeter_groups="video"
_greeter_homedir="/var/lib/_greeter"
make_dirs="/var/lib/_greeter 0755 _greeter _greeter"

post_patch() {
	# on cross, tries to find scdoc for the target and fails
	vsed -i -e 's,pkg-config,/usr/bin/&,' man/Makefile
}

pre_build() {
	make -C man
}

do_install() {
	vbin "target/${RUST_TARGET}/release/agreety"
	vbin "target/${RUST_TARGET}/release/fakegreet"
	vbin "target/${RUST_TARGET}/release/greetd"
	vinstall config.toml 644 etc/greetd/

	make -C man install PREFIX=/usr DESTDIR="$DESTDIR"

	vinstall ${FILESDIR}/greetd.pam 644 etc/pam.d/ greetd
	vsv greetd
	vdoc "${FILESDIR}/README.voidlinux"
}
