# Template file for 'darkman'
pkgname=darkman
version=2.3.1
revision=1
build_style=go
build_helper=qemu
go_import_path="gitlab.com/WhyNotHugo/darkman"
go_package="${go_import_path}/cmd/darkman"
go_ldflags="-X main.Version=${version}"
depends="dbus"
short_desc="Daemon for dark-mode and light-mode transitions on Linux desktop"
maintainer="Orphaned <orphan@voidlinux.org>"
license="0BSD"
homepage="https://darkman.whynothugo.nl/"
changelog="https://gitlab.com/WhyNotHugo/darkman/-/raw/main/CHANGELOG.md"
distfiles="https://gitlab.com/WhyNotHugo/darkman/-/archive/v${version}/darkman-v${version}.tar"
checksum=4457a79dd8714c76f9e05c7d02ef7666006c930b155a5be4aa670789fbd2062c
_completions="zsh bash fish"

post_build() {
	local _bin="$(find ${GOPATH}/bin -name darkman)"
	for _shell in ${_completions}; do
		vtargetrun "${_bin}" completion ${_shell} > darkman.${_shell}
	done
}

post_install() {
	vmkdir usr/share/dbus-1/services
	vinstall contrib/dbus/org.freedesktop.impl.portal.desktop.darkman.service 644 usr/share/dbus-1/services
	vinstall contrib/dbus/nl.whynothugo.darkman.service 644 usr/share/dbus-1/services

	vmkdir usr/share/xdg-desktop-portal/portals
	vinstall contrib/portal/darkman.portal 644 usr/share/xdg-desktop-portal/portals

	vmkdir usr/share/darkman/examples
	vcopy "examples/*" usr/share/darkman/examples

	vman darkman.1
	vman darkman.conf.5

	vlicense LICENCE

	for _shell in ${_completions}; do
		vcompletion darkman.${_shell} ${_shell}
	done
}
