head	1.3;
access;
symbols
	pkgsrc-2026Q2:1.3.0.2
	pkgsrc-2026Q2-base:1.3
	pkgsrc-2026Q1:1.1.0.18
	pkgsrc-2026Q1-base:1.1
	pkgsrc-2025Q4:1.1.0.16
	pkgsrc-2025Q4-base:1.1
	pkgsrc-2025Q3:1.1.0.14
	pkgsrc-2025Q3-base:1.1
	pkgsrc-2025Q2:1.1.0.12
	pkgsrc-2025Q2-base:1.1
	pkgsrc-2025Q1:1.1.0.10
	pkgsrc-2025Q1-base:1.1
	pkgsrc-2024Q4:1.1.0.8
	pkgsrc-2024Q4-base:1.1
	pkgsrc-2024Q3:1.1.0.6
	pkgsrc-2024Q3-base:1.1
	pkgsrc-2024Q2:1.1.0.4
	pkgsrc-2024Q2-base:1.1
	pkgsrc-2024Q1:1.1.0.2
	pkgsrc-2024Q1-base:1.1;
locks; strict;
comment	@# @;


1.3
date	2026.05.31.13.25.27;	author gdt;	state Exp;
branches;
next	1.2;
commitid	WBGdsBaQLnbCaYHG;

1.2
date	2026.04.02.11.37.22;	author tnn;	state Exp;
branches;
next	1.1;
commitid	fyddYmHVLE91tnAG;

1.1
date	2024.02.09.20.34.10;	author bsiegert;	state Exp;
branches;
next	;
commitid	IHpwSNzlQojdBNXE;


desc
@@


1.3
log
@lang/go122: Merge MAKE_JOBS fix with unrelated workaround

This commit merges the recent change in go126 (already applied to
other go versions) to respect MAKE_JOBS.

go122 (and only go122) had a change to force GOMAXPROCS to 1,
unconditionally.  This turns out to be a workaround for a bug in
go122, which is not a MAKE_JOBS type of unsynchronized dependency.  It
is instead a more complicated bug, not clearly understood.
Keep this change, with an explanation for why it's present instead of
the standard approach.

Retroactively document the bug workaround based on email explanations
from tnn@@ about why I should not simply replace the GOMAXPROCS=1,
which I guessed was about avoiding excessive parallelism, with the
standard approach.

In the end, this is comment-only change.
@
text
@# $NetBSD: Makefile,v 1.2 2026/04/02 11:37:22 tnn Exp $

.include "../../lang/go/version.mk"
GO_BOOTSTRAP_REQD=	120
.include "../../lang/go/bootstrap.mk"

GOVERSSUFFIX=	122

DISTNAME=	go${GO${GOVERSSUFFIX}_VERSION}.src
PKGNAME=	go${GOVERSSUFFIX}-${GO${GOVERSSUFFIX}_VERSION}
CATEGORIES=	lang
MASTER_SITES=	https://storage.googleapis.com/golang/

MAINTAINER=	bsiegert@@NetBSD.org
HOMEPAGE=	https://golang.org/
COMMENT=	The Go programming language
LICENSE=	modified-bsd

WRKSRC=		${WRKDIR}/go
USE_TOOLS+=	bash:run perl:run pax

# cgo compiles under TMPDIR
TMPDIR?=	/tmp
BUILDLINK_PASSTHRU_DIRS+= ${TMPDIR}

GOROOT_FINAL=		${PREFIX}/go${GOVERSSUFFIX}
INSTALLATION_DIRS=	bin go${GOVERSSUFFIX}

REPLACE_BASH+=	lib/time/update.bash
REPLACE_BASH+=	misc/wasm/go_js_wasm_exec
REPLACE_BASH+=	misc/wasm/go_wasip1_wasm_exec
REPLACE_BASH+=	src/all.bash
REPLACE_BASH+=	src/bootstrap.bash
REPLACE_BASH+=	src/buildall.bash
REPLACE_BASH+=	src/clean.bash
REPLACE_BASH+=	src/cmd/compile/internal/ssa/_gen/cover.bash
REPLACE_BASH+=	src/cmd/vendor/golang.org/x/sys/plan9/mkall.sh
REPLACE_BASH+=	src/cmd/vendor/golang.org/x/sys/plan9/mkerrors.sh
REPLACE_BASH+=	src/cmd/vendor/golang.org/x/sys/unix/mkall.sh
REPLACE_BASH+=	src/cmd/vendor/golang.org/x/sys/unix/mkerrors.sh
REPLACE_BASH+=	src/cmd/vendor/golang.org/x/sys/windows/mkerrors.bash
REPLACE_BASH+=	src/cmd/vendor/golang.org/x/sys/windows/mkknownfolderids.bash
REPLACE_BASH+=	src/crypto/internal/boring/build.sh
REPLACE_BASH+=	src/crypto/internal/boring/build-boring.sh
REPLACE_BASH+=	src/crypto/internal/boring/build-goboring.sh
REPLACE_BASH+=	src/go/doc/comment/mkstd.sh
REPLACE_BASH+=	src/internal/trace/mkcanned.bash
REPLACE_BASH+=	src/internal/trace/v2/mkexp.bash
REPLACE_BASH+=	src/cmp.bash
REPLACE_BASH+=	src/make.bash
REPLACE_BASH+=	src/race.bash
REPLACE_BASH+=	src/run.bash
REPLACE_BASH+=	src/runtime/race/mkcgo.sh
REPLACE_BASH+=	src/syscall/mkall.sh
REPLACE_BASH+=	src/syscall/mkerrors.sh
REPLACE_BASH+=	src/syscall/mksysnum_plan9.sh

REPLACE_PERL+=	src/regexp/syntax/make_perl_groups.pl
REPLACE_PERL+=	src/syscall/*.pl

# uses own linker, which does not support relro on NetBSD
CHECK_RELRO_SKIP+=		go${GOVERSSUFFIX}/bin/go
CHECK_RELRO_SKIP+=		go${GOVERSSUFFIX}/bin/gofmt
CHECK_RELRO_SKIP+=		go${GOVERSSUFFIX}/pkg/bootstrap/bin/asm
CHECK_RELRO_SKIP+=		go${GOVERSSUFFIX}/pkg/bootstrap/bin/compile
CHECK_RELRO_SKIP+=		go${GOVERSSUFFIX}/pkg/bootstrap/bin/link
CHECK_RELRO_SKIP+=		go${GOVERSSUFFIX}/pkg/bootstrap/bin/cgo
# also does not support SSP at this time
CHECK_SSP_SKIP=			${CHECK_RELRO_SKIP}

# uses /bin/rc (for Plan 9)
CHECK_INTERPRETER_SKIP+=	go${GOVERSSUFFIX}/include/plan9/mklibc.rc
CHECK_INTERPRETER_SKIP+=	go${GOVERSSUFFIX}/src/all.rc
CHECK_INTERPRETER_SKIP+=	go${GOVERSSUFFIX}/src/clean.rc
CHECK_INTERPRETER_SKIP+=	go${GOVERSSUFFIX}/src/make.rc
CHECK_INTERPRETER_SKIP+=	go${GOVERSSUFFIX}/src/run.rc

SUBST_CLASSES+=		paths
SUBST_STAGE.paths=	pre-configure
SUBST_FILES.paths=	src/crypto/x509/root_solaris.go
SUBST_VARS.paths=	PKG_SYSCONFDIR

# Required until we bootstrap from a native illumos kit.  This is obviously
# terrible and should be fixed properly.
.if ${OPSYS} == "SunOS" && ${OS_VARIANT} != "Solaris"
SUBST_CLASSES+=		grplist
SUBST_STAGE.grplist=	pre-configure
SUBST_FILES.grplist=	src/os/user/getgrouplist_unix.go
SUBST_SED.grplist=	-e 's,return getgrouplist.*,return 0;,'
.endif

PLIST_SUBST+=	GOVERSSUFFIX=${GOVERSSUFFIX}

PRINT_PLIST_AWK+=	/^bin\/go${GOVERSSUFFIX}/ { print "bin/go$${GOVERSSUFFIX}"; next; }
PRINT_PLIST_AWK+=	/^bin\/gofmt${GOVERSSUFFIX}/ { print "bin/gofmt$${GOVERSSUFFIX}"; next; }

post-extract:
	${RM} -r -f ${WRKSRC}/test/fixedbugs/issue27836*

# By default, go build invokes unreasonable parallelism.  Rather than
# ${MAKE_JOBS} of 1 thread as with make, we run just "go build" (1
# job) and tell it to not exceed ${MAKE_JOBS} threads.  This is sound
# because there is no make with -jN args also.
#
# go122 is buggy on some systems, at least NetBSD, and the build fails
# (probababilistically) if GOMAXPROCS is above 1.   This might be
#   https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278953
# in which case the scope of failure is more or less *BSD.
# To work around this, we set GOMAXPROCS to 1, unconditionally,
# rather than the proper "GOMAXPROCS=${MAKE_JOBS:U1}".
# \todo File/fix upstream.
# \todo Limit workaround to necessary platforms.
do-build:
	cd ${WRKSRC}/src && \
		env \
		GOMAXPROCS=1 \
		GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:Q} \
		GOROOT_FINAL=${GOROOT_FINAL:Q} \
		${GOOPT} \
		GOCACHE=${WRKDIR}/.cache/go-build \
		${BASH} ./make.bash -v
# for RELRO build:
#	cd ${WRKSRC}/src && env GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:Q} GOROOT_FINAL=${GOROOT_FINAL:Q} GO_LDFLAGS="-buildmode=pie" ${GOOPT} ${BASH} ./make.bash

do-install:
	cd ${WRKSRC} && rm -rf pkg/obj pkg/bootstrap
	cd ${WRKSRC} && pax -rw . ${DESTDIR}${PREFIX}/go${GOVERSSUFFIX}
	find ${DESTDIR}${PREFIX}/go${GOVERSSUFFIX} -name \*.orig -exec rm {} \;
.for cmd in go gofmt
	${LN} -sf ${PREFIX}/go${GOVERSSUFFIX}/bin/${cmd} ${DESTDIR}${PREFIX}/bin/${cmd}${GOVERSSUFFIX}
.endfor

do-test:
	cd ${WRKSRC}/src && GOROOT=${WRKSRC} PATH=${WRKSRC}/bin:${PATH} ${GOOPT} ${BASH} run.bash --no-rebuild --banner ""

.include "../../mk/bsd.pkg.mk"
@


1.2
log
@go122: build w/ GOMAXPROCS=1

It frequently encounters a concurrency/gc related panic[1] on at
least earmv7hf. Could not reproduce with later versions of go.
[1] fatal error: workbuf is not empty
@
text
@d1 1
a1 1
# $NetBSD: Makefile,v 1.1 2024/02/09 20:34:10 bsiegert Exp $
d100 13
@


1.1
log
@Add a new package for go122-1.22.0

The latest Go release, version 1.22, arrives six months after Go 1.21. 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.

Release notes: https://go.dev/doc/go1.22
@
text
@d1 1
a1 1
# $NetBSD: Makefile,v 1.2 2023/12/08 14:57:37 bsiegert Exp $
d103 1
@

