mirror of
https://git.freebsd.org/ports.git
synced 2025-04-29 01:56:37 -04:00
Mk/Uses/go.mk: support v2 and higher proxy URLs
golang projects with versions greater than 2.x have different URLs presented for them via `${GOPROXY}` [1]. In particular, the major version is added to the URL and to the extracted GOPROXY provided DISTFILE(s). This change adjusts `MASTER_SITES` and `WRKSRC` with `USES+= go` to support the "Major Version Suffixes" documented in the go module docs [1]. Reviewed by: adamw, arrowd Approved by: adamw (go) Differential Revision: https://reviews.freebsd.org/D49723 1. https://go.dev/ref/mod#major-version-suffixes
This commit is contained in:
parent
892ce98277
commit
0647dd4274
1 changed files with 12 additions and 2 deletions
|
@ -167,9 +167,19 @@ MASTER_SITES+= ${GO_MOD_DIST}
|
|||
DISTFILES+= go.mod
|
||||
# Fallback to default GO_PROXY
|
||||
. else
|
||||
MASTER_SITES+= ${GO_GOPROXY}/${GO_MODNAME:C/([A-Z])/!\1/g:tl}/@v/
|
||||
DISTFILES+= ${GO_MODFILE} ${GO_DISTFILE}
|
||||
|
||||
# `GOPROXY` presents sources via the proxy service and in the downloaded
|
||||
# `WRKSRC` differently as of v2.x versions of projects. Support this different
|
||||
# directory/REST API scheme: https://go.dev/ref/mod#major-version-suffixes .
|
||||
GO_MODVERSION_MAJOR= ${GO_MODVERSION:C/^v//g:C/\..+//g}
|
||||
.if ${GO_MODVERSION_MAJOR} > 1
|
||||
WRKSRC= ${WRKDIR}/${GO_MODNAME}/v${GO_MODVERSION_MAJOR}@${GO_MODVERSION}
|
||||
MASTER_SITES+= ${GO_GOPROXY}/${GO_MODNAME:C/([A-Z])/!\1/g:tl}/v${GO_MODVERSION_MAJOR}/@v/
|
||||
.else
|
||||
WRKSRC= ${WRKDIR}/${GO_MODNAME}@${GO_MODVERSION}
|
||||
MASTER_SITES+= ${GO_GOPROXY}/${GO_MODNAME:C/([A-Z])/!\1/g:tl}/@v/
|
||||
.endif
|
||||
DISTFILES+= ${GO_MODFILE} ${GO_DISTFILE}
|
||||
. endif
|
||||
|
||||
. endif
|
||||
|
|
Loading…
Add table
Reference in a new issue