# Template file for 'influxdb'
pkgname=influxdb
version=1.3.5
revision=1
_branch=1.3
_commit=9d90010
build_style=go
nocross=https://travis-ci.org/kulinacs/void-packages/jobs/258683433
go_import_path="github.com/influxdata/influxdb"
build_wrksrc="_build-${pkgname}-xbps/src/${go_import_path}"
hostmakedepends="git go-gdm"
makedepends="git"
system_accounts="_influxdb"
_influxdb_homedir="/var/lib/${pkgname}"
make_dirs="${_influxdb_homedir} 0755 _influxdb _influxdb"
conf_files="/etc/${pkgname}/${pkgname}.conf"
short_desc="Scalable datastore for metrics, events, and real-time analytics"
maintainer="Nicklaus McClendon <nicklaus@kulinacs.com>"
license="MIT"
homepage="https://influxdata.com/time-series-platform/influxdb/"
distfiles="https://${go_import_path}/archive/v${version}.tar.gz"
checksum=2271c52932486731cb132cf0bf094cbecf4bd26bea01d8f986e4e50739778577

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}
	vinstall etc/config.sample.toml 644 etc/${pkgname} ${pkgname}.conf
}
