Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Sep 2019 12:08:16 +0000 (UTC)
From:      Tobias Kortkamp <tobik@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r511566 - head/www/grafana6
Message-ID:  <201909081208.x88C8GcH031142@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tobik
Date: Sun Sep  8 12:08:15 2019
New Revision: 511566
URL: https://svnweb.freebsd.org/changeset/ports/511566

Log:
  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

Modified:
  head/www/grafana6/Makefile

Modified: head/www/grafana6/Makefile
==============================================================================
--- head/www/grafana6/Makefile	Sun Sep  8 12:06:32 2019	(r511565)
+++ head/www/grafana6/Makefile	Sun Sep  8 12:08:15 2019	(r511566)
@@ -16,16 +16,18 @@ COMMENT=	Dashboard and graph editor for multiple data 
 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>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909081208.x88C8GcH031142>