Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F145546786
D45631.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
D45631.diff
View Options
diff --git a/Mk/Uses/go.mk b/Mk/Uses/go.mk
--- a/Mk/Uses/go.mk
+++ b/Mk/Uses/go.mk
@@ -23,6 +23,16 @@
# In most cases, this is the only required variable for ports that
# use Go modules.
#
+# GO_MOD_DIST
+# The location to download the go.mod file if GO_MODULE is used.
+# The default is empty, so it is loaded from GO_PROXY.
+# Set it to "gitlab" and make sure GL_PROJECT is defined to download
+# the "go.mod" from gitlab.
+# Set it to "github" and make sure GH_PROJECT is defined to download
+# the "go.mod" from github.
+# You can also set it completely manually a URI without go.mod in it,
+# is attached automatically to the URI.
+#
# GO_PKGNAME
# The name of the package when building in GOPATH mode. This
# is the directory that will be created in ${GOPATH}/src. If not set
@@ -143,9 +153,25 @@
GO_MODVERSION= ${GO_MODULE:C/^([^@]*)(@([^@]*)?)/\2/:M@*:S/^@//:S/^$/${DISTVERSIONFULL}/}
GO_MODFILE= ${GO_MODVERSION}.mod
GO_DISTFILE= ${GO_MODVERSION}.zip
+# If GO_MOD_DIST is gitlab, download the go.mod from gitlab by the defined GL_ACCOUNT and GL_PROJECT/PORTNAME
+. if defined(GO_MOD_DIST) && "${GO_MOD_DIST}" == "gitlab"
+MASTER_SITES+= https://gitlab.com/${GL_ACCOUNT}/${GL_PROJECT}/-/raw/${GO_MODVERSION}/${WRKSRC_SUBDIR:?${WRKSRC_SUBDIR}/:}
+DISTFILES+= go.mod
+# If GO_MOD_DIST is github, download the go.mod from github by the defined GH_ACCOUNT and GH_PROJECT/PORTNAME
+. elif defined(GO_MOD_DIST) && "${GO_MOD_DIST}" == "github"
+MASTER_SITES+= https://raw.githubusercontent.com/${GH_ACCOUNT}/${GH_PROJECT}/${GO_MODVERSION}/${WRKSRC_SUBDIR:?${WRKSRC_SUBDIR}/:}
+DISTFILES+= go.mod
+# Manually defined GO_MOD_DIST
+. elifdef(GO_MOD_DIST)
+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}
WRKSRC= ${WRKDIR}/${GO_MODNAME}@${GO_MODVERSION}
+. endif
+
. endif
EXTRACT_ONLY?= ${DISTFILES:N*.mod\:*:N*.mod:C/:.*//}
DIST_SUBDIR= go/${PKGORIGIN:S,/,_,g}/${DISTNAME}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 22, 7:22 AM (11 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28933903
Default Alt Text
D45631.diff (2 KB)
Attached To
Mode
D45631: Extend go.mk to download go.mod from other location
Attached
Detach File
Event Timeline
Log In to Comment