# Template file for 'wtplan'
pkgname=wtplan
version=0.1
revision=3
archs="aarch64* armv[567]* i686* x86_64* ppc64le*"
build_style=gnu-makefile
hostmakedepends="go"
short_desc="Calendar program with terminal and web interfaces and git integration"
maintainer="Toyam Cox <Vaelatern@voidlinux.org>"
license="MIT"
homepage="https://github.com/kjellwinblad/wtplan/"
distfiles="https://github.com/kjellwinblad/wtplan/archive/${version}.tar.gz"
checksum=31c66181f815889828eb2bd3739d6b23582ec75a5a8d6c6bf76c2a6679112bb4

do_build() {
	export GOPATH=$(pwd)
	export VERSIONSTR=$version
	go generate ./src/wtplan/main.go
	go generate ./src/wtplan-web/main.go
	cat <<-EOF >src/wtplan/version.go
	package main

	var version = \`wtplan ${version}\`
	EOF
	. $XBPS_COMMONDIR/environment/build-style/go.sh
	GOPATH=$(pwd)
	# Without -buildmode=pie, build failure on armv6hf-musl
	go build -buildmode=pie -o wtplan \
		./src/wtplan/main.go ./src/wtplan/version.go
	go build -buildmode=pie -o wtplan-web \
		-ldflags "-X main.version=$version" \
		./src/wtplan-web/main.go ./src/wtplan-web/textfiles.go
}

post_install() {
	vlicense LICENSE
}
