arch-pkgs/victoria-metrics/PKGBUILD

92 lines
2.3 KiB
Bash

# Maintainer: George Rawlinson <grawlinson@archlinux.org>
pkgbase=victoria-metrics
pkgname=('victoria-metrics' 'victoria-metrics-utils')
pkgver=1.81.2
pkgrel=1
pkgdesc='A fast, cost-effective monitoring solution and time series database'
arch=('x86_64')
url='https://victoriametrics.com'
license=('Apache')
depends=('glibc')
makedepends=('git' 'go')
options=('!lto')
_commit='dd1126dccf4c94c89f3c1ccea958214414d3b1c8'
source=(
"$pkgbase::git+https://github.com/VictoriaMetrics/VictoriaMetrics.git#commit=$_commit"
'systemd.service'
'tmpfiles.conf'
'sysusers.conf'
)
b2sums=('SKIP'
'9fbcc9b95f935c07658f0bf30b7e17e2c86ae75b4a270a78cbbd7dbe9ef0a698e9f4e617943047b1f6ea07515964466f456f378d2f5565b05fd873eedc50e26f'
'f39262508fd73a0ac2841e6f93bab9428ff6b84b009beb3d9d13913c3e361b6f16e7ceb5939fa2cff9d99d183e4d2263afa1b8d871c348a74646033bab46583c'
'7d947bfabfb96e14842cc13dac12612b40d28361f81675f5d5cf930453d0ba6f32cb735634d61d17bc602ce147dcf6f36ca3a161ba5a4a346f1896f71b06430b')
_binaries=(
'victoria-metrics'
'vmagent'
'vmalert'
'vmauth'
'vmbackup'
'vmrestore'
'vmctl'
)
pkgver() {
cd "$pkgbase"
git describe --tags | sed 's/^v//'
}
prepare() {
# create directory for build output
mkdir build
cd "$pkgbase"
# download dependencies
go mod download
}
build() {
cd "$pkgbase"
# set Go flags
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
for binary in "${_binaries[@]}"; do
go build -v \
-trimpath \
-buildmode=pie \
-mod=readonly \
-modcacherw \
-ldflags "-linkmode external -extldflags $LDFLAGS" \
-o "$srcdir/build" \
"./app/$binary"
done
}
check() {
cd "$pkgbase"
for binary in "${_binaries[@]}"; do
go test -v "./app/$binary/..."
done
}
package_victoria-metrics() {
# systemd integration
install -vDm644 systemd.service "$pkgdir/usr/lib/systemd/system/$pkgbase.service"
install -vDm644 sysusers.conf "$pkgdir/usr/lib/sysusers.d/$pkgbase.conf"
install -vDm644 tmpfiles.conf "$pkgdir/usr/lib/tmpfiles.d/$pkgbase.conf"
# binary
install -vDm755 -t "$pkgdir/usr/bin" build/victoria-metrics
}
package_victoria-metrics-utils() {
pkgdesc+=" (utilities)"
install -vDm755 -t "$pkgdir/usr/bin" build/vm*
}