git: 1ec501743bd9 - main - lang/go122: fix build on armv7

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Thu, 23 May 2024 14:57:23 UTC
The branch main has been updated by fuz:

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

commit 1ec501743bd9a626af211b4cab06751227a4d703
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2024-05-13 18:45:02 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2024-05-23 14:55:55 +0000

    lang/go122: fix build on armv7
    
    This backports a commit needed to get proper barriers during bootstrap
    when building Go with more than one job on armv7.
    
    Note that this only changes the behaviour when building the bootstrap
    toolchain.  Binaries generated using the toolchain are not affected
    and hence Go ports need not be bumped.
    
    PR:             278953
    Approved by:    portmgr (build fix blanket)
    Obtained from:  https://go-review.googlesource.com/c/go/+/562995
    See also:       https://github.com/golang/go/issues/65601
    MFH:            2024Q2
---
 lang/go122/Makefile                          |  3 ++-
 lang/go122/files/patch-src_cmd_dist_build.go | 23 +++++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/lang/go122/Makefile b/lang/go122/Makefile
index 962a50d32f6e..56d24ab1246e 100644
--- a/lang/go122/Makefile
+++ b/lang/go122/Makefile
@@ -1,6 +1,6 @@
 DISTVERSION=	1.22.3
 # Always set PORTREVISION explicitly as otherwise they are inherited from lang/go-devel
-PORTREVISION=	0
+PORTREVISION=	1
 MASTER_SITES=	https://golang.org/dl/ \
 		https://github.com/dmgk/go-bootstrap/releases/download/${BOOTSTRAP_TAG}/:bootstrap \
 		LOCAL/dmgk:bootstrap
@@ -9,6 +9,7 @@ DISTFILES=	go${DISTVERSION}.src.tar.gz \
 
 # Avoid conflicting patch files
 PATCHFILES=
+PATCHDIR=	${.CURDIR}/files
 
 COMMENT=	Go programming language
 
diff --git a/lang/go122/files/patch-src_cmd_dist_build.go b/lang/go122/files/patch-src_cmd_dist_build.go
new file mode 100644
index 000000000000..59fd0c6539f8
--- /dev/null
+++ b/lang/go122/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.