# Template file for 'telegraf'
pkgname=telegraf
version=1.4.3
revision=1
_branch=release-1.4
_commit=b473b6a
build_style="go"
nocross=https://travis-ci.org/kulinacs/void-packages/jobs/258706435
go_import_path="github.com/influxdata/${pkgname}"
build_wrksrc="_build-${pkgname}-xbps/src/${go_import_path}"
hostmakedepends="go-gdm git"
system_accounts="_telegraf"
short_desc="The plugin-driven server agent for collecting & reporting metrics"
maintainer="Nicklaus McClendon <nicklaus@kulinacs.com>"
license="MIT"
homepage="https://www.influxdata.com/time-series-platform/telegraf/"
distfiles="https://github.com/influxdata/${pkgname}/archive/${version}.tar.gz"
checksum=5c4833a2dbaddf3fa55b90a971b804934934f097c9c7d502615044853e472617

post_extract() {
	local path="${GOPATH}/src/${go_import_path}"
	mkdir -p "$(dirname ${path})"
	ln -fs $PWD "${path}"
}

pre_build() {
	gdm restore
}

do_build() {
	go install -ldflags="-X main.version=${version} -X main.branch=${_branch} -X main.commit=${_commit}" ./...
}

post_install() {
	vlicense LICENSE
	vsv ${pkgname}
}
