Changeset View
Changeset View
Standalone View
Standalone View
head/Mk/Uses/go.mk
Show All 38 Lines | |||||
# Additional CFLAGS variables to be passed to the C compiler by the `go` | # Additional CFLAGS variables to be passed to the C compiler by the `go` | ||||
# command | # command | ||||
# | # | ||||
# CGO_LDFLAGS | # CGO_LDFLAGS | ||||
# Additional LDFLAGS variables to be passed to the C compiler by the `go` | # Additional LDFLAGS variables to be passed to the C compiler by the `go` | ||||
# command | # command | ||||
# | # | ||||
# GO_BUILDFLAGS | # 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_PORT | # GO_PORT | ||||
# The Go port to use. By default this is lang/go but can be set | # The Go port to use. By default this is lang/go but can be set | ||||
# to lang/go-devel in make.conf for testing with future Go versions. | # to lang/go-devel in make.conf for testing with future Go versions. | ||||
# | # | ||||
# This variable must not be set by individual ports! | # This variable must not be set by individual ports! | ||||
# | # | ||||
# MAINTAINER: dmgk@FreeBSD.org | # MAINTAINER: dmgk@FreeBSD.org | ||||
.if !defined(_INCLUDE_USES_GO_MK) | .if !defined(_INCLUDE_USES_GO_MK) | ||||
_INCLUDE_USES_GO_MK= yes | _INCLUDE_USES_GO_MK= yes | ||||
.if !empty(go_ARGS:Nmodules:Nno_targets:Nrun) | .if !empty(go_ARGS:Nmodules:Nno_targets:Nrun) | ||||
IGNORE= USES=go has invalid arguments: ${go_ARGS:Nmodules:Nno_targets:Nrun} | IGNORE= USES=go has invalid arguments: ${go_ARGS:Nmodules:Nno_targets:Nrun} | ||||
.endif | .endif | ||||
# Settable variables | # Settable variables | ||||
.if empty(GO_PKGNAME) | .if empty(GO_PKGNAME) | ||||
. if !empty(GH_SUBDIR) | . if !empty(GH_SUBDIR) | ||||
GO_PKGNAME= ${GH_SUBDIR:S|^src/||} | GO_PKGNAME= ${GH_SUBDIR:S|^src/||} | ||||
. elif !empty(GL_SUBDIR) | . elif !empty(GL_SUBDIR) | ||||
GO_PKGNAME= ${GL_SUBDIR:S|^src/||} | GO_PKGNAME= ${GL_SUBDIR:S|^src/||} | ||||
. else | . else | ||||
GO_PKGNAME= ${PORTNAME} | GO_PKGNAME= ${PORTNAME} | ||||
. endif | . endif | ||||
.endif | .endif | ||||
GO_TARGET?= ${GO_PKGNAME} | GO_TARGET?= ${GO_PKGNAME} | ||||
GO_BUILDFLAGS+= -v -buildmode=exe | GO_BUILDFLAGS+= -v -buildmode=exe | ||||
.if !defined(WITH_DEBUG) && empty(GO_BUILDFLAGS:M-ldflags*) | |||||
GO_BUILDFLAGS+= -ldflags=-s | |||||
.endif | |||||
CGO_ENABLED?= 1 | CGO_ENABLED?= 1 | ||||
CGO_CFLAGS+= -I${LOCALBASE}/include | CGO_CFLAGS+= -I${LOCALBASE}/include | ||||
CGO_LDFLAGS+= -L${LOCALBASE}/lib | CGO_LDFLAGS+= -L${LOCALBASE}/lib | ||||
.if ${ARCH} == armv6 || ${ARCH} == armv7 | .if ${ARCH} == armv6 || ${ARCH} == armv7 | ||||
GOARM?= ${ARCH:C/armv//} | GOARM?= ${ARCH:C/armv//} | ||||
.endif | .endif | ||||
# Read-only variables | # Read-only variables | ||||
GO_CMD= ${LOCALBASE}/bin/go | GO_CMD= ${LOCALBASE}/bin/go | ||||
GO_WRKDIR_BIN= ${WRKDIR}/bin | GO_WRKDIR_BIN= ${WRKDIR}/bin | ||||
GO_ENV+= CGO_ENABLED=${CGO_ENABLED} \ | GO_ENV+= CGO_ENABLED=${CGO_ENABLED} \ | ||||
CGO_CFLAGS="${CGO_CFLAGS}" \ | CGO_CFLAGS="${CGO_CFLAGS}" \ | ||||
CGO_LDFLAGS="${CGO_LDFLAGS}" \ | CGO_LDFLAGS="${CGO_LDFLAGS}" \ | ||||
GOARM=${GOARM} | GOARM=${GOARM} | ||||
.if ${go_ARGS:Mmodules} | .if ${go_ARGS:Mmodules} | ||||
GO_BUILDFLAGS+= -mod=vendor | GO_BUILDFLAGS+= -mod=vendor | ||||
GO_WRKSRC= ${WRKSRC} | GO_WRKSRC= ${WRKSRC} | ||||
▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines |