mirror of
https://github.com/beard7n/bsdports.git
synced 2026-04-14 04:21:18 +02:00
add node 14
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# $FreeBSD: head/Mk/Uses/go.mk 512187 2019-09-16 20:55:08Z dmgk $
|
||||
# $FreeBSD: head/Mk/Uses/go.mk 531678 2020-04-14 12:52:02Z dmgk $
|
||||
#
|
||||
# This file contains logic to ease porting of Go binaries using the
|
||||
# `go` command.
|
||||
@@ -12,8 +12,8 @@
|
||||
# in modules-aware mode.
|
||||
# no_targets Indicates that Go is needed at build time as a part of
|
||||
# make/CMake build. This will setup build environment like
|
||||
# GO_ENV, GO_BUILDFLAGS but will not create post-extract, do-build
|
||||
# and do-install targets.
|
||||
# GO_ENV, GO_BUILDFLAGS but will not create post-extract and
|
||||
# do-{build,install,test} targets.
|
||||
# run Indicates that Go is needed at run time and adds it to
|
||||
# RUN_DEPENDS.
|
||||
#
|
||||
@@ -21,19 +21,19 @@
|
||||
#
|
||||
# GO_PKGNAME
|
||||
# The name of the package when building in GOPATH mode. This
|
||||
# is the directory that will be created in GOPATH/src and seen
|
||||
# by the `go` command. If not set explicitly and GH_SUBDIR or
|
||||
# GL_SUBDIR is present, GO_PKGNAME will be inferred from it.
|
||||
# is the directory that will be created in ${GOPATH}/src. If not set
|
||||
# explicitly and GH_SUBDIR or GL_SUBDIR is present, GO_PKGNAME will
|
||||
# be inferred from it.
|
||||
# It is not needed when building in modules-aware mode.
|
||||
#
|
||||
# GO_TARGET
|
||||
# The packages to build. If not set explicitly, defaults to
|
||||
# GO_PKGNAME. GO_TARGET can also be a tuple in the form
|
||||
# package:path where path can be either a simple filename or a
|
||||
# full path starting with ${PREFIX}. Specifying a full path
|
||||
# like ${PREFIX}/sbin/binary will install the resulting binary
|
||||
# as ${PREFIX}/sbin/binary. Using just simple filename is a
|
||||
# shortcut to installing it as ${PREFIX}/bin/filename.
|
||||
# The packages to build. The default value is ${GO_PKGNAME}.
|
||||
# GO_TARGET can also be a tuple in the form package:path where path can be
|
||||
# either a simple filename or a full path starting with ${PREFIX}.
|
||||
#
|
||||
# GO_TESTTARGET
|
||||
# The packages to test. The default value is `./...` (the current package
|
||||
# and all subpackages).
|
||||
#
|
||||
# CGO_CFLAGS
|
||||
# Additional CFLAGS variables to be passed to the C compiler by the `go`
|
||||
@@ -44,7 +44,10 @@
|
||||
# command
|
||||
#
|
||||
# GO_BUILDFLAGS
|
||||
# Additional build arguments to be passed to the `go install` command
|
||||
# Additional build arguments to be passed to the `go build` command
|
||||
#
|
||||
# GO_TESTFLAGS
|
||||
# Additional build arguments to be passed to the `go test` command
|
||||
#
|
||||
# GO_PORT
|
||||
# The Go port to use. By default this is lang/go but can be set
|
||||
@@ -62,6 +65,7 @@ IGNORE= USES=go has invalid arguments: ${go_ARGS:Nmodules:Nno_targets:Nrun}
|
||||
.endif
|
||||
|
||||
# Settable variables
|
||||
|
||||
.if empty(GO_PKGNAME)
|
||||
. if !empty(GH_SUBDIR)
|
||||
GO_PKGNAME= ${GH_SUBDIR:S|^src/||}
|
||||
@@ -71,19 +75,28 @@ GO_PKGNAME= ${GL_SUBDIR:S|^src/||}
|
||||
GO_PKGNAME= ${PORTNAME}
|
||||
. endif
|
||||
.endif
|
||||
|
||||
GO_TARGET?= ${GO_PKGNAME}
|
||||
GO_TESTTARGET?= ./...
|
||||
|
||||
GO_BUILDFLAGS+= -v -buildmode=exe
|
||||
.if !defined(WITH_DEBUG) && empty(GO_BUILDFLAGS:M-ldflags*)
|
||||
GO_BUILDFLAGS+= -ldflags=-s
|
||||
.endif
|
||||
GO_TESTFLAGS+= -v
|
||||
|
||||
CGO_ENABLED?= 1
|
||||
CGO_CFLAGS+= -I${LOCALBASE}/include
|
||||
CGO_LDFLAGS+= -L${LOCALBASE}/lib
|
||||
|
||||
.if ${ARCH} == armv6 || ${ARCH} == armv7
|
||||
GOARM?= ${ARCH:C/armv//}
|
||||
.endif
|
||||
|
||||
# Read-only variables
|
||||
|
||||
GO_CMD= ${LOCALBASE}/bin/go
|
||||
GO_WRKDIR_BIN= ${WRKDIR}/bin
|
||||
|
||||
GO_ENV+= CGO_ENABLED=${CGO_ENABLED} \
|
||||
CGO_CFLAGS="${CGO_CFLAGS}" \
|
||||
CGO_LDFLAGS="${CGO_LDFLAGS}" \
|
||||
@@ -91,17 +104,19 @@ GO_ENV+= CGO_ENABLED=${CGO_ENABLED} \
|
||||
|
||||
.if ${go_ARGS:Mmodules}
|
||||
GO_BUILDFLAGS+= -mod=vendor
|
||||
GO_TESTFLAGS+= -mod=vendor
|
||||
GO_WRKSRC= ${WRKSRC}
|
||||
GO_ENV+= GOPATH="" \
|
||||
GOBIN="${GO_WRKDIR_BIN}"
|
||||
GOBIN="${GO_WRKDIR_BIN}" \
|
||||
GO_NO_VENDOR_CHECKS=1
|
||||
.else
|
||||
GO_WRKDIR_SRC= ${WRKDIR}/src
|
||||
GO_WRKSRC= ${GO_WRKDIR_SRC}/${GO_PKGNAME}
|
||||
GO_WRKSRC= ${WRKDIR}/src/${GO_PKGNAME}
|
||||
GO_ENV+= GOPATH="${WRKDIR}" \
|
||||
GOBIN=""
|
||||
.endif
|
||||
|
||||
GO_PORT?= lang/go
|
||||
|
||||
BUILD_DEPENDS+= ${GO_CMD}:${GO_PORT}
|
||||
.if ${go_ARGS:Mrun}
|
||||
RUN_DEPENDS+= ${GO_CMD}:${GO_PORT}
|
||||
@@ -149,17 +164,36 @@ do-install:
|
||||
done
|
||||
.endif
|
||||
|
||||
.if !target(do-test) && empty(go_ARGS:Mno_targets)
|
||||
do-test:
|
||||
(cd ${GO_WRKSRC}; \
|
||||
for t in ${GO_TESTTARGET}; do \
|
||||
${ECHO_MSG} "===> Testing $${t}"; \
|
||||
${SETENV} ${MAKE_ENV} ${GO_ENV} ${GO_CMD} test ${GO_TESTFLAGS} $${t}; \
|
||||
done)
|
||||
.endif
|
||||
|
||||
# Helper targets for port maintainers
|
||||
|
||||
.if ${go_ARGS:Mmodules}
|
||||
_MODULES2TUPLE_CMD= modules2tuple
|
||||
gomod-vendor: patch
|
||||
@if type ${_MODULES2TUPLE_CMD} > /dev/null 2>&1; then \
|
||||
cd ${WRKSRC}; ${GO_CMD} mod vendor; \
|
||||
[ -r vendor/modules.txt ] && ${_MODULES2TUPLE_CMD} vendor/modules.txt; \
|
||||
else \
|
||||
${ECHO_MSG} "===> Please install \"ports-mgmt/modules2tuple\""; \
|
||||
gomod-vendor-deps:
|
||||
@if ! type ${GO_CMD} > /dev/null 2>&1; then \
|
||||
${ECHO_MSG} "===> Please install \"${GO_PORT}\""; exit 1; \
|
||||
fi; \
|
||||
if ! type ${_MODULES2TUPLE_CMD} > /dev/null 2>&1; then \
|
||||
${ECHO_MSG} "===> Please install \"ports-mgmt/modules2tuple\""; exit 1; \
|
||||
fi
|
||||
|
||||
gomod-vendor: gomod-vendor-deps patch
|
||||
@cd ${WRKSRC}; ${SETENV} GOPATH=${WRKDIR}/.gopath GOFLAGS=-modcacherw ${GO_CMD} mod vendor; \
|
||||
[ -r vendor/modules.txt ] && ${_MODULES2TUPLE_CMD} vendor/modules.txt
|
||||
|
||||
gomod-vendor-diff: gomod-vendor-deps patch
|
||||
@cd ${WRKSRC}; ${SETENV} GOPATH=${WRKDIR}/.gopath GOFLAGS=-modcacherw ${GO_CMD} mod vendor; \
|
||||
[ -r vendor/modules.txt ] && ${_MODULES2TUPLE_CMD} vendor/modules.txt | ${SED} 's|GH_TUPLE=| |; s| \\$$||' | ${GREP} -v ' \\' > ${WRKDIR}/GH_TUPLE-new.txt && \
|
||||
echo ${GH_TUPLE} | ${TR} -s " " "\n" | ${SED} "s|^| |" > ${WRKDIR}/GH_TUPLE-old.txt && \
|
||||
${DIFF} ${WRKDIR}/GH_TUPLE-old.txt ${WRKDIR}/GH_TUPLE-new.txt || exit 0
|
||||
.endif
|
||||
|
||||
.endif # defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_GO_POST_MK)
|
||||
|
||||
Reference in New Issue
Block a user