git: eb2548c37423 - main - lang/go125: Add port

From: Adam Weinberger <adamw_at_FreeBSD.org>
Date: Thu, 14 Aug 2025 01:46:08 UTC
The branch main has been updated by adamw:

URL: https://cgit.FreeBSD.org/ports/commit/?id=eb2548c374239e1c5041afd37835560946792013

commit eb2548c374239e1c5041afd37835560946792013
Author:     Adam Weinberger <adamw@FreeBSD.org>
AuthorDate: 2025-08-14 01:40:30 +0000
Commit:     Adam Weinberger <adamw@FreeBSD.org>
CommitDate: 2025-08-14 01:46:02 +0000

    lang/go125: Add port
    
    Introduction to Go 1.25ΒΆ
    
    The latest Go release, version 1.25, arrives in August 2025, six months
    after Go 1.24. Most of its changes are in the implementation of the
    toolchain, runtime, and libraries. As always, the release maintains the
    Go 1 promise of compatibility. We expect almost all Go programs to
    continue to compile and run as before.
    
    https://go.dev/doc/go1.25
---
 lang/Makefile                                      |  1 +
 lang/go125/Makefile                                | 29 ++++++++++++++++++++++
 lang/go125/distinfo                                | 13 ++++++++++
 lang/go125/files/patch-src_cmd_dist_build.go       | 23 +++++++++++++++++
 .../patch-src_cmd_go_internal_modload_vendor.go    | 11 ++++++++
 5 files changed, 77 insertions(+)

diff --git a/lang/Makefile b/lang/Makefile
index f7c0932f1099..1b38d8a7cad0 100644
--- a/lang/Makefile
+++ b/lang/Makefile
@@ -127,6 +127,7 @@
     SUBDIR += go122
     SUBDIR += go123
     SUBDIR += go124
+    SUBDIR += go125
     SUBDIR += gomacro
     SUBDIR += gprolog
     SUBDIR += gptscript
diff --git a/lang/go125/Makefile b/lang/go125/Makefile
new file mode 100644
index 000000000000..ddb9fd2ed6d6
--- /dev/null
+++ b/lang/go125/Makefile
@@ -0,0 +1,29 @@
+DISTVERSION=	1.25.0
+# Always set PORTREVISION explicitly as otherwise they are inherited from lang/go-devel
+PORTREVISION=	0
+MASTER_SITES=	https://go.dev/dl/
+DISTFILES=	go${DISTVERSION}.src.tar.gz \
+		go1.24.6.${OPSYS:tl}-${GOARCH_${ARCH}}.tar.gz
+
+# Avoid conflicting patch files
+PATCHFILES=
+PATCHDIR=	${.CURDIR}/files
+
+COMMENT=	Go programming language
+
+MASTERDIR=	${.CURDIR}/../go-devel
+WRKSRC=		${WRKDIR}/go
+DISTINFO_FILE=	${.CURDIR}/distinfo
+EXTRACT_ONLY=	${DISTFILES:[1]}
+
+SHEBANG_FILES=	lib/wasm/go_js_wasm_exec lib/wasm/go_wasip1_wasm_exec
+
+BOOTSTRAP_WRKSRC=	${WRKDIR}/go-${OPSYS:tl}-${GOARCH_${ARCH}}${GOARM_${ARCH}}-bootstrap
+
+pre-extract:
+	${MKDIR} ${BOOTSTRAP_WRKSRC}
+	cd ${BOOTSTRAP_WRKSRC} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} \
+		${DISTDIR}/${DIST_SUBDIR}/${DISTFILES:[2]} \
+		--strip-components 1 ${EXTRACT_AFTER_ARGS}
+
+.include "${MASTERDIR}/Makefile"
diff --git a/lang/go125/distinfo b/lang/go125/distinfo
new file mode 100644
index 000000000000..9108ef0103ec
--- /dev/null
+++ b/lang/go125/distinfo
@@ -0,0 +1,13 @@
+TIMESTAMP = 1755133141
+SHA256 (go1.25.0.src.tar.gz) = 4bd01e91297207bfa450ea40d4d5a93b1b531a5e438473b2a06e18e077227225
+SIZE (go1.25.0.src.tar.gz) = 31974753
+SHA256 (go1.24.6.freebsd-arm64.tar.gz) = 76a75ad5125217c268029c0ad9c7295cc7f6042fe9cba4bebf9a89f7f42ad8af
+SIZE (go1.24.6.freebsd-arm64.tar.gz) = 74459381
+SHA256 (go1.24.6.freebsd-amd64.tar.gz) = 4983e2b10ae1f754e4eb07e1e589691c7e1d0dc428a92c16bd0e2ba03cc23ed9
+SIZE (go1.24.6.freebsd-amd64.tar.gz) = 78239878
+SHA256 (go1.24.6.freebsd-arm.tar.gz) = a8da621d8282a91ee17b257a46f2606391c019cc1a7d7be628638792ca8033ad
+SIZE (go1.24.6.freebsd-arm.tar.gz) = 76180805
+SHA256 (go1.24.6.freebsd-386.tar.gz) = 9cd74ad74f3ad833e92529f2fd9b0d7d9ffaab46307eccadb0afcf9a1ba09553
+SIZE (go1.24.6.freebsd-386.tar.gz) = 76141526
+SHA256 (go1.24.6.freebsd-riscv64.tar.gz) = ac206417d8460662f26d46dc2ad0488b2f9e22039946069ba4b48a0cb646e8b0
+SIZE (go1.24.6.freebsd-riscv64.tar.gz) = 75595860
diff --git a/lang/go125/files/patch-src_cmd_dist_build.go b/lang/go125/files/patch-src_cmd_dist_build.go
new file mode 100644
index 000000000000..59fd0c6539f8
--- /dev/null
+++ b/lang/go125/files/patch-src_cmd_dist_build.go
@@ -0,0 +1,23 @@
+--- src/cmd/dist/build.go.orig	2024-03-29 15:27:02 UTC
++++ src/cmd/dist/build.go
+@@ -891,6 +891,20 @@ func runInstall(pkg string, ch chan struct{}) {
+ 			asmArgs = append(asmArgs, "-D", "GOPPC64_power8")
+ 		}
+ 	}
++	if goarch == "arm" {
++		// Define GOARM_value from goarm, which can be either a version
++		// like "6", or a version and a FP mode, like "7,hardfloat".
++		switch {
++		case strings.Contains(goarm, "7"):
++			asmArgs = append(asmArgs, "-D", "GOARM_7")
++			fallthrough
++		case strings.Contains(goarm, "6"):
++			asmArgs = append(asmArgs, "-D", "GOARM_6")
++			fallthrough
++		default:
++			asmArgs = append(asmArgs, "-D", "GOARM_5")
++		}
++	}
+ 	goasmh := pathf("%s/go_asm.h", workdir)
+ 
+ 	// Collect symabis from assembly code.
diff --git a/lang/go125/files/patch-src_cmd_go_internal_modload_vendor.go b/lang/go125/files/patch-src_cmd_go_internal_modload_vendor.go
new file mode 100644
index 000000000000..ba3f97226624
--- /dev/null
+++ b/lang/go125/files/patch-src_cmd_go_internal_modload_vendor.go
@@ -0,0 +1,11 @@
+--- src/cmd/go/internal/modload/vendor.go.orig	2024-02-02 18:09:55 UTC
++++ src/cmd/go/internal/modload/vendor.go
+@@ -159,7 +159,7 @@ func checkVendorConsistency(indexes []*modFileIndex, m
+ 			panic(fmt.Errorf("not in workspace mode but number of indexes is %v, not 1", len(indexes)))
+ 		}
+ 		index := indexes[0]
+-		if gover.Compare(index.goVersion, "1.14") < 0 {
++		if gover.Compare(index.goVersion, "1.14") < 0 || os.Getenv("GO_NO_VENDOR_CHECKS") == "1" {
+ 			// Go versions before 1.14 did not include enough information in
+ 			// vendor/modules.txt to check for consistency.
+ 			// If we know that we're on an earlier version, relax the consistency check.