Page MenuHomeFreeBSD

D20735.id58946.diff
No OneTemporary

D20735.id58946.diff

Index: Mk/Uses/go.mk
===================================================================
--- Mk/Uses/go.mk
+++ Mk/Uses/go.mk
@@ -5,11 +5,17 @@
#
# Feature: go
# Usage: USES=go
-# Valid ARGS: (none), modules
+# Valid ARGS: (none), build, modules, run
#
# (none) Setup GOPATH and build in GOPATH mode.
+# build Indicates that Go is used at build time as a part of
+# make/CMake build. This will setup build environment like
+# GO_ENV, GO_BUILDFLAGS but avoid creating post-extract, do-build
+# and do-install targets.
# modules If the upstream uses Go modules, this can be set to build
# in modules-aware mode.
+# run Indicates that Go is needed at run time and adds it to
+# RUN_DEPENDS.
#
# You can set the following variables to control the process.
#
@@ -47,8 +53,8 @@
.if !defined(_INCLUDE_USES_GO_MK)
_INCLUDE_USES_GO_MK= yes
-.if !empty(go_ARGS) && ${go_ARGS:Nmodules}
-IGNORE= USES=go only accepts no arguments or 'modules'
+.if !empty(go_ARGS) && ${go_ARGS:Nmodules:Nbuild:Nrun}
+IGNORE= USES=go has invalid arguments: ${go_ARGS:Nmodules:Nbuild:Nrun}
.endif
# Settable variables
@@ -91,6 +97,9 @@
GO_PORT?= lang/go
BUILD_DEPENDS+= ${GO_CMD}:${GO_PORT}
+.if ${go_ARGS:Mrun}
+RUN_DEPENDS+= ${GO_CMD}:${GO_PORT}
+.endif
PLIST_SUB+= GO_PKGNAME=${GO_PKGNAME}
_USES_POST+= go
@@ -105,13 +114,13 @@
@${LN} -sf ${WRKSRC} ${GO_WRKSRC}
.endif
-.if !target(do-build)
+.if !target(do-build) && empty(go_ARGS:Mbuild)
do-build:
(cd ${GO_WRKSRC}; \
${SETENV} ${MAKE_ENV} ${GO_ENV} ${GO_CMD} install ${GO_BUILDFLAGS} ${GO_TARGET})
.endif
-.if !target(do-install)
+.if !target(do-install) && empty(go_ARGS:Mbuild)
do-install:
.for _TARGET in ${GO_TARGET}
${INSTALL_PROGRAM} ${GO_WRKDIR_BIN}/${_TARGET:T} ${STAGEDIR}${PREFIX}/bin

File Metadata

Mime Type
text/plain
Expires
Sat, Jul 4, 1:15 PM (4 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34671386
Default Alt Text
D20735.id58946.diff (1 KB)

Event Timeline