Path to this page:
Subject: CVS commit: pkgsrc/lang
From: Taylor R Campbell
Date: 2025-02-06 01:24:37
Message id: 20250206002437.3C8D0FBE0@cvs.NetBSD.org
Log Message:
lang/go: Add cross-build support.
This adds cross-build support for lang/go123 and for the Go-related
infrastructure in pkgsrc. (We could do older versions of Go too with
a little more work.)
Noteworthy changes that are not conditional on USE_CROSS_COMPILE:
1. lang/go/version.mk is rearranged to be more data-driven than
conditional-driven. Making it data-driven makes it easier to
define both GOARCH and GOHOSTARCH from the same tables when
MACHINE_ARCH and NATIVE_MACHINE_ARCH are not the same.
This is a likely source of broken edge cases. I went through the
old conditional logic and hand-checked all the conditions but I
could have made a mistake.
2. go-module.mk and go-package.mk define GOPATH_BIN to be `bin' for
native builds, and `bin/${GO_PLATFORM}' for cross builds -- this
is the subdirectory of GOPATH where the Go toolchain puts binaries
so that packages with custom do-install targets can avoid any need
for USE_CROSS_COMPILE conditionals.
The default do-install targets use pax slightly differently now to
avoid the need for USE_CROSS_COMPILE conditionals. I think the
logic is equivalent for native builds but this is worth reviewing.
3. lang/go123 no longer depends on bash and Perl at runtime. As far
as I can tell, this was just a kludge to pacify check-interpreter
complaints in the copy of the source code that Go ships under
${PREFIX}/go123/src. We don't need to replace the interpreter at
build-time -- most of these scripts are not run at all during the
build, and the handful that remain (make.bash, run.bash) are run
with ${BASH}. Instead, we CHECK_INTERPRETER_SKIP them in the
installed copy of the source code.
Proposed on tech-pkg:
https://mail-index.netbsd.org/tech-pkg/2025/01/19/msg030395.html
Files: