forked from ports/contrib
47 lines
1.8 KiB
Plaintext
47 lines
1.8 KiB
Plaintext
# Description: The analytics platform for all your metrics
|
|
# URL: https://grafana.com/
|
|
# Maintainer: Tim Biermann, tbier at posteo dot de
|
|
# Depends on: fontconfig go
|
|
|
|
name=grafana
|
|
version=9.0.7
|
|
release=1
|
|
source=(https://github.com/grafana/grafana/archive/v$version/$name-$version.tar.gz
|
|
https://dl.grafana.com/oss/release/grafana-$version.linux-amd64.tar.gz
|
|
grafana.confd grafana.service)
|
|
|
|
build() {
|
|
export CGO_LDFLAGS="${LDFLAGS}"
|
|
export CGO_CPPFLAGS="${CPPFLAGS}"
|
|
export CGO_CFLAGS="${CFLAGS}"
|
|
export CGO_CXXFLAGS="${CXXFLAGS}"
|
|
export GOFLAGS="-buildmode=pie -trimpath -modcacherw"
|
|
|
|
mkdir "$PKGMK_SOURCE_DIR/gopath" || true
|
|
export GOPATH="$PKGMK_SOURCE_DIR/gopath"
|
|
|
|
cd $SRC/$name-$version
|
|
|
|
sed -ri 's,^(\s*data\s*=).*,\1 /var/lib/grafana,' conf/defaults.ini
|
|
sed -ri 's,^(\s*plugins\s*=).*,\1 /var/lib/grafana/plugins,' conf/defaults.ini
|
|
sed -ri 's,^(\s*provisioning\s*=).*,\1 /var/lib/grafana/conf/provisioning,' conf/defaults.ini
|
|
sed -ri 's,^(\s*logs\s*=).*,\1 /var/log/grafana,' conf/defaults.ini
|
|
|
|
go get -u gonum.org/v1/gonum@v0.11.0
|
|
GOBIN="$(pwd)" go install github.com/google/wire/cmd/wire@v0.5.0
|
|
./wire gen -tags oss ./pkg/server ./pkg/cmd/grafana-cli/runner
|
|
local ldflags="-X main.version=$pkgver -X main.commit=$_commit -X main.buildstamp=$_stamp"
|
|
go build -ldflags "$ldflags" -v ./pkg/cmd/grafana-server
|
|
go build -ldflags "$ldflags" -v ./pkg/cmd/grafana-cli
|
|
|
|
install -Dm644 $SRC/$name.confd $PKG/etc/conf.d/$name
|
|
install -Dsm755 grafana-server $PKG/usr/bin/grafana-server
|
|
install -Dsm755 grafana-cli $PKG/usr/bin/grafana-cli
|
|
install -Dm644 conf/sample.ini $PKG/etc/grafana.ini
|
|
install -dm755 $PKG/usr/share/grafana
|
|
cp -r conf public $PKG/usr/share/$name/
|
|
|
|
## install rc file
|
|
install -Dm 755 $SRC/grafana.service $PKG/etc/rc.d/grafana
|
|
}
|