summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/go/go-target.inc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/go/go-target.inc')
-rw-r--r--meta/recipes-devtools/go/go-target.inc51
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 @@
1inherit goarch
2DEPENDS = "virtual/${TARGET_PREFIX}go go-native"
3
4export GOHOSTOS = "${BUILD_GOOS}"
5export GOHOSTARCH = "${BUILD_GOARCH}"
6export GOOS = "${TARGET_GOOS}"
7export GOARCH = "${TARGET_GOARCH}"
8export GOARM = "${TARGET_GOARM}"
9export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go"
10export GOROOT_FINAL = "${libdir}/go"
11export CGO_ENABLED = "1"
12export CC_FOR_TARGET = "${CC}"
13export CXX_FOR_TARGET = "${CXX}"
14export GO_TARGET_INSTALL = "cmd"
15export GO_FLAGS = "-a"
16
17do_configure[noexec] = "1"
18
19do_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
33do_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
47PACKAGES = "${PN} ${PN}-dev"
48FILES_${PN} = "${libdir}/go/bin ${libdir}/go/pkg/tool/${TARGET_GOTUPLE} ${bindir}"
49FILES_${PN}-dev = "${libdir}/go"
50RDEPENDS_${PN}-dev = "perl bash"
51INSANE_SKIP_${PN} = "ldflags"