# Template file for 'chronograf'
pkgname=chronograf
version=1.3.7.0
revision=1
_commit=a9358a3
build_style="go"
nocross=1
go_import_path="github.com/influxdata/${pkgname}"
build_wrksrc="go/src/${go_import_path}"
hostmakedepends="git nodejs yarn"
system_accounts="_chronograf"
_chronograf_homedir="/var/lib/${pkgname}"
make_dirs="${_chronograf_homedir} 0755 _chronograf _chronograf"
short_desc="Open source monitoring and visualization UI for the TICK stack"
maintainer="Nicklaus McClendon <nicklaus@kulinacs.com>"
license="MIT"
homepage="https://www.influxdata.com/time-series-platform/chronograf/"
distfiles="https://github.com/influxdata/${pkgname}/archive/${version}.tar.gz"
checksum=a99d5dd1bf721d389975fa0bdcb3b740568195cfad5181757d5d3ace1c57cada

do_extract() {
	mkdir -p ${wrksrc}/${build_wrksrc}
	tar xfz ${XBPS_SRCDISTDIR}/${pkgname}-${version}/*.tar.gz --strip-components=1 -C ${wrksrc}/${build_wrksrc}
}

do_build() {
	export GOPATH="/builddir/${pkgname}-${version}/go/"
	export PATH=$PATH:$(go env GOPATH)/bin
	make VERSION=${version} COMMIT=${_commit}
	go install github.com/influxdata/chronograf/cmd/chronograf
}

do_install() {
	vbin /builddir/${pkgname}-${version}/go/bin/chronograf
}

post_install() {
	vlicense LICENSE
	vsv chronograf
	vmkdir /usr/share/chronograf/
	vcopy ${wrksrc}/${build_wrksrc}/canned /usr/share/chronograf/canned
}
