www/grafana6: Switch to USES=go:modules, fix build with go1.13

===>  Building for grafana6-6.3.3_1
$GOPATH/go.mod exists but should not
*** Error code 1

- Remove custom build and install targets

PR:		240317
Submitted by:	Dmitri Goutnik <dg@syrec.org>
Pointy hat:	jlaffaye
This commit is contained in:
Tobias Kortkamp 2019-09-08 12:08:15 +00:00
parent ba781b8042
commit 86d4ae86f8
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=511566

View File

@ -16,16 +16,18 @@ COMMENT= Dashboard and graph editor for multiple data stores
LICENSE= APACHE20
LICENSE_FILE= ${WRKSRC}/LICENSE
BROKEN= fails to build
ONLY_FOR_ARCHS= amd64 i386
USES= compiler go
USES= go:modules
USE_RC_SUBR= grafana
USE_GITHUB= yes
GH_SUBDIR= src/github.com/${PORTNAME}/${PORTNAME}
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
@ -52,19 +54,20 @@ SUB_LIST+= GRAFANA_USER=${GRAFANA_USER} \
PLIST_SUB+= GRAFANAHOMEDIR=${GRAFANAHOMEDIR}
post-extract:
@${RM} -r ${WRKSRC}/src/github.com/grafana/grafana/public
@${RM} -r ${WRKSRC}/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
# 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
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 && \
post-install:
cd ${WRKSRC} && \
${COPYTREE_SHARE} public ${STAGEDIR}${PREFIX}/share/grafana
${MKDIR} ${STAGEDIR}${GRAFANAPIDDIR}
${MKDIR} ${STAGEDIR}${GRAFANALOGDIR}
@ -75,14 +78,8 @@ do-install:
${MKDIR} ${STAGEDIR}${GRAFANAHOMEDIR}/conf
${MKDIR} ${STAGEDIR}${GRAFANAHOMEDIR}/data
${MKDIR} ${STAGEDIR}${GRAFANAHOMEDIR}/data/log
${INSTALL_DATA} ${WRKSRC}/src/github.com/grafana/grafana/conf/defaults.ini \
${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.pre.mk>
.if ${COMPILER_TYPE} == clang
BUILD_ENV= CC=clang
.endif
.include <bsd.port.post.mk>
.include <bsd.port.mk>