diff options
Diffstat (limited to 'meta/recipes-devtools/go/go-target.inc')
-rw-r--r-- | meta/recipes-devtools/go/go-target.inc | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-target.inc b/meta/recipes-devtools/go/go-target.inc new file mode 100644 index 0000000000..5984a60c28 --- /dev/null +++ b/meta/recipes-devtools/go/go-target.inc | |||
@@ -0,0 +1,51 @@ | |||
1 | inherit goarch | ||
2 | DEPENDS = "virtual/${TARGET_PREFIX}go go-native" | ||
3 | |||
4 | export GOHOSTOS = "${BUILD_GOOS}" | ||
5 | export GOHOSTARCH = "${BUILD_GOARCH}" | ||
6 | export GOOS = "${TARGET_GOOS}" | ||
7 | export GOARCH = "${TARGET_GOARCH}" | ||
8 | export GOARM = "${TARGET_GOARM}" | ||
9 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" | ||
10 | export GOROOT_FINAL = "${libdir}/go" | ||
11 | export CGO_ENABLED = "1" | ||
12 | export CC_FOR_TARGET = "${CC}" | ||
13 | export CXX_FOR_TARGET = "${CXX}" | ||
14 | export GO_TARGET_INSTALL = "cmd" | ||
15 | export GO_FLAGS = "-a" | ||
16 | |||
17 | do_configure[noexec] = "1" | ||
18 | |||
19 | do_compile() { | ||
20 | export GOBIN="${B}/bin" | ||
21 | export CC="${@d.getVar('BUILD_CC', True).strip()}" | ||
22 | rm -rf ${GOBIN} ${B}/pkg | ||
23 | mkdir ${GOBIN} | ||
24 | |||
25 | export TMPDIR=${WORKDIR}/build-tmp | ||
26 | mkdir -p ${WORKDIR}/build-tmp | ||
27 | |||
28 | cd src | ||
29 | ./make.bash | ||
30 | cd ${B} | ||
31 | } | ||
32 | |||
33 | do_install() { | ||
34 | install -d ${D}${libdir}/go/pkg/tool | ||
35 | cp --preserve=mode,timestamps -R ${B}/pkg/tool/${TARGET_GOTUPLE} ${D}${libdir}/go/pkg/tool/ | ||
36 | install -d ${D}${libdir}/go/src | ||
37 | cp --preserve=mode,timestamps -R ${S}/src/cmd ${D}${libdir}/go/src/ | ||
38 | install -d ${D}${libdir}/go/bin | ||
39 | install -d ${D}${bindir} | ||
40 | for f in ${B}/${GO_BUILD_BINDIR}/*; do | ||
41 | name=`basename $f` | ||
42 | install -m 0755 $f ${D}${libdir}/go/bin/ | ||
43 | ln -sf ../${BASELIB}/go/bin/$name ${D}${bindir}/ | ||
44 | done | ||
45 | } | ||
46 | |||
47 | PACKAGES = "${PN} ${PN}-dev" | ||
48 | FILES_${PN} = "${libdir}/go/bin ${libdir}/go/pkg/tool/${TARGET_GOTUPLE} ${bindir}" | ||
49 | FILES_${PN}-dev = "${libdir}/go" | ||
50 | RDEPENDS_${PN}-dev = "perl bash" | ||
51 | INSANE_SKIP_${PN} = "ldflags" | ||