Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F131670079
D19570.id55635.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D19570.id55635.diff
View Options
Index: Mk/Uses/go.mk
===================================================================
--- Mk/Uses/go.mk
+++ Mk/Uses/go.mk
@@ -5,7 +5,7 @@
#
# Feature: go
# Usage: USES=go
-# Valid ARGS: none
+# Valid ARGS: (none), modules
#
# You can set the following variables to control the process.
#
@@ -32,39 +32,44 @@
.if !defined(_INCLUDE_USES_GO_MK)
_INCLUDE_USES_GO_MK= yes
-.if ${ARCH} == "i386"
-GOARCH= 386
-GOOBJ= 8
-.else
-GOARCH= amd64
-GOOBJ= 6
+.if !empty(go_ARGS) && ${go_ARGS:Nmodules}
+IGNORE= USES=go only accepts no arguments or 'modules'
.endif
# Settable variables
-GO_PKGNAME?= ${PORTNAME}
+.if empty(GO_PKGNAME)
+. if !empty(GH_SUBDIR)
+GO_PKGNAME= ${GH_SUBDIR:S|^src/||}
+. else
+GO_PKGNAME= ${PORTNAME}
+. endif
+.endif
GO_TARGET?= ${GO_PKGNAME}
-GO_BUILDFLAGS+= -v
+GO_BUILDFLAGS+= -v -buildmode=exe
CGO_CFLAGS+= -I${LOCALBASE}/include
CGO_LDFLAGS+= -L${LOCALBASE}/lib
# Read-only variables
GO_CMD= ${LOCALBASE}/bin/go
-LOCAL_GOPATH= ${LOCALBASE}/share/go
-GO_LIBDIR= share/go/pkg/${OPSYS:tl}_${GOARCH}
-GO_SRCDIR= share/go/src
-GO_WRKSRC= ${GO_WRKDIR_SRC}/${GO_PKGNAME}
GO_WRKDIR_BIN= ${WRKDIR}/bin
+
+GO_ENV+= CGO_CFLAGS="${CGO_CFLAGS}" \
+ CGO_LDFLAGS="${CGO_LDFLAGS}"
+
+.if ${go_ARGS:Mmodules}
+GO_BUILDFLAGS+= -mod=vendor
+GO_WRKSRC= ${WRKSRC}
+GO_ENV+= GOPATH="" \
+ GOBIN="${GO_WRKDIR_BIN}"
+.else
GO_WRKDIR_SRC= ${WRKDIR}/src
-GO_WRKDIR_PKG= ${WRKDIR}/pkg/${OPSYS:tl}_${GOARCH}
+GO_WRKSRC= ${GO_WRKDIR_SRC}/${GO_PKGNAME}
+GO_ENV+= GOPATH="${WRKDIR}" \
+ GOBIN=""
+.endif
BUILD_DEPENDS+= ${GO_CMD}:lang/go
-GO_ENV+= GOPATH="${WRKDIR}:${LOCAL_GOPATH}" \
- CGO_CFLAGS="${CGO_CFLAGS}" \
- CGO_LDFLAGS="${CGO_LDFLAGS}" \
- GOBIN=""
-PLIST_SUB+= GO_LIBDIR=${GO_LIBDIR} \
- GO_SRCDIR=${GO_SRCDIR} \
- GO_PKGNAME=${GO_PKGNAME}
+PLIST_SUB+= GO_PKGNAME=${GO_PKGNAME}
_USES_POST+= go
.endif # !defined(_INCLUDE_USES_GO_MK)
@@ -72,7 +77,7 @@
.if defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_GO_POST_MK)
_INCLUDE_USES_GO_POST_MK= yes
-.if !target(post-extract)
+.if !target(post-extract) && empty(go_ARGS)
post-extract:
@${MKDIR} ${GO_WRKSRC:H}
@${LN} -sf ${WRKSRC} ${GO_WRKSRC}
@@ -80,24 +85,14 @@
.if !target(do-build)
do-build:
- @(cd ${GO_WRKSRC}; \
+ (cd ${GO_WRKSRC}; \
${SETENV} ${MAKE_ENV} ${GO_ENV} ${GO_CMD} install ${GO_BUILDFLAGS} ${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;
+ ${INSTALL_PROGRAM} ${GO_WRKDIR_BIN}/${_TARGET:T} ${STAGEDIR}${PREFIX}/bin
.endfor
.endif
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 11, 5:10 AM (18 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
23564130
Default Alt Text
D19570.id55635.diff (2 KB)
Attached To
Mode
D19570: Mk/Uses/go.mk: Remove support for installing Go libs and sources; add initial modules support
Attached
Detach File
Event Timeline
Log In to Comment