summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7a2de880cb361cc353d5f0d819f0153522c78382 (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
46
47
48
49
50
51
52
# Maintainer: Matthew McGinn <mamcgi at gmail dot com>
# Contributor: Justin Dray <justin@dray.be>
# Contributor: Gilles Hamel <hamelg at laposte dot net>
_pkgname=grafana
pkgname=${_pkgname}-git
pkgver=v4.6.0.beta1.r415.g48d9d0d35
pkgrel=1
pkgdesc="A general purpose dashboard and graph composer. It supports graphite, influxdb or opentsdb"
url="http://grafana.org"
arch=('any')
license=('APACHE')
makedepends=('go' 'nodejs-grunt-cli' 'npm' 'git' 'yarn' 'python2')
provides=('grafana')
options=('!strip' '!emptydirs')
conflicts=('grafana')
install=${_pkgname}.install
source=("git+https://github.com/${_pkgname}/${_pkgname}"
        "grafana.service")
md5sums=('SKIP'
         'bb223073eac39f0ccf9cb8b57fe8d685')

pkgver() {
	cd "${_pkgname}"
	git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}


build() {
	export GOPATH="${srcdir}"
	export PATH="$PATH:$GOPATH"
	mkdir -p "$GOPATH/src/github.com/${_pkgname}/"
	ln -nfs "${srcdir}/grafana" "$GOPATH/src/github.com/${_pkgname}/${_pkgname}"
	cd "$GOPATH/src/github.com/${_pkgname}/${_pkgname}"
	go run build.go setup
	go run build.go build
	# Build frontend assets
	yarn install --pure-lockfile
	npm run build
}

package() {
	install -Dm644 "${srcdir}/grafana.service" "${pkgdir}/usr/lib/systemd/system/grafana.service"
	cd "${srcdir}/${_pkgname}"
	install -dm755 "${pkgdir}/var/lib/grafana"
	install -dm755 "${pkgdir}/var/log/grafana"
	install -Dsm755 bin/grafana-server "${pkgdir}/usr/bin/grafana-server"
	install -Dsm755 bin/grafana-cli "${pkgdir}/usr/bin/grafana-cli"
	install -Dm644 conf/sample.ini "${pkgdir}/etc/${_pkgname}/${_pkgname}.ini"
	mkdir -p "${pkgdir}/usr/share/grafana"
	cp -r * "${pkgdir}/usr/share/grafana/"
	rm -rf * "${pkgdir}/usr/share/grafana/data"
}