3726f94254
This allows for port testing with lang/go-devel via GO_PORT, setting up the Go build environment in a single place, and is step one in simplifying Go ports that often define too complicated do-build targets themselves. USES=go gains new arguments 'run' to add lang/go to RUN_DEPENDS and 'no_targets' for ports with composite builds that call 'go' themselves and do not need the do-build/do-install targets of USES=go. PR: 238849 Submitted by: dg@syrec.org (also D20745) Reviewed by: mat, tobik Exp-run by: antoine Differential Revision: https://reviews.freebsd.org/D20746
87 lines
3.1 KiB
Makefile
87 lines
3.1 KiB
Makefile
# $FreeBSD$
|
|
|
|
PORTNAME= grafana
|
|
PORTVERSION= 5.4.3
|
|
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= swills@FreeBSD.org
|
|
COMMENT= Dashboard and graph editor for multiple data stores
|
|
|
|
LICENSE= APACHE20
|
|
LICENSE_FILE= ${WRKSRC}/LICENSE.md
|
|
|
|
ONLY_FOR_ARCHS= amd64 i386
|
|
|
|
USES= compiler go
|
|
USE_RC_SUBR= grafana
|
|
|
|
USE_GITHUB= yes
|
|
GH_SUBDIR= src/github.com/${PORTNAME}/${PORTNAME}
|
|
TAG= 69c5191
|
|
|
|
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}/src/github.com/grafana/grafana/public
|
|
@(cd ${WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${DISTDIR}/grafana-${PORTVERSION}.linux-amd64${EXTRACT_SUFX} ${EXTRACT_AFTER_ARGS} grafana-${PORTVERSION}/public)
|
|
|
|
do-build:
|
|
@cd ${WRKSRC}/src/github.com/${PORTNAME}/${PORTNAME} ; ${SETENV} ${MAKE_ENV} ${BUILD_ENV} GOPATH=${WRKSRC} go build -ldflags "-w -X main.version=${PORTVERSION} -X main.commit=${TAG}" -o ./bin/grafana-server ./pkg/cmd/grafana-server
|
|
@cd ${WRKSRC}/src/github.com/${PORTNAME}/${PORTNAME} ; ${SETENV} ${MAKE_ENV} ${BUILD_ENV} GOPATH=${WRKSRC} go build -ldflags "-w -X main.version=${PORTVERSION} -X main.commit=${TAG}" -o ./bin/grafana-cli ./pkg/cmd/grafana-cli
|
|
|
|
do-install:
|
|
${INSTALL_PROGRAM} ${WRKSRC}/src/github.com/grafana/grafana/bin/grafana-server \
|
|
${STAGEDIR}${PREFIX}/bin/grafana-server
|
|
${INSTALL_PROGRAM} ${WRKSRC}/src/github.com/grafana/grafana/bin/grafana-cli \
|
|
${STAGEDIR}${PREFIX}/bin/grafana-cli
|
|
cd ${WRKSRC}/src/github.com/grafana/grafana && \
|
|
${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}/src/github.com/grafana/grafana/conf/defaults.ini \
|
|
${STAGEDIR}${GRAFANAHOMEDIR}/conf/defaults.ini
|
|
${INSTALL_DATA} ${WRKDIR}/grafana.conf ${STAGEDIR}${PREFIX}/etc/grafana.conf.sample
|
|
|
|
.include <bsd.port.pre.mk>
|
|
|
|
.if ${COMPILER_TYPE} == clang
|
|
BUILD_ENV= CC=clang
|
|
.endif
|
|
|
|
.include <bsd.port.post.mk>
|