2020-07-17 18:19:17 +00:00
|
|
|
# $OpenBSD: go.port.mk,v 1.34 2020/07/17 18:19:17 abieber Exp $
|
2015-05-15 07:30:41 +00:00
|
|
|
|
|
|
|
ONLY_FOR_ARCHS ?= ${GO_ARCHS}
|
|
|
|
|
|
|
|
MODGO_BUILDDEP ?= Yes
|
|
|
|
|
2020-05-15 01:32:48 +00:00
|
|
|
MODGO_DIST_SUBDIR ?= go_modules
|
|
|
|
|
|
|
|
MASTER_SITE_ATHENS = https://proxy.golang.org/
|
|
|
|
|
|
|
|
MODGO_MASTER_SITESN = 9
|
|
|
|
MASTER_SITES${MODGO_MASTER_SITESN} ?= ${MASTER_SITE_ATHENS}
|
|
|
|
|
2015-05-15 07:30:41 +00:00
|
|
|
MODGO_RUN_DEPENDS = lang/go
|
2016-08-21 14:08:25 +00:00
|
|
|
MODGO_BUILD_DEPENDS = lang/go
|
2015-05-15 07:30:41 +00:00
|
|
|
|
|
|
|
.if ${NO_BUILD:L} == "no" && ${MODGO_BUILDDEP:L} == "yes"
|
|
|
|
BUILD_DEPENDS += ${MODGO_BUILD_DEPENDS}
|
|
|
|
.endif
|
|
|
|
|
2019-10-06 15:37:15 +00:00
|
|
|
.if ${MACHINE_ARCH} == "amd64"
|
|
|
|
_GOARCH = amd64
|
|
|
|
.elif ${MACHINE_ARCH} == "arm"
|
|
|
|
_GOARCH = arm
|
|
|
|
.elif ${MACHINE_ARCH} == "aarch64"
|
|
|
|
_GOARCH = arm64
|
|
|
|
.elif ${MACHINE_ARCH} == "i386"
|
|
|
|
_GOARCH = 386
|
|
|
|
.endif
|
|
|
|
|
2016-01-14 15:03:08 +00:00
|
|
|
MODGO_PACKAGE_PATH = ${PREFIX}/go-pkg
|
2019-10-06 15:37:15 +00:00
|
|
|
MODGO_PACKAGES = go-pkg/pkg/openbsd_${_GOARCH}
|
2016-01-14 15:03:08 +00:00
|
|
|
MODGO_SOURCES = go-pkg/src
|
2019-10-06 15:37:15 +00:00
|
|
|
MODGO_TOOLS = go-pkg/tool/openbsd_${_GOARCH}
|
2015-05-15 07:30:41 +00:00
|
|
|
|
Refactor lang/go module
From port-modules(5):
lang/go 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 post-patch 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.
Defines:
MODGO_TYPE Type of port. May be any combination of:
bin ordinary binary, which should be
installed to ${PREFIX}/bin,
lib library, which should come with
source code.
Defaults to bin.
MODGO_WORKSPACE Path to Go workspace set up for port build
process. Defaults to ${WRKDIR}/go. See
Go documentation for details.
MODGO_SUBDIR Path to Go source code within port's
sources tarball. Defaults to ${WRKDIST}.
MODGO_SETUP_WORKSPACE
Commands setting up Go workspace for
building ports. By default, happens
during execution of post-patch target.
MODGO_BUILDDEP Controls whether contents of
MODGO_BUILD_DEPENDS are appended to port's
BUILD_DEPENDS. Defaults to Yes.
Additionally defines 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_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.
OK sthen@
2015-06-08 09:17:04 +00:00
|
|
|
SUBST_VARS += MODGO_TOOLS MODGO_PACKAGES MODGO_SOURCES
|
2015-05-15 07:30:41 +00:00
|
|
|
|
Refactor lang/go module
From port-modules(5):
lang/go 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 post-patch 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.
Defines:
MODGO_TYPE Type of port. May be any combination of:
bin ordinary binary, which should be
installed to ${PREFIX}/bin,
lib library, which should come with
source code.
Defaults to bin.
MODGO_WORKSPACE Path to Go workspace set up for port build
process. Defaults to ${WRKDIR}/go. See
Go documentation for details.
MODGO_SUBDIR Path to Go source code within port's
sources tarball. Defaults to ${WRKDIST}.
MODGO_SETUP_WORKSPACE
Commands setting up Go workspace for
building ports. By default, happens
during execution of post-patch target.
MODGO_BUILDDEP Controls whether contents of
MODGO_BUILD_DEPENDS are appended to port's
BUILD_DEPENDS. Defaults to Yes.
Additionally defines 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_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.
OK sthen@
2015-06-08 09:17:04 +00:00
|
|
|
MODGO_SUBDIR ?= ${WRKDIST}
|
|
|
|
MODGO_TYPE ?= bin
|
|
|
|
MODGO_WORKSPACE ?= ${WRKDIR}/go
|
2019-03-16 13:36:01 +00:00
|
|
|
MODGO_GOCACHE ?= ${WRKDIR}/go-cache
|
2016-05-08 12:29:17 +00:00
|
|
|
MODGO_GOPATH ?= ${MODGO_WORKSPACE}:${MODGO_PACKAGE_PATH}
|
2019-11-19 09:17:06 +00:00
|
|
|
# We cannot assume that the maching running the built code will have SSE,
|
|
|
|
# even though the machine building the package has SSE. As such, we need
|
|
|
|
# to explicitly disable SSE on i386 builds.
|
|
|
|
MAKE_ENV += GO386=387
|
2020-05-15 01:32:48 +00:00
|
|
|
MAKE_ENV += GOCACHE="${MODGO_GOCACHE}"
|
|
|
|
|
2019-05-04 21:46:16 +00:00
|
|
|
MODGO_CMD ?= ${SETENV} ${MAKE_ENV} go
|
Refactor lang/go module
From port-modules(5):
lang/go 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 post-patch 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.
Defines:
MODGO_TYPE Type of port. May be any combination of:
bin ordinary binary, which should be
installed to ${PREFIX}/bin,
lib library, which should come with
source code.
Defaults to bin.
MODGO_WORKSPACE Path to Go workspace set up for port build
process. Defaults to ${WRKDIR}/go. See
Go documentation for details.
MODGO_SUBDIR Path to Go source code within port's
sources tarball. Defaults to ${WRKDIST}.
MODGO_SETUP_WORKSPACE
Commands setting up Go workspace for
building ports. By default, happens
during execution of post-patch target.
MODGO_BUILDDEP Controls whether contents of
MODGO_BUILD_DEPENDS are appended to port's
BUILD_DEPENDS. Defaults to Yes.
Additionally defines 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_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.
OK sthen@
2015-06-08 09:17:04 +00:00
|
|
|
MODGO_BUILD_CMD = ${MODGO_CMD} install ${MODGO_FLAGS}
|
2018-03-14 14:12:02 +00:00
|
|
|
MODGO_TEST_CMD = ${MODGO_CMD} test ${MODGO_FLAGS} ${MODGO_TEST_FLAGS}
|
2019-09-04 12:22:03 +00:00
|
|
|
MODGO_BINDIR ?= bin
|
Refactor lang/go module
From port-modules(5):
lang/go 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 post-patch 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.
Defines:
MODGO_TYPE Type of port. May be any combination of:
bin ordinary binary, which should be
installed to ${PREFIX}/bin,
lib library, which should come with
source code.
Defaults to bin.
MODGO_WORKSPACE Path to Go workspace set up for port build
process. Defaults to ${WRKDIR}/go. See
Go documentation for details.
MODGO_SUBDIR Path to Go source code within port's
sources tarball. Defaults to ${WRKDIST}.
MODGO_SETUP_WORKSPACE
Commands setting up Go workspace for
building ports. By default, happens
during execution of post-patch target.
MODGO_BUILDDEP Controls whether contents of
MODGO_BUILD_DEPENDS are appended to port's
BUILD_DEPENDS. Defaults to Yes.
Additionally defines 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_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.
OK sthen@
2015-06-08 09:17:04 +00:00
|
|
|
|
2017-01-30 16:58:40 +00:00
|
|
|
.if ! empty(MODGO_LDFLAGS)
|
|
|
|
MODGO_BUILD_CMD += -ldflags="${MODGO_LDFLAGS}"
|
|
|
|
MODGO_TEST_CMD += -ldflags="${MODGO_LDFLAGS}"
|
|
|
|
.endif
|
|
|
|
|
2020-05-15 01:32:48 +00:00
|
|
|
.if defined(MODGO_MODNAME)
|
|
|
|
EXTRACT_SUFX ?= .zip
|
|
|
|
PKGNAME ?= ${DISTNAME:S/-v/-/}
|
|
|
|
ALL_TARGET ?= ${MODGO_MODNAME}
|
2020-07-17 18:19:17 +00:00
|
|
|
MODGO_FLAGS += -modcacherw
|
2020-05-15 01:32:48 +00:00
|
|
|
DISTFILES = ${DISTNAME}${EXTRACT_SUFX}{${MODGO_VERSION}${EXTRACT_SUFX}}
|
2020-05-17 10:31:50 +00:00
|
|
|
EXTRACT_ONLY = ${DISTNAME}${EXTRACT_SUFX}
|
2020-05-15 01:32:48 +00:00
|
|
|
MASTER_SITES ?= ${MASTER_SITE_ATHENS}${MODGO_MODNAME}/@v/
|
|
|
|
. for _modpath _modver in ${MODGO_MODULES}
|
2020-05-17 10:08:36 +00:00
|
|
|
DISTFILES += ${MODGO_DIST_SUBDIR}/${_modpath}/@v/${_modver}.zip{${_modpath}/@v/${_modver}.zip}:${MODGO_MASTER_SITESN}
|
2020-06-25 13:57:45 +00:00
|
|
|
DISTFILES += ${MODGO_DIST_SUBDIR}/${_modpath}/@v/${_modver}.mod{${_modpath}/@v/${_modver}.mod}:${MODGO_MASTER_SITESN}
|
2020-05-15 01:32:48 +00:00
|
|
|
. endfor
|
|
|
|
. for _modpath _modver in ${MODGO_MODFILES}
|
2020-05-17 10:08:36 +00:00
|
|
|
DISTFILES += ${MODGO_DIST_SUBDIR}/${_modpath}/@v/${_modver}.mod{${_modpath}/@v/${_modver}.mod}:${MODGO_MASTER_SITESN}
|
2020-05-15 01:32:48 +00:00
|
|
|
. endfor
|
|
|
|
MAKE_ENV += GOPROXY=file://${DISTDIR}/${MODGO_DIST_SUBDIR}
|
|
|
|
MAKE_ENV += GO111MODULE=on GOPATH="${MODGO_GOPATH}"
|
|
|
|
.else
|
|
|
|
# ports are not allowed to fetch from the network at build time; point
|
|
|
|
# GOPROXY at an unreachable host so that failures are also visible to
|
|
|
|
# developers who don't have PORTS_PRIVSEP and a "deny .. _pbuild" PF rule.
|
|
|
|
MAKE_ENV += GOPROXY=invalid://ports.should.not.fetch.at.buildtime/
|
|
|
|
MAKE_ENV += GO111MODULE=off GOPATH="${MODGO_GOPATH}"
|
|
|
|
. if defined(GH_ACCOUNT) && defined(GH_PROJECT)
|
|
|
|
ALL_TARGET ?= github.com/${GH_ACCOUNT}/${GH_PROJECT}
|
|
|
|
. endif
|
Refactor lang/go module
From port-modules(5):
lang/go 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 post-patch 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.
Defines:
MODGO_TYPE Type of port. May be any combination of:
bin ordinary binary, which should be
installed to ${PREFIX}/bin,
lib library, which should come with
source code.
Defaults to bin.
MODGO_WORKSPACE Path to Go workspace set up for port build
process. Defaults to ${WRKDIR}/go. See
Go documentation for details.
MODGO_SUBDIR Path to Go source code within port's
sources tarball. Defaults to ${WRKDIST}.
MODGO_SETUP_WORKSPACE
Commands setting up Go workspace for
building ports. By default, happens
during execution of post-patch target.
MODGO_BUILDDEP Controls whether contents of
MODGO_BUILD_DEPENDS are appended to port's
BUILD_DEPENDS. Defaults to Yes.
Additionally defines 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_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.
OK sthen@
2015-06-08 09:17:04 +00:00
|
|
|
.endif
|
|
|
|
|
2020-05-15 01:32:48 +00:00
|
|
|
MODGO_TEST_TARGET ?= cd ${WRKSRC} && ${MODGO_CMD} test ${ALL_TARGET}
|
Refactor lang/go module
From port-modules(5):
lang/go 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 post-patch 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.
Defines:
MODGO_TYPE Type of port. May be any combination of:
bin ordinary binary, which should be
installed to ${PREFIX}/bin,
lib library, which should come with
source code.
Defaults to bin.
MODGO_WORKSPACE Path to Go workspace set up for port build
process. Defaults to ${WRKDIR}/go. See
Go documentation for details.
MODGO_SUBDIR Path to Go source code within port's
sources tarball. Defaults to ${WRKDIST}.
MODGO_SETUP_WORKSPACE
Commands setting up Go workspace for
building ports. By default, happens
during execution of post-patch target.
MODGO_BUILDDEP Controls whether contents of
MODGO_BUILD_DEPENDS are appended to port's
BUILD_DEPENDS. Defaults to Yes.
Additionally defines 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_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.
OK sthen@
2015-06-08 09:17:04 +00:00
|
|
|
|
2020-05-15 01:32:48 +00:00
|
|
|
SEPARATE_BUILD ?= Yes
|
Refactor lang/go module
From port-modules(5):
lang/go 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 post-patch 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.
Defines:
MODGO_TYPE Type of port. May be any combination of:
bin ordinary binary, which should be
installed to ${PREFIX}/bin,
lib library, which should come with
source code.
Defaults to bin.
MODGO_WORKSPACE Path to Go workspace set up for port build
process. Defaults to ${WRKDIR}/go. See
Go documentation for details.
MODGO_SUBDIR Path to Go source code within port's
sources tarball. Defaults to ${WRKDIST}.
MODGO_SETUP_WORKSPACE
Commands setting up Go workspace for
building ports. By default, happens
during execution of post-patch target.
MODGO_BUILDDEP Controls whether contents of
MODGO_BUILD_DEPENDS are appended to port's
BUILD_DEPENDS. Defaults to Yes.
Additionally defines 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_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.
OK sthen@
2015-06-08 09:17:04 +00:00
|
|
|
|
2015-08-11 20:16:21 +00:00
|
|
|
CATEGORIES += lang/go
|
|
|
|
|
2016-01-14 15:03:08 +00:00
|
|
|
MODGO_BUILD_TARGET = ${MODGO_BUILD_CMD} ${ALL_TARGET}
|
2018-05-21 21:11:27 +00:00
|
|
|
MODGO_FLAGS += -v -p ${MAKE_JOBS}
|
2016-08-03 09:34:10 +00:00
|
|
|
|
|
|
|
.if empty(DEBUG)
|
|
|
|
# by default omit symbol table, debug information and DWARF symbol table
|
2017-01-30 16:58:40 +00:00
|
|
|
MODGO_LDFLAGS += -s -w
|
2018-05-21 21:11:27 +00:00
|
|
|
.else
|
|
|
|
MODGO_FLAGS += -x
|
2016-08-03 09:34:10 +00:00
|
|
|
.endif
|
Refactor lang/go module
From port-modules(5):
lang/go 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 post-patch 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.
Defines:
MODGO_TYPE Type of port. May be any combination of:
bin ordinary binary, which should be
installed to ${PREFIX}/bin,
lib library, which should come with
source code.
Defaults to bin.
MODGO_WORKSPACE Path to Go workspace set up for port build
process. Defaults to ${WRKDIR}/go. See
Go documentation for details.
MODGO_SUBDIR Path to Go source code within port's
sources tarball. Defaults to ${WRKDIST}.
MODGO_SETUP_WORKSPACE
Commands setting up Go workspace for
building ports. By default, happens
during execution of post-patch target.
MODGO_BUILDDEP Controls whether contents of
MODGO_BUILD_DEPENDS are appended to port's
BUILD_DEPENDS. Defaults to Yes.
Additionally defines 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_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.
OK sthen@
2015-06-08 09:17:04 +00:00
|
|
|
|
2020-05-15 01:32:48 +00:00
|
|
|
.if empty(MODGO_MODNAME)
|
|
|
|
WRKSRC ?= ${MODGO_WORKSPACE}/src/${ALL_TARGET}
|
|
|
|
MODGO_SETUP_WORKSPACE = mkdir -p ${WRKSRC:H}; mv ${MODGO_SUBDIR} ${WRKSRC};
|
|
|
|
.else
|
|
|
|
WRKSRC ?= ${WRKDIR}/${MODGO_MODNAME}@${MODGO_VERSION}
|
|
|
|
MODGO_SETUP_WORKSPACE = ln -sf ${WRKSRC} ${WRKDIR}/${MODGO_MODNAME}
|
|
|
|
.endif
|
|
|
|
|
2016-05-05 10:46:50 +00:00
|
|
|
INSTALL_STRIP =
|
2015-06-12 05:20:48 +00:00
|
|
|
.if ${MODGO_TYPE:L:Mbin}
|
2019-09-04 12:22:03 +00:00
|
|
|
MODGO_INSTALL_TARGET = ${INSTALL_PROGRAM_DIR} ${PREFIX}/${MODGO_BINDIR} && \
|
|
|
|
${INSTALL_PROGRAM} ${MODGO_WORKSPACE}/bin/* \
|
|
|
|
${PREFIX}/${MODGO_BINDIR};
|
2015-06-12 05:20:48 +00:00
|
|
|
.endif
|
|
|
|
|
Refactor lang/go module
From port-modules(5):
lang/go 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 post-patch 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.
Defines:
MODGO_TYPE Type of port. May be any combination of:
bin ordinary binary, which should be
installed to ${PREFIX}/bin,
lib library, which should come with
source code.
Defaults to bin.
MODGO_WORKSPACE Path to Go workspace set up for port build
process. Defaults to ${WRKDIR}/go. See
Go documentation for details.
MODGO_SUBDIR Path to Go source code within port's
sources tarball. Defaults to ${WRKDIST}.
MODGO_SETUP_WORKSPACE
Commands setting up Go workspace for
building ports. By default, happens
during execution of post-patch target.
MODGO_BUILDDEP Controls whether contents of
MODGO_BUILD_DEPENDS are appended to port's
BUILD_DEPENDS. Defaults to Yes.
Additionally defines 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_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.
OK sthen@
2015-06-08 09:17:04 +00:00
|
|
|
# Go source files serve the purpose of libraries, so sources should be included
|
|
|
|
# with library ports.
|
|
|
|
.if ${MODGO_TYPE:L:Mlib}
|
2016-05-21 01:39:36 +00:00
|
|
|
MODGO_INSTALL_TARGET += ${INSTALL_DATA_DIR} ${MODGO_PACKAGE_PATH} && \
|
2016-05-06 10:04:00 +00:00
|
|
|
cd ${MODGO_WORKSPACE} && \
|
|
|
|
find src pkg -type d -exec ${INSTALL_DATA_DIR} \
|
2018-05-10 18:39:35 +00:00
|
|
|
${MODGO_PACKAGE_PATH}/{} \; \
|
|
|
|
-o -type f -exec ${INSTALL_DATA} -p \
|
2016-05-06 10:04:00 +00:00
|
|
|
${MODGO_WORKSPACE}/{} \
|
|
|
|
${MODGO_PACKAGE_PATH}/{} \;
|
2016-08-21 14:08:25 +00:00
|
|
|
|
|
|
|
# This is required to force rebuilding of go libraries upon changes in
|
|
|
|
# toolchain.
|
|
|
|
RUN_DEPENDS += ${MODGO_RUN_DEPENDS}
|
Refactor lang/go module
From port-modules(5):
lang/go 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 post-patch 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.
Defines:
MODGO_TYPE Type of port. May be any combination of:
bin ordinary binary, which should be
installed to ${PREFIX}/bin,
lib library, which should come with
source code.
Defaults to bin.
MODGO_WORKSPACE Path to Go workspace set up for port build
process. Defaults to ${WRKDIR}/go. See
Go documentation for details.
MODGO_SUBDIR Path to Go source code within port's
sources tarball. Defaults to ${WRKDIST}.
MODGO_SETUP_WORKSPACE
Commands setting up Go workspace for
building ports. By default, happens
during execution of post-patch target.
MODGO_BUILDDEP Controls whether contents of
MODGO_BUILD_DEPENDS are appended to port's
BUILD_DEPENDS. Defaults to Yes.
Additionally defines 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_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.
OK sthen@
2015-06-08 09:17:04 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if empty(CONFIGURE_STYLE)
|
2017-12-02 09:29:14 +00:00
|
|
|
MODGO_pre-configure += ${MODGO_SETUP_WORKSPACE}
|
Refactor lang/go module
From port-modules(5):
lang/go 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 post-patch 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.
Defines:
MODGO_TYPE Type of port. May be any combination of:
bin ordinary binary, which should be
installed to ${PREFIX}/bin,
lib library, which should come with
source code.
Defaults to bin.
MODGO_WORKSPACE Path to Go workspace set up for port build
process. Defaults to ${WRKDIR}/go. See
Go documentation for details.
MODGO_SUBDIR Path to Go source code within port's
sources tarball. Defaults to ${WRKDIST}.
MODGO_SETUP_WORKSPACE
Commands setting up Go workspace for
building ports. By default, happens
during execution of post-patch target.
MODGO_BUILDDEP Controls whether contents of
MODGO_BUILD_DEPENDS are appended to port's
BUILD_DEPENDS. Defaults to Yes.
Additionally defines 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_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.
OK sthen@
2015-06-08 09:17:04 +00:00
|
|
|
|
2020-05-15 01:32:48 +00:00
|
|
|
|
Refactor lang/go module
From port-modules(5):
lang/go 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 post-patch 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.
Defines:
MODGO_TYPE Type of port. May be any combination of:
bin ordinary binary, which should be
installed to ${PREFIX}/bin,
lib library, which should come with
source code.
Defaults to bin.
MODGO_WORKSPACE Path to Go workspace set up for port build
process. Defaults to ${WRKDIR}/go. See
Go documentation for details.
MODGO_SUBDIR Path to Go source code within port's
sources tarball. Defaults to ${WRKDIST}.
MODGO_SETUP_WORKSPACE
Commands setting up Go workspace for
building ports. By default, happens
during execution of post-patch target.
MODGO_BUILDDEP Controls whether contents of
MODGO_BUILD_DEPENDS are appended to port's
BUILD_DEPENDS. Defaults to Yes.
Additionally defines 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_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.
OK sthen@
2015-06-08 09:17:04 +00:00
|
|
|
. if !target(do-build)
|
|
|
|
do-build:
|
2020-05-15 01:32:48 +00:00
|
|
|
. if empty(MODGO_MODNAME)
|
|
|
|
cd ${WRKSRC} && \
|
|
|
|
${MODGO_BUILD_TARGET}
|
|
|
|
. else
|
|
|
|
if [ -d ${WRKSRC}/cmd ]; then \
|
|
|
|
cd ${WRKSRC} && \
|
|
|
|
${MODGO_BUILD_CMD} ${ALL_TARGET}/cmd/... ; \
|
|
|
|
else \
|
|
|
|
cd ${WRKSRC} && \
|
|
|
|
${MODGO_BUILD_CMD} ${ALL_TARGET} ; \
|
|
|
|
fi;
|
|
|
|
. endif
|
Refactor lang/go module
From port-modules(5):
lang/go 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 post-patch 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.
Defines:
MODGO_TYPE Type of port. May be any combination of:
bin ordinary binary, which should be
installed to ${PREFIX}/bin,
lib library, which should come with
source code.
Defaults to bin.
MODGO_WORKSPACE Path to Go workspace set up for port build
process. Defaults to ${WRKDIR}/go. See
Go documentation for details.
MODGO_SUBDIR Path to Go source code within port's
sources tarball. Defaults to ${WRKDIST}.
MODGO_SETUP_WORKSPACE
Commands setting up Go workspace for
building ports. By default, happens
during execution of post-patch target.
MODGO_BUILDDEP Controls whether contents of
MODGO_BUILD_DEPENDS are appended to port's
BUILD_DEPENDS. Defaults to Yes.
Additionally defines 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_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.
OK sthen@
2015-06-08 09:17:04 +00:00
|
|
|
. endif
|
|
|
|
|
|
|
|
. if !target(do-install)
|
|
|
|
do-install:
|
|
|
|
${MODGO_INSTALL_TARGET}
|
|
|
|
. endif
|
|
|
|
|
|
|
|
. if !target(do-test)
|
|
|
|
do-test:
|
|
|
|
${MODGO_TEST_TARGET}
|
|
|
|
. endif
|
|
|
|
.endif
|