summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/go/go-cross.inc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/go/go-cross.inc')
-rw-r--r--meta/recipes-devtools/go/go-cross.inc61
1 files changed, 53 insertions, 8 deletions
diff --git a/meta/recipes-devtools/go/go-cross.inc b/meta/recipes-devtools/go/go-cross.inc
index 1c2d9e3a3d..df3e4ea914 100644
--- a/meta/recipes-devtools/go/go-cross.inc
+++ b/meta/recipes-devtools/go/go-cross.inc
@@ -1,15 +1,60 @@
1inherit cross 1inherit cross
2 2
3DEPENDS += "gcc-cross-${TARGET_ARCH}" 3PROVIDES = "virtual/${TARGET_PREFIX}go"
4DEPENDS += "go-native"
4 5
5PN = "go-cross-${TARGET_ARCH}" 6PN = "go-cross-${TARGET_ARCH}"
6 7
7# Ignore how TARGET_ARCH is computed. 8export GOHOSTOS = "${BUILD_GOOS}"
8TARGET_ARCH[vardepvalue] = "${TARGET_ARCH}" 9export GOHOSTARCH = "${BUILD_GOARCH}"
9# Ignore target os libc for cross compiler 10export GOOS = "${TARGET_GOOS}"
10#TARGET_OS[vardepexclude] = "LIBCEXTENSION" 11export GOARCH = "${TARGET_GOARCH}"
11FILESEXTRAPATHS =. "${FILE_DIRNAME}/go-cross:" 12export GOARM = "${TARGET_GOARM}"
13export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go"
14export GOROOT_FINAL = "${libdir}/go"
15export CGO_ENABLED = "1"
16export CC_FOR_TARGET="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
17export CXX_FOR_TARGET="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
18CC = "${@d.getVar('BUILD_CC', True).strip()}"
12 19
13GOROOT_FINAL = "${libdir}/go" 20do_configure[noexec] = "1"
14export GOROOT_FINAL
15 21
22do_compile() {
23 export GOBIN="${B}/bin"
24 rm -rf ${GOBIN} ${B}/pkg
25 mkdir ${GOBIN}
26 cd src
27 ./make.bash --host-only
28 cd ${B}
29}
30
31
32make_wrapper() {
33 rm -f ${D}${bindir}/$2
34 cat <<END >${D}${bindir}/$2
35#!/bin/bash
36here=\`dirname \$0\`
37export GOARCH="${TARGET_GOARCH}"
38export GOOS="${TARGET_GOOS}"
39export GOARM="${TARGET_GOARM}"
40\$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@"
41END
42 chmod +x ${D}${bindir}/$2
43}
44
45do_install() {
46 install -d ${D}${libdir}/go
47 cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
48 install -d ${D}${libdir}/go/src
49 (cd ${S}/src; for d in *; do \
50 [ ! -d $d ] || cp --preserve=mode,timestamps -R ${S}/src/$d ${D}${libdir}/go/src/; \
51 done)
52
53 install -d ${D}${bindir} ${D}${libdir}/go/bin
54 for f in ${B}/bin/*
55 do
56 base=`basename $f`
57 install -m755 $f ${D}${libdir}/go/bin
58 make_wrapper $base ${TARGET_PREFIX}$base
59 done
60}