summaryrefslogtreecommitdiff
path: root/www/grafana2/Makefile
blob: 4ff7990515dce97f775f3c001c77c51b6889eeab (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
# $FreeBSD$

PORTNAME=	grafana2
PORTVERSION=	2.0.2.8f9eeb
CATEGORIES=	www
MASTER_SITES=	GITHUB:github
DISTFILES=	${PORTNAME}-${DISTVERSION}${EXTRACT_SUFX}:github
MAINTAINER=	yvesf+freebsd@xapek.org
COMMENT=	A Graphite & InfluxDB Dashboard and Graph Editor
LICENSE=	APACHE20

BUILD_DEPENDS=	go>=1.4.0:${PORTSDIR}/lang/go \
		hg:${PORTSDIR}/devel/mercurial \
		git:${PORTSDIR}/devel/git \
		npm:${PORTSDIR}/www/npm
ONLY_FOR_ARCHS=	i386 amd64

USE_RC_SUBR=	grafana2

USE_GITHUB=	yes
GH_ACCOUNT=	grafana
GH_PROJECT=	grafana
# b51a8f11d5 was master at 2015-05-31
GH_COMMIT=	8f9eeb5ebd
GH_TAGNAME=	${GH_COMMIT}

SUB_FILES=	grafana2
SUB_LIST+=	GRAFANA_HOMEDIR=${GRAFANA_HOMEDIR} \
		GRAFANA_PIDFILE=${GRAFANA_PIDFILE} \
		GRAFANA_USER=${GRAFANA_USER} \
		GRAFANA_GROUP=${GRAFANA_GROUP}

PLIST_SUB=	GRAFANA_USER=${GRAFANA_USER} \
		GRAFANA_GROUP=${GRAFANA_GROUP}

GRAFANA_USER?=	grafana
GRAFANA_GROUP?=	grafana

GRAFANA_HOMEDIR=${PREFIX}/share/grafana2
GRAFANA_PIDFILE=/var/run/${PORTNAME}.pid

USERS=		${GRAFANA_USER}
GROUPS=		${GRAFANA_GROUP}

STRIP=		# stripping can break go binaries

pre-patch:
	@${MV} ${WRKDIR}/${GH_PROJECT}-${GH_COMMIT} ${WRKDIR}/${GH_ACCOUNT}-${GH_PROJECT}-${GH_COMMIT}

post-patch:
	@$(MKDIR) -p ${WRKDIR}/src/github.com/${GH_ACCOUNT}
	@ln -s ${WRKDIR}/${GH_ACCOUNT}-${GH_PROJECT}-${GH_COMMIT} ${WRKDIR}/src/github.com/${GH_ACCOUNT}/${GH_PROJECT}

do-build:
	@${ECHO_MSG} "Installing godep"
	@${SETENV} ${GO_ENV} go get github.com/tools/godep
	@cd ${WRKDIR}/src/github.com/${GH_ACCOUNT}/${GH_PROJECT} && \
		${ECHO_MSG} "Running godep restore" && \
		${SETENV} ${GO_ENV} ${WRKDIR}/bin/godep restore && \
		${ECHO_MSG} "Running go build" && \
		${SETENV} ${GO_ENV} CC=clang go build . && \
		${ECHO_MSG} "Running npm" && \
		npm --cache ${WRKDIR}/npm-cache install && \
		npm --cache ${WRKDIR}/npm-cache install grunt-cli && \
		${ECHO_MSG} "Running grunt" && \
		node_modules/.bin/grunt release

#do-install:

post-install:
	${MKDIR} ${STAGEDIR}/var/lib/${PORTNAME}/
	${MKDIR} ${STAGEDIR}/var/log/${PORTNAME}/
	${INSTALL_PROGRAM} ${WRKDIR}/src/github.com/grafana/grafana/grafana ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
	(cd ${WRKDIR}/src/github.com/grafana/grafana && \
		${COPYTREE_SHARE} public \
		${STAGEDIR}${GRAFANA_HOMEDIR} )
	$(MKDIR) ${STAGEDIR}${GRAFANA_HOMEDIR}/conf
	${INSTALL_DATA} \
		${WRKDIR}/src/github.com/grafana/grafana/conf/defaults.ini \
		${STAGEDIR}${GRAFANA_HOMEDIR}/conf/defaults.ini
	${INSTALL_DATA} \
		${WRKDIR}/src/github.com/grafana/grafana/conf/sample.ini \
		${STAGEDIR}${PREFIX}/etc/${PORTNAME}.ini

.include <bsd.port.pre.mk>
.include "${.CURDIR}/../../lang/go/files/bsd.go.mk"
.include <bsd.port.post.mk>