aboutsummaryrefslogtreecommitdiffstats
path: root/lang/go
diff options
context:
space:
mode:
authorjlaffaye <jlaffaye@FreeBSD.org>2014-01-12 01:46:33 +0800
committerjlaffaye <jlaffaye@FreeBSD.org>2014-01-12 01:46:33 +0800
commit324c5236b888759ebda3ce7af2aba391da348ea0 (patch)
tree2f8ae2a36fa3a470da851493054d7f7fafb0b259 /lang/go
parent5d776fa056c0b1c619072b2c1bc87f52687f2fd5 (diff)
downloadfreebsd-ports-gnome-324c5236b888759ebda3ce7af2aba391da348ea0.tar.gz
freebsd-ports-gnome-324c5236b888759ebda3ce7af2aba391da348ea0.tar.zst
freebsd-ports-gnome-324c5236b888759ebda3ce7af2aba391da348ea0.zip
- Change default location of Go packages to LOCALBASE/share/go
This fixes problems like ports failing to build if the port is already installed [1] - Bump PORTREVISION of affected ports - Support the install target in bsd.go.mk - STAGE support for free! PR: ports/180003 [1]
Diffstat (limited to 'lang/go')
-rw-r--r--lang/go/files/bsd.go.mk36
1 files changed, 24 insertions, 12 deletions
diff --git a/lang/go/files/bsd.go.mk b/lang/go/files/bsd.go.mk
index 18b968f0421a..5e8e99f8da69 100644
--- a/lang/go/files/bsd.go.mk
+++ b/lang/go/files/bsd.go.mk
@@ -33,25 +33,20 @@ CGO_LDFLAGS+= -L${LOCALBASE}/lib
# Read-only variables
GO_CMD= ${LOCALBASE}/bin/go
-GOROOT= ${LOCALBASE}/go
-GO_LIBDIR= go/pkg/freebsd_${GOARCH}
-GO_SRCDIR= go/src/pkg
-GO_LOCAL_LIBDIR=${LOCALBASE}/${GO_LIBDIR}
-GO_LOCAL_SRCDIR=${LOCALBASE}/${GO_SRCDIR}
+LOCAL_GOPATH= ${LOCALBASE}/share/go
+GO_LIBDIR= share/go/pkg/freebsd_${GOARCH}
+GO_SRCDIR= share/go/src
GO_WRKSRC= ${GO_WRKDIR_SRC}/${GO_PKGNAME}
GO_WRKDIR_BIN= ${WRKDIR}/bin
GO_WRKDIR_SRC= ${WRKDIR}/src
GO_WRKDIR_PKG= ${WRKDIR}/pkg/freebsd_${GOARCH}
BUILD_DEPENDS+= ${GO_CMD}:${PORTSDIR}/lang/go
-GO_ENV+= GOROOT=${GOROOT} \
- GOPATH=${WRKDIR} \
- GOARCH=${GOARCH} \
- GOOS=${OPSYS:L} \
+GO_ENV+= GOPATH="${WRKDIR}:${LOCAL_GOPATH}" \
CGO_CFLAGS="${CGO_CFLAGS}" \
CGO_LDFLAGS="${CGO_LDFLAGS}"
-PLIST_SUB+= GO_LIBDIR=${GO_LIBDIR} \
- GO_SRCDIR=${GO_SRCDIR} \
+PLIST_SUB+= GO_LIBDIR=${GO_LIBDIR} \
+ GO_SRCDIR=${GO_SRCDIR} \
GO_PKGNAME=${GO_PKGNAME}
.if !target(post-extract)
@@ -62,5 +57,22 @@ post-extract:
.if !target(do-build)
do-build:
- @(cd ${GO_WRKSRC}; ${SETENV} ${GO_ENV} ${GO_CMD} install ${GO_TARGET})
+ @(cd ${GO_WRKSRC}; ${SETENV} ${GO_ENV} ${GO_CMD} install -v ${GO_TARGET})
+.endif
+
+.if !target(do-install)
+do-install:
+.for _TARGET in ${GO_TARGET}
+ @if [ -e "${GO_WRKDIR_PKG}/${_TARGET}.a" ]; then \
+ _TARGET_LIBDIR="${STAGEDIR}/${PREFIX}/${GO_LIBDIR}/${_TARGET:H}"; \
+ ${MKDIR} $${_TARGET_LIBDIR}; \
+ ${INSTALL_DATA} ${GO_WRKDIR_PKG}/${_TARGET}.a $${_TARGET_LIBDIR}; \
+ _TARGET_SRCDIR="${STAGEDIR}/${PREFIX}/${GO_SRCDIR}/${_TARGET}"; \
+ ${MKDIR} $${_TARGET_SRCDIR}; \
+ (cd ${GO_WRKDIR_SRC}/${_TARGET}/ && ${COPYTREE_SHARE} \* $${_TARGET_SRCDIR}); \
+ fi; \
+ if [ -e "${GO_WRKDIR_BIN}/${_TARGET:T}" ]; then \
+ ${INSTALL_PROGRAM} ${GO_WRKDIR_BIN}/${_TARGET:T} ${STAGEDIR}/${LOCALBASE}/bin; \
+ fi;
+.endfor
.endif