View | Details | Raw Unified | Return to bug 240535 | Differences between
and this patch

Collapse All | Expand All

(-)Mk/Uses/go.mk (-12 / +35 lines)
Lines 20-42 Link Here
20
# You can set the following variables to control the process.
20
# You can set the following variables to control the process.
21
#
21
#
22
# GO_PKGNAME
22
# GO_PKGNAME
23
#	The name of the package. When building in GOPATH mode, this is
23
#	The name of the package when building in GOPATH mode. This is
24
#	the directory that will be created in GOPATH/src and seen by the
24
#	the directory that will be created in GOPATH/src and seen by the
25
#	`go` command. When building in modules-aware mode, no directories
25
#	`go` command. If not set explicitly and GH_SUBDIR or GL_SUBDIR
26
#	will be created and GO_PKGNAME value will be only used as a default
26
#	is present, GO_PKGNAME will be inferred from it.
27
#	for GO_TARGET. If not set explicitly and GH_SUBDIR is present,
27
#	Not needed when building in modules-aware mode.
28
#	GO_PKGNAME will be inferred from GH_SUBDIR.
29
#
28
#
30
# GO_TARGET
29
# GO_TARGET
31
#	The names of the package(s) to build. If not set explicitly,
30
#	The names of the package(s) to build. If not set explicitly,
32
#	defaults to GO_PKGNAME.
31
#	defaults to GO_PKGNAME. GO_TARGET can also be a tuple in the form
32
#	package:path where path can be either a simple filename or a full
33
#	path starting with ${PREFIX}. Specifying a full path like
34
#	${PREFIX}/sbin/binary will install the resulting binary as
35
#	${PREFIX}/sbin/binary. Using just simple filename is a shortcut
36
#	to installing it as ${PREFIX}/bin/filename.
33
#
37
#
34
# CGO_CFLAGS
38
# CGO_CFLAGS
35
#	Addional CFLAGS variables to be passed to the C compiler by the `go`
39
#	Additional CFLAGS variables to be passed to the C compiler by the `go`
36
#	command
40
#	command
37
#
41
#
38
# CGO_LDFLAGS
42
# CGO_LDFLAGS
39
#	Addional LDFLAGS variables to be passed to the C compiler by the `go`
43
#	Additional LDFLAGS variables to be passed to the C compiler by the `go`
40
#	command
44
#	command
41
#
45
#
42
# GO_BUILDFLAGS
46
# GO_BUILDFLAGS
Lines 61-66 Link Here
61
.if empty(GO_PKGNAME)
65
.if empty(GO_PKGNAME)
62
.  if !empty(GH_SUBDIR)
66
.  if !empty(GH_SUBDIR)
63
GO_PKGNAME=	${GH_SUBDIR:S|^src/||}
67
GO_PKGNAME=	${GH_SUBDIR:S|^src/||}
68
.  elif !empty(GL_SUBDIR)
69
GO_PKGNAME=	${GL_SUBDIR:S|^src/||}
64
.  else
70
.  else
65
GO_PKGNAME=	${PORTNAME}
71
GO_PKGNAME=	${PORTNAME}
66
.  endif
72
.  endif
Lines 116-129 Link Here
116
.if !target(do-build) && empty(go_ARGS:Mno_targets)
122
.if !target(do-build) && empty(go_ARGS:Mno_targets)
117
do-build:
123
do-build:
118
	(cd ${GO_WRKSRC}; \
124
	(cd ${GO_WRKSRC}; \
119
		${SETENV} ${MAKE_ENV} ${GO_ENV} ${GO_CMD} install ${GO_BUILDFLAGS} ${GO_TARGET:S/^${PORTNAME}$/./})
125
	for t in ${GO_TARGET}; do \
126
		out=$$(${BASENAME} $$(${ECHO_CMD} $${t} | \
127
			${SED} -Ee 's/^[^:]*:([^:]+).*$$/\1/' -e 's/^\.$$/${PORTNAME}/')); \
128
		pkg=$$(${ECHO_CMD} $${t} | \
129
			${SED} -Ee 's/^([^:]*).*$$/\1/' -e 's/^${PORTNAME}$$/./'); \
130
		${ECHO_MSG} "===>  Building $${out} from $${pkg}"; \
131
		${SETENV} ${MAKE_ENV} ${GO_ENV} ${GO_CMD} build ${GO_BUILDFLAGS} \
132
			-o ${GO_WRKDIR_BIN}/$${out} \
133
			$${pkg}; \
134
	done)
120
.endif
135
.endif
121
136
122
.if !target(do-install) && empty(go_ARGS:Mno_targets)
137
.if !target(do-install) && empty(go_ARGS:Mno_targets)
123
do-install:
138
do-install:
124
.for _TARGET in ${GO_TARGET}
139
	for t in ${GO_TARGET}; do \
125
	${INSTALL_PROGRAM} ${GO_WRKDIR_BIN}/${_TARGET:T:S/^.$/${PORTNAME}/} ${STAGEDIR}${PREFIX}/bin
140
		dst=$$(${ECHO_CMD} $${t} | \
126
.endfor
141
			${SED} -Ee 's/^[^:]*:([^:]+).*$$/\1/' -e 's/^\.$$/${PORTNAME}/'); \
142
		src=$$(${BASENAME} $${dst}); \
143
		case $${dst} in \
144
			/*) dst=${STAGEDIR}$${dst}; ${MKDIR} $$(${DIRNAME} $${dst}) ;; \
145
			 *) dst=${STAGEDIR}${PREFIX}/bin/$${src} ;; \
146
		esac; \
147
		${ECHO_MSG} "===>  Installing $${src} as $${dst}"; \
148
		${INSTALL_PROGRAM} ${GO_WRKDIR_BIN}/$${src} $${dst}; \
149
	done
127
.endif
150
.endif
128
151
129
# Helper targets for port maintainers
152
# Helper targets for port maintainers

Return to bug 240535