| GO-MODULE(5) | File Formats Manual | GO-MODULE(5) |
go-module —
lang/go port module
This manual page documents the behavior of setting
MODULES=lang/go in the
ports(7) tree.
Adds Go toolchain support. Requires
ALL_TARGET to be set to canonical Go import path of
port. (Module sets it automatically for ports that use
GH_ACCOUNT and GH_PROJECT
macros.)
During execution of pre-configure target
module moves source code from ${MODGO_SUBDIR} to
${WRKSRC}, subdirectory of
${MODGO_WORKSPACE} - specially-crafted Go workspace
located at ${WRKDIR}/go. During
do-build module calls “go install”
with GOPATH set to
${MODGO_WORKSPACE}, runs its output through sed to
prevent writes outside WRKDIR sandbox and sends
output to sh(1). During
do-install it copies executables from
${MODGO_WORKSPACE}/bin to
${PREFIX}/bin, and/or directories
${MODGO_WORKSPACE}/pkg and
${MODGO_WORKSPACE}/src to
${PREFIX}/go, depending on
MODGO_TYPE contents.
Sets BUILD_DEPENDS,
RUN_DEPENDS, ALL_TARGET,
TEST_TARGET, ONLY_FOR_ARCHS,
SEPARATE_BUILD, and
WRKSRC.
Appends to CATEGORIES.
Defines:
MODGO_TYPEDefaults to bin.
MODGO_WORKSPACEMODGO_SUBDIRMODGO_SETUP_WORKSPACEpre-configure target.MODGO_BUILDDEPMODGO_BUILD_DEPENDS
are appended to port's BUILD_DEPENDS. Defaults to
Yes.MODGO_MODNAMEMODGO_MODULES,
MODGO_MODFILES and
MODGO_VERSION need to be defined as well. Setting
this will also set ALL_TARGET. When
MODGO_MODFILES is set, and a "cmd"
directory is found in WRKSRC,
"./cmd/..." is also built by do-build
automatically.MODGO_VERSIONMODGO_MODULESMODGO_MODFILESAdditionally defines MODGO_ARCH
(application architecture name used by Go),
MODGO_PACKAGES,
MODGO_SOURCES and
MODGO_TOOLS (paths for installed Go packages,
sources and tools respectively), MODGO_CMD and
MODGO_FLAGS (source code build command and flags
passed as its arguments), MODGO_LDFLAGS,
MODGO_BUILD_CMD and
MODGO_TEST_CMD (commands for building and testing go
packages; normally called with canonical Go package names as arguments),
MODGO_{BUILD,INSTALL,TEST}_TARGET and
MODGO_{BUILD,RUN}_DEPENDS.
This module adds one make(1) target:
modgo-gen-modulesMODGO_MODULES and the
MODGO_MODFILES lists. If
MODGO_VERSION is set to "latest", the
latest known-to-Go version of a package will be used to build the list of
modules. Similarly, if MODGO_VERSION is empty, the
latest version will be fetched.| February 7, 2025 | openbsd |