| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: go-package.mk,v 1.7 2015/12/29 21:47:48 bsiegert Exp $ | | 1 | # $NetBSD: go-package.mk,v 1.8 2016/01/23 12:42:57 rillig Exp $ |
2 | # | | 2 | # |
3 | # This file implements common logic for compiling Go programs in pkgsrc. | | 3 | # This file implements common logic for compiling Go programs in pkgsrc. |
4 | # The compiled Go code is tied to a specific compiler version, and the | | 4 | # The compiled Go code is tied to a specific compiler version, and the |
5 | # compilation is fast. So the plan is: | | 5 | # compilation is fast. So the plan is: |
6 | # | | 6 | # |
7 | # 1. Compile everything. | | 7 | # 1. Compile everything. |
8 | # 2. Install binaries into bin/. | | 8 | # 2. Install binaries into bin/. |
9 | # 3. Install source code and packages into a separate gopkg tree. | | 9 | # 3. Install source code and packages into a separate gopkg tree. |
10 | # | | 10 | # |
11 | # In the future, we may implement buildlink by creating a separate tree during | | 11 | # In the future, we may implement buildlink by creating a separate tree during |
12 | # the build and linking only the packages explicitly mentioned in dependencies | | 12 | # the build and linking only the packages explicitly mentioned in dependencies |
13 | # there. | | 13 | # there. |
14 | # | | 14 | # |
| @@ -46,23 +46,28 @@ BUILD_DEPENDS+= go-${GO_VERSION}*:../.. | | | @@ -46,23 +46,28 @@ BUILD_DEPENDS+= go-${GO_VERSION}*:../.. |
46 | | | 46 | |
47 | MAKE_JOBS_SAFE= no | | 47 | MAKE_JOBS_SAFE= no |
48 | INSTALLATION_DIRS+= bin gopkg | | 48 | INSTALLATION_DIRS+= bin gopkg |
49 | USE_TOOLS+= pax | | 49 | USE_TOOLS+= pax |
50 | | | 50 | |
51 | GO_PLATFORM= ${LOWER_OPSYS}_${GOARCH} | | 51 | GO_PLATFORM= ${LOWER_OPSYS}_${GOARCH} |
52 | GOTOOLDIR= ${PREFIX}/go/pkg/tool/${GO_PLATFORM} | | 52 | GOTOOLDIR= ${PREFIX}/go/pkg/tool/${GO_PLATFORM} |
53 | | | 53 | |
54 | PRINT_PLIST_AWK+= { gsub(/${GO_PLATFORM}/, \ | | 54 | PRINT_PLIST_AWK+= { gsub(/${GO_PLATFORM}/, \ |
55 | "$${GO_PLATFORM}"); \ | | 55 | "$${GO_PLATFORM}"); \ |
56 | print; next; } | | 56 | print; next; } |
57 | | | 57 | |
58 | post-extract: | | 58 | post-extract: |
59 | ${MKDIR} ${WRKSRC} | | 59 | ${RUN} ${MKDIR} ${WRKSRC} |
60 | ${RM} -fr ${WRKDIR}/`basename ${GO_DIST_BASE}`/.hg | | 60 | ${RUN} ${RM} -fr ${WRKDIR}/`basename ${GO_DIST_BASE}`/.hg |
61 | ${MV} ${WRKDIR}/`basename ${GO_DIST_BASE}`/* ${WRKSRC} | | 61 | ${RUN} ${MV} ${WRKDIR}/`basename ${GO_DIST_BASE}`/* ${WRKSRC} |
62 | | | 62 | |
63 | do-build: | | 63 | do-build: |
64 | env GOPATH=${WRKDIR}:${BUILDLINK_DIR}/gopkg go install -v ${GO_BUILD_PATTERN} | | 64 | ${RUN} env GOPATH=${WRKDIR}:${BUILDLINK_DIR}/gopkg go install -v ${GO_BUILD_PATTERN} |
| | | 65 | |
| | | 66 | .if !target(do-test) |
| | | 67 | do-test: |
| | | 68 | ${RUN} env GOPATH=${WRKDIR}:${BUILDLINK_DIR}/gopkg go test -v ${GO_BUILD_PATTERN} |
| | | 69 | .endif |
65 | | | 70 | |
66 | do-install: | | 71 | do-install: |
67 | -cd ${WRKDIR} && [ -d bin ] && ${PAX} -rw bin ${DESTDIR}${PREFIX} | | 72 | ${RUN} cd ${WRKDIR}; [ ! -d bin ] || ${PAX} -rw bin ${DESTDIR}${PREFIX} |
68 | -cd ${WRKDIR} && [ -d pkg ] && ${PAX} -rw src pkg ${DESTDIR}${PREFIX}/gopkg | | 73 | ${RUN} cd ${WRKDIR}; [ ! -d pkg ] || ${PAX} -rw src pkg ${DESTDIR}${PREFIX}/gopkg |