diff options
author | Dmitri Goutnik <dmgk@FreeBSD.org> | 2022-05-29 16:45:43 -0500 |
---|---|---|
committer | Dmitri Goutnik <dmgk@FreeBSD.org> | 2022-06-06 13:19:10 -0500 |
commit | 3012ca2179ceb0e389fbeb30a66f9fe60a3cf5a1 (patch) | |
tree | 4fe75a4a21b7c0b3b14bab02d5fcd8ba55e12c85 /Mk | |
parent | 65ea904754035b629a265bbb9cf1245e8f11acc5 (diff) | |
download | freebsd-ports-3012ca2179ceb0e389fbeb30a66f9fe60a3cf5a1.zip |
*/*: Introduce versioned Go ports
- Mk/Uses/go.mk: add support for selecting Go port version in USES=go;
- Mk/bsd.default-versions.mk: add GO_DEFAULT;
- convert lang/go-devel to the master and lang/go{117,118} to slave
ports;
- add lang/go meta-port that provides go and gofmt symlinks to the
current default version.
PR: 264336
Reviewed by: ygy jwb yuri mikael drtr0jan@yandex.ru decke mat
Differential Revision: https://reviews.freebsd.org/D35346
Diffstat (limited to 'Mk')
-rw-r--r-- | Mk/Scripts/qa.sh | 3 | ||||
-rw-r--r-- | Mk/Uses/go.mk | 35 | ||||
-rw-r--r-- | Mk/bsd.default-versions.mk | 2 |
3 files changed, 26 insertions, 14 deletions
diff --git a/Mk/Scripts/qa.sh b/Mk/Scripts/qa.sh index 104d4d48006f..20d1e296dd5c 100644 --- a/Mk/Scripts/qa.sh +++ b/Mk/Scripts/qa.sh @@ -978,6 +978,9 @@ depends_blacklist() lang/gcc) instead="USE_GCC" ;; + lang/go) + instead="USES=go" + ;; lang/julia) instead="a dependency on lang/julia\${JULIA_DEFAULT:S/.//}" ;; diff --git a/Mk/Uses/go.mk b/Mk/Uses/go.mk index 39585e0c9946..c18b8fcc4000 100644 --- a/Mk/Uses/go.mk +++ b/Mk/Uses/go.mk @@ -3,9 +3,10 @@ # # Feature: go # Usage: USES=go -# Valid ARGS: (none), modules, no_targets, run +# Valid ARGS: (none), N.NN, N.NN-devel, modules, no_targets, run # -# (none) Setup GOPATH and build in GOPATH mode. +# (none) Setup GOPATH and build in GOPATH mode using default Go version. +# N.NN[-devel] Specify Go version # 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 @@ -52,24 +53,29 @@ # GO_TESTFLAGS # Additional build arguments to be passed to the `go test` command # -# GO_PORT -# 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 must not be set by individual ports! -# # MAINTAINER: ports@FreeBSD.org .if !defined(_INCLUDE_USES_GO_MK) _INCLUDE_USES_GO_MK= yes -. if !empty(go_ARGS:Nmodules:Nno_targets:Nrun) -IGNORE= USES=go has invalid arguments: ${go_ARGS:Nmodules:Nno_targets:Nrun} +# When adding a version, please keep the comment in +# Mk/bsd.default-versions.mk in sync. +GO_VALID_VERSIONS= 1.17 1.18 1.19-devel + +# Check arguments sanity +. if !empty(go_ARGS:N[1-9].[0-9][0-9]:N*-devel:Nmodules:Nno_targets:Nrun) +IGNORE= USES=go has invalid arguments: ${go_ARGS:N[1-9].[0-9][0-9]:N*-devel:Nmodules:Nno_targets:Nrun} . endif -# Settable variables +# Parse Go version +GO_VERSION= ${go_ARGS:Nmodules:Nno_targets:Nrun:C/^$/${GO_DEFAULT}/} +. if empty(GO_VALID_VERSIONS:M${GO_VERSION}) +IGNORE?= USES=go has invalid version number: ${GO_VERSION} +. endif +GO_SUFFIX= ${GO_VERSION:S/.//:C/.*-devel/-devel/} +GO_PORT= lang/go${GO_SUFFIX} -GO_PORT?= lang/go +# Settable variables . if empty(GO_PKGNAME) . if !empty(GH_SUBDIR) @@ -89,7 +95,7 @@ GO_BUILDFLAGS+= -v -buildmode=exe -trimpath GO_BUILDFLAGS+= -ldflags=-s . endif GO_TESTFLAGS+= -v -. if ${GO_PORT} != lang/go117 +. if ${GO_VERSION} != 1.17 GO_BUILDFLAGS+= -buildvcs=false GO_TESTFLAGS+= -buildvcs=false . endif @@ -107,7 +113,7 @@ GO_GOSUMDB?= sum.golang.org # Read-only variables -GO_CMD= ${LOCALBASE}/bin/go +GO_CMD= ${LOCALBASE}/bin/go${GO_SUFFIX} GO_WRKDIR_BIN= ${WRKDIR}/bin GO_ENV+= CGO_ENABLED=${CGO_ENABLED} \ CGO_CFLAGS="${CGO_CFLAGS}" \ @@ -154,6 +160,7 @@ GO_ENV+= GOPATH="${GO_GOPATH}" \ . endif BUILD_DEPENDS+= ${GO_CMD}:${GO_PORT} +BINARY_ALIAS+= go=go${GO_SUFFIX} gofmt=gofmt${GO_SUFFIX} . if ${go_ARGS:Mrun} RUN_DEPENDS+= ${GO_CMD}:${GO_PORT} . endif diff --git a/Mk/bsd.default-versions.mk b/Mk/bsd.default-versions.mk index 974442a6a356..660b85418d3e 100644 --- a/Mk/bsd.default-versions.mk +++ b/Mk/bsd.default-versions.mk @@ -56,6 +56,8 @@ GCC_DEFAULT?= 10 GL_DEFAULT?= mesa-libs # Possible values: 7, 8, 9, agpl GHOSTSCRIPT_DEFAULT?= agpl +# Possible values: 1.17, 1.18, 1.19-devel +GO_DEFAULT?= 1.18 # Possible values: 6, 6-nox11, 7, 7-nox11 IMAGEMAGICK_DEFAULT?= 7 # Possible values: 7, 8, 11, 17, 18 |