blob: 3cac54373a0b7b1931043d445919b680f830d395 (
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
35
36
37
38
39
40
41
42
43
44
45
|
# Maintainer: Shalygin Konstantin <k0ste@k0ste.ru>
# Contributor: Shalygin Konstantin <k0ste@k0ste.ru>
pkgname='nginx-vts-exporter'
pkgver='0.10.8'
pkgrel='3'
pkgdesc='Prometheus exporter for Nginx vts stats'
arch=('x86_64' 'aarch64')
_uri='github.com/sysulq'
url="https://${_uri}/${pkgname}"
license=('MIT')
makedepends=('go')
source=("${url}/archive/v${pkgver}.tar.gz"
"${pkgname}.service")
sha256sums=('2fc964f1129f732beaf10722380d61754c4f0744c48a2ab11028428eff45ce11'
'7838c08b3299d2d6d5bb0b6c281f1fcee8f9dc254bfb5e1a8d59699e52495f06')
prepare() {
export GOPATH="${srcdir}/gopath"
export GOBIN="${GOPATH}/bin"
mkdir -p "${GOPATH}/src/${_uri}"
ln -snf "${srcdir}/${pkgname}-${pkgver}" "${GOPATH}/src/${_uri}/${pkgname}"
}
build() {
cd "${GOPATH}/src/${_uri}/${pkgname}"
eval "$(go env | grep -e "GOHOSTOS" -e "GOHOSTARCH")"
GOOS="${GOHOSTOS}" GOARCH="${GOHOSTARCH}" BUILDTAGS="netgo static_build" \
go build -x \
-buildmode="pie" \
-trimpath \
-mod="readonly" \
-modcacherw \
-ldflags "-linkmode external -extldflags '${LDFLAGS}' \
-X github.com/prometheus/common/version.Version=${pkgver} \
-X github.com/prometheus/common/version.Revision=${pkgrel} \
-X github.com/prometheus/common/version.Branch=tarball \
-X github.com/prometheus/common/version.BuildUser=$(whoami)@$(hostnamectl hostname) \
-X github.com/prometheus/common/version.BuildDate=$(date -u '+%Y%m%d-%H:%M:%S' --date=@${SOURCE_DATE_EPOCH})"
}
package() {
install -Dm0755 "${GOPATH}/src/${_uri}/${pkgname}/${pkgname}" "${pkgdir}/usr/bin/${pkgname}"
install -Dm0644 "${pkgname}.service" "${pkgdir}/usr/lib/systemd/system/${pkgname}.service"
}
|