summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7dbc37da9e785d76ed38ac33ca2941c059c0cefc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Maintainer: jsjolund <j dot sjolund at gmail dot com>

pkgname=zabbix-agent2-plugin-nvidia-gpu
pkgver=7.4.15
pkgrel=1
epoch=1
pkgdesc="Loadable plugin for Nvidia GPU integration in Zabbix agent2"
arch=(x86_64)
url="https://cdn.zabbix.com/zabbix-agent2-plugins/sources/nvidia-gpu"
license=("Apache-2.0")
depends=("glibc" "zabbix-agent2>=$pkgver" "nvidia-utils")
makedepends=("go")
backup=("etc/zabbix/zabbix_agent2.d/plugins.d/nvidia.conf")
source=(
	"$url/$pkgname-$pkgver.tar.gz"
	"nvidia.conf"
)
sha256sums=("da02911ec98909e8ca04e6fcd0653f29216f3646fd87146e410dfb1993dee10b"
            "a1bc60b828016590d0606bc194c393e792c257114addb9347969d79711ac0f2d")

build() {
	cd "$pkgname-$pkgver"
	export CGO_CPPFLAGS="${CPPFLAGS}"
	export CGO_CFLAGS="${CFLAGS}"
	export CGO_CXXFLAGS="${CXXFLAGS}"
	export CGO_LDFLAGS="${LDFLAGS} -lnvidia-ml"
	export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
	go build -o "$pkgname" .
}

package() {
	install -Dm755 "$pkgname-$pkgver/$pkgname" "$pkgdir/usr/bin/$pkgname"
	install -Dm644 "nvidia.conf" "$pkgdir/etc/zabbix/zabbix_agent2.d/plugins.d/nvidia.conf"
}