diff options
author | Tobias Kortkamp <tobik@FreeBSD.org> | 2019-06-29 03:51:13 +0000 |
---|---|---|
committer | Tobias Kortkamp <tobik@FreeBSD.org> | 2019-06-29 03:51:13 +0000 |
commit | 3726f942547e374490d375baf83216d7644a7162 (patch) | |
tree | 8c7c440762c72012824110ba9cdd44c8c1765017 /Mk/Uses/go.mk | |
parent | New port: net/ntpsec: Network Time Protocol suite, refactored (diff) |
Convert all Go ports to USES=go
This allows for port testing with lang/go-devel via GO_PORT, setting
up the Go build environment in a single place, and is step one in
simplifying Go ports that often define too complicated do-build
targets themselves.
USES=go gains new arguments 'run' to add lang/go to RUN_DEPENDS and
'no_targets' for ports with composite builds that call 'go' themselves
and do not need the do-build/do-install targets of USES=go.
PR: 238849
Submitted by: dg@syrec.org (also D20745)
Reviewed by: mat, tobik
Exp-run by: antoine
Differential Revision: https://reviews.freebsd.org/D20746
Notes
Notes:
svn path=/head/; revision=505321
Diffstat (limited to 'Mk/Uses/go.mk')
-rw-r--r-- | Mk/Uses/go.mk | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/Mk/Uses/go.mk b/Mk/Uses/go.mk index 21ef428722dc..cfe6cf4faa3b 100644 --- a/Mk/Uses/go.mk +++ b/Mk/Uses/go.mk @@ -5,11 +5,17 @@ # # Feature: go # Usage: USES=go -# Valid ARGS: (none), modules +# Valid ARGS: (none), modules, no_targets, run # # (none) Setup GOPATH and build in GOPATH mode. # modules If the upstream uses Go modules, this can be set to build # in modules-aware mode. +# no_targets Indicates that Go is needed at build time as a part of +# make/CMake build. This will setup build environment like +# GO_ENV, GO_BUILDFLAGS but will not create post-extract, do-build +# and do-install targets. +# 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. # @@ -40,15 +46,15 @@ # The Go port to use. By default this is lang/go but can be set # to lang/go-devel in make.conf for testing with future Go versions. # -# This variable should not be set by individual ports! +# This variable must not be set by individual ports! # # MAINTAINER: jlaffaye@FreeBSD.org .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:Nmodules:Nno_targets:Nrun) +IGNORE= USES=go has invalid arguments: ${go_ARGS:Nmodules:Nno_targets:Nrun} .endif # Settable variables @@ -91,6 +97,9 @@ GO_ENV+= GOPATH="${WRKDIR}" \ 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 @@ post-extract: @${LN} -sf ${WRKSRC} ${GO_WRKSRC} .endif -.if !target(do-build) +.if !target(do-build) && empty(go_ARGS:Mno_targets) 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:Mno_targets) do-install: .for _TARGET in ${GO_TARGET} ${INSTALL_PROGRAM} ${GO_WRKDIR_BIN}/${_TARGET:T} ${STAGEDIR}${PREFIX}/bin |