summaryrefslogtreecommitdiff
blob: 3ed609e4c1ef7f815f3c131a02222b3d8654a88e (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=5
EGO_PN="github.com/grafana/grafana"

inherit golang-build user

DESCRIPTION="Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB & OpenTSDB"
HOMEPAGE="http://grafana.org"
SRC_URI="https://${EGO_PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64"
IUSE=""

RDEPEND=""
DEPEND="${RDEPEND}
	>=net-libs/nodejs-0.12
	dev-go/amqp:=
	dev-go/asn1-ber:1=
	dev-go/binding:0=
	dev-go/com:=
	dev-go/gls:=
	>=dev-go/goconvey-1.5:=
	dev-go/go-net:=
	dev-go/go-oauth2:=
	dev-go/go-spew:=
	dev-go/go-sqlite3:=
	dev-go/go-xorm-core:=
	dev-go/go-xorm:=
	dev-go/ini:1=
	dev-go/ldap:1=
	dev-go/libpq:=
	dev-go/macaron:0=
	dev-go/mysql:=
	dev-go/redis:2=
	dev-go/session:=
	dev-go/slug:=
	dev-go/toml:=
	dev-go/unidecode:=
"

STRIP_MASK="*.a"

pkg_setup() {
	enewgroup grafana
	enewuser grafana -1 -1 /usr/share/grafana grafana
}

src_prepare() {
	mkdir -p src/${EGO_PN} || die
	mv *.go pkg src/${EGO_PN} || die

	# For local npm installs
	mkdir -p node_modules || die
}

src_compile() {
	golang-build_src_compile

	# XXX: no nodejs eclass to help with this mess yet
	npm install || die
	npm install grunt-cli || die
	PATH="${PATH}:${S}/node_modules/.bin/" grunt || die
}

src_test() {
	golang-build_src_test
}

src_install() {
	golang-build_src_install

	# Frontend assets
	insinto /usr/share/${PN}
	doins -r public conf

	dosbin grafana

	newconfd "${FILESDIR}"/grafana.confd grafana
	newinitd "${FILESDIR}"/grafana.initd grafana

	keepdir /etc/grafana
	insinto /etc/grafana
	doins "${FILESDIR}"/grafana.ini

	keepdir /var/{lib,log}/grafana
	fowners grafana:grafana /var/{lib,log}/grafana
	fperms 0750 /var/{lib,log}/grafana
}