# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=zabbix-agent2-plugin-postgresql
pkgver=6.4.11
pkgrel=5
pkgdesc="Zabbix Agent 2 PostgreSQL loadable plugin"
url="https://git.zabbix.com/projects/AP/repos/postgresql/browse"
arch="all"
license="Apache-2.0"
makedepends="go gettext-dev"
subpackages=""
source="https://cdn.zabbix.com/zabbix-agent2-plugins/sources/postgresql/$pkgname-$pkgver.tar.gz
	0001-set-plugin-system-path.patch
	"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	export CGO_LDFLAGS="$LDFLAGS -s -w"
	make
}

package() {
	install -D -m644 postgresql.conf \
		"$pkgdir"/etc/zabbix/zabbix_agent2.d/plugins.d/postgresql.conf
	install -D -m755 zabbix-agent2-plugin-postgresql \
		"$pkgdir"/usr/libexec/zabbix-agent2/postgresql
}

check() {
	make check
}

sha512sums="
d6c2f4ef4293c1890ef473cbdb5b261fa30c7cd2ca649495961f1ca4fcac15e099dd677c6bac171b651b8137bd4ad78c2e62326ea1bf0c430b78e2b99be3f317  zabbix-agent2-plugin-postgresql-6.4.11.tar.gz
a63a2a20e78c8349b1a8d08470d89b5feb73cf2483bec9069a2b159151e46d69f510541a9a624153ffb2a002fff0684e3fd2559f256f4073790e88304e991f59  0001-set-plugin-system-path.patch
"
