aboutsummaryrefslogtreecommitdiffstats
path: root/www/grafana6/Makefile
blob: 196071b25c314ffb41235c31492b0f84a98fd7ed (plain) (blame)
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
# $FreeBSD$

PORTNAME=   grafana
PORTVERSION=    6.3.3
PORTREVISION=   1
DISTVERSIONPREFIX=  v
CATEGORIES= www
MASTER_SITES+=  https://s3-us-west-2.amazonaws.com/grafana-releases/release/:public
PKGNAMESUFFIX=  ${PORTVERSION:C/([0-9]).*/\1/1}
DISTFILES=  grafana-${PORTVERSION}.linux-amd64${EXTRACT_SUFX}:public
EXTRACT_ONLY=   ${DISTNAME}${EXTRACT_SUFX}

MAINTAINER= hiyorin@gmail.com
COMMENT=    Dashboard and graph editor for multiple data stores

LICENSE=    APACHE20
LICENSE_FILE=   ${WRKSRC}/LICENSE

ONLY_FOR_ARCHS= amd64 i386

USES=       go:modules
USE_RC_SUBR=    grafana

USE_GITHUB= yes
TAG=        9504db8

GO_TARGET=  ./pkg/cmd/grafana-server \
        ./pkg/cmd/grafana-cli
GO_BUILDFLAGS=  -ldflags="-w -X main.version=${PORTVERSION} -X main.commit=${TAG}"

GRAFANA_USER?=  grafana
GRAFANA_GROUP?= grafana

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

GRAFANAHOMEDIR=     ${PREFIX}/share/grafana
GRAFANADATADIR=     /var/db/${PORTNAME}/
GRAFANALOGDIR=      /var/log/${PORTNAME}/
GRAFANAPIDDIR=      /var/run/${PORTNAME}/
GRAFANAPLUGINDIR=   /var/db/${PORTNAME}/plugins
GRAFANAPROVISIONINGDIR= /var/db/${PORTNAME}/provisioning

SUB_FILES=  grafana grafana.conf
SUB_LIST+=  GRAFANA_USER=${GRAFANA_USER} \
        GRAFANA_GROUP=${GRAFANA_GROUP} \
        GRAFANADATADIR=${GRAFANADATADIR} \
        GRAFANALOGDIR=${GRAFANALOGDIR} \
        GRAFANAPIDDIR=${GRAFANAPIDDIR} \
        GRAFANAHOMEDIR=${GRAFANAHOMEDIR} \
        GRAFANAPLUGINDIR=${GRAFANAPLUGINDIR} \
        GRAFANAPROVISIONINGDIR=${GRAFANAPROVISIONINGDIR}

PLIST_SUB+= GRAFANAHOMEDIR=${GRAFANAHOMEDIR}

post-extract:
    @${RM} -r ${WRKSRC}/public
    @(cd ${WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${DISTDIR}/grafana-${PORTVERSION}.linux-amd64${EXTRACT_SUFX} ${EXTRACT_AFTER_ARGS} grafana-${PORTVERSION}/public)

# unbreak vendored golang.org/x/xerrors with go1.13
# can be removed after vendor/golang.org/x/xerrors is updated to a985d3407aa7 or later
post-patch:
    @${RM} ${WRKSRC}/vendor/golang.org/x/xerrors/adaptor_go1_13.go
    @${RM} ${WRKSRC}/vendor/golang.org/x/xerrors/format_go1_13.go
    @${REINPLACE_CMD} '/build !go1.13/d' ${WRKSRC}/vendor/golang.org/x/xerrors/adaptor_go1_12.go
    @${REINPLACE_CMD} '/build !go1.13/d' ${WRKSRC}/vendor/golang.org/x/xerrors/format_go1_12.go
    @${REINPLACE_CMD} '/build !go1.13/d' ${WRKSRC}/vendor/golang.org/x/xerrors/frame_go1_12.go

post-install:
    cd ${WRKSRC} && \
        ${COPYTREE_SHARE} public ${STAGEDIR}${PREFIX}/share/grafana
    ${MKDIR} ${STAGEDIR}${GRAFANAPIDDIR}
    ${MKDIR} ${STAGEDIR}${GRAFANALOGDIR}
    ${MKDIR} ${STAGEDIR}${GRAFANAHOMEDIR}
    ${MKDIR} ${STAGEDIR}${GRAFANADATADIR}
    ${MKDIR} ${STAGEDIR}${GRAFANAPLUGINDIR}
    ${MKDIR} ${STAGEDIR}${GRAFANAPROVISIONINGDIR}
    ${MKDIR} ${STAGEDIR}${GRAFANAHOMEDIR}/conf
    ${MKDIR} ${STAGEDIR}${GRAFANAHOMEDIR}/data
    ${MKDIR} ${STAGEDIR}${GRAFANAHOMEDIR}/data/log
    ${INSTALL_DATA} ${WRKSRC}/conf/defaults.ini \
        ${STAGEDIR}${GRAFANAHOMEDIR}/conf/defaults.ini
    ${INSTALL_DATA} ${WRKDIR}/grafana.conf ${STAGEDIR}${PREFIX}/etc/grafana.conf.sample

.include <bsd.port.mk>