diff options
Diffstat (limited to 'meta/classes/go.bbclass')
-rw-r--r-- | meta/classes/go.bbclass | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass index 82b5f83aa0..cfe773e13d 100644 --- a/meta/classes/go.bbclass +++ b/meta/classes/go.bbclass | |||
@@ -53,40 +53,30 @@ FILES_${PN}-staticdev += "${GOPKG_FINAL}/${GO_IMPORT}*" | |||
53 | 53 | ||
54 | GO_INSTALL ?= "${GO_IMPORT}/..." | 54 | GO_INSTALL ?= "${GO_IMPORT}/..." |
55 | 55 | ||
56 | B = "${WORKDIR}/build" | ||
57 | |||
58 | go_do_configure() { | ||
59 | ln -snf ${S}/src ${B}/ | ||
60 | } | ||
61 | |||
56 | go_do_compile() { | 62 | go_do_compile() { |
57 | GOPATH=${S}:${STAGING_LIBDIR}/${TARGET_SYS}/go go env | 63 | GOPATH=${B}:${STAGING_LIBDIR}/${TARGET_SYS}/go go env |
58 | if [ -n "${GO_INSTALL}" ]; then | 64 | if [ -n "${GO_INSTALL}" ]; then |
59 | GOPATH=${S}:${STAGING_LIBDIR}/${TARGET_SYS}/go go install ${GOBUILDFLAGS} ${GO_INSTALL} | 65 | GOPATH=${B}:${STAGING_LIBDIR}/${TARGET_SYS}/go go install ${GOBUILDFLAGS} ${GO_INSTALL} |
60 | fi | 66 | fi |
61 | } | 67 | } |
68 | do_compile[cleandirs] = "${B}/bin ${B}/pkg" | ||
62 | 69 | ||
63 | go_do_install() { | 70 | go_do_install() { |
64 | rm -rf ${WORKDIR}/staging | 71 | install -d ${D}${GOROOT_FINAL}/src/${GO_IMPORT} |
65 | install -d ${WORKDIR}/staging${GOROOT_FINAL} ${D}${GOROOT_FINAL} | 72 | tar -C ${S}/src/${GO_IMPORT} -cf - --exclude-vcs . | \ |
66 | tar -C ${S} -cf - . | tar -C ${WORKDIR}/staging${GOROOT_FINAL} -xpvf - | 73 | tar -C ${D}${GOROOT_FINAL}/src/${GO_IMPORT} --no-same-owner -xf - |
67 | 74 | tar -C ${B} -cf - pkg | tar -C ${D}${GOROOT_FINAL} --no-same-owner -xf - | |
68 | find ${WORKDIR}/staging${GOROOT_FINAL} \( \ | 75 | |
69 | -name \*.indirectionsymlink -o \ | 76 | if [ -n "`ls ${B}/${GO_BUILD_BINDIR}/`" ]; then |
70 | -name .git\* -o \ | 77 | install -d ${D}${bindir} |
71 | -name .hg -o \ | 78 | install -m 0755 ${B}/${GO_BUILD_BINDIR}/* ${D}${bindir}/ |
72 | -name .svn -o \ | ||
73 | -name .pc\* -o \ | ||
74 | -name patches\* \ | ||
75 | \) -print0 | \ | ||
76 | xargs -r0 rm -rf | ||
77 | |||
78 | tar -C ${WORKDIR}/staging${GOROOT_FINAL} -cf - . | \ | ||
79 | tar -C ${D}${GOROOT_FINAL} -xpvf - | ||
80 | |||
81 | chown -R root:root "${D}${GOROOT_FINAL}" | ||
82 | |||
83 | if [ -e "${D}${GOBIN_FINAL}" ]; then | ||
84 | install -d -m 0755 "${D}${bindir}" | ||
85 | find "${D}${GOBIN_FINAL}" ! -type d -print0 | xargs -r0 mv --target-directory="${D}${bindir}" | ||
86 | rmdir -p "${D}${GOBIN_FINAL}" || true | ||
87 | fi | 79 | fi |
88 | } | 80 | } |
89 | do_install[dirs] =+ "${WORKDIR}/staging" | ||
90 | do_install[cleandirs] += "${WORKDIR}/staging" | ||
91 | 81 | ||
92 | EXPORT_FUNCTIONS do_compile do_install | 82 | EXPORT_FUNCTIONS do_configure do_compile do_install |