summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/go/go.inc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/go/go.inc')
-rw-r--r--meta/recipes-devtools/go/go.inc68
1 files changed, 19 insertions, 49 deletions
diff --git a/meta/recipes-devtools/go/go.inc b/meta/recipes-devtools/go/go.inc
index 9efbd275bd..5984a60c28 100644
--- a/meta/recipes-devtools/go/go.inc
+++ b/meta/recipes-devtools/go/go.inc
@@ -1,16 +1,5 @@
1inherit goarch 1inherit goarch
2DEPENDS += "go-native" 2DEPENDS = "virtual/${TARGET_PREFIX}go go-native"
3
4# libgcc is required for the target specific libraries to build
5# properly, but apparently not for go-cross and, more importantly,
6# also can't be used there because go-cross cannot depend on
7# the tune-specific libgcc. Otherwise go-cross also would have
8# to be tune-specific.
9DEPENDS += "${@ 'libgcc' if not oe.utils.inherits(d, 'cross') else ''}"
10
11# Prevent runstrip from running because you get errors when the host arch != target arch
12INHIBIT_PACKAGE_STRIP = "1"
13INHIBIT_SYSROOT_STRIP = "1"
14 3
15export GOHOSTOS = "${BUILD_GOOS}" 4export GOHOSTOS = "${BUILD_GOOS}"
16export GOHOSTARCH = "${BUILD_GOARCH}" 5export GOHOSTARCH = "${BUILD_GOARCH}"
@@ -22,13 +11,11 @@ export GOROOT_FINAL = "${libdir}/go"
22export CGO_ENABLED = "1" 11export CGO_ENABLED = "1"
23export CC_FOR_TARGET = "${CC}" 12export CC_FOR_TARGET = "${CC}"
24export CXX_FOR_TARGET = "${CXX}" 13export CXX_FOR_TARGET = "${CXX}"
14export GO_TARGET_INSTALL = "cmd"
15export GO_FLAGS = "-a"
25 16
26do_configure[noexec] = "1" 17do_configure[noexec] = "1"
27 18
28do_compile_prepend_class-cross() {
29 export CGO_ENABLED=0
30}
31
32do_compile() { 19do_compile() {
33 export GOBIN="${B}/bin" 20 export GOBIN="${B}/bin"
34 export CC="${@d.getVar('BUILD_CC', True).strip()}" 21 export CC="${@d.getVar('BUILD_CC', True).strip()}"
@@ -39,43 +26,26 @@ do_compile() {
39 mkdir -p ${WORKDIR}/build-tmp 26 mkdir -p ${WORKDIR}/build-tmp
40 27
41 cd src 28 cd src
42 ./make.bash --host-only 29 ./make.bash
43 # Ensure cgo.a is built with the target toolchain 30 cd ${B}
44 export GOBIN="${B}/target/bin"
45 rm -rf ${GOBIN}
46 mkdir -p ${GOBIN}
47 GO_FLAGS="-a" ./make.bash
48}
49
50do_install_class-target() {
51 install -d ${D}${libdir}/go
52 cp -a ${B}/pkg ${D}${libdir}/go/
53 install -d ${D}${libdir}/go/src
54 (cd ${S}/src; for d in *; do \
55 [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \
56 done)
57 install -d ${D}${bindir}
58 if [ -d ${B}/bin/${GOOS}_${GOARCH} ]
59 then
60 install -m 0755 ${B}/bin/${GOOS}_${GOARCH}/* ${D}${bindir}
61 else
62 install -m 0755 ${B}/bin/* ${D}${bindir}
63 fi
64} 31}
65 32
66do_install_class-cross() { 33do_install() {
67 install -d ${D}${libdir}/go 34 install -d ${D}${libdir}/go/pkg/tool
68 cp -a ${B}/pkg ${D}${libdir}/go/ 35 cp --preserve=mode,timestamps -R ${B}/pkg/tool/${TARGET_GOTUPLE} ${D}${libdir}/go/pkg/tool/
69 install -d ${D}${libdir}/go/src 36 install -d ${D}${libdir}/go/src
70 (cd ${S}/src; for d in *; do \ 37 cp --preserve=mode,timestamps -R ${S}/src/cmd ${D}${libdir}/go/src/
71 [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \ 38 install -d ${D}${libdir}/go/bin
72 done)
73 install -d ${D}${bindir} 39 install -d ${D}${bindir}
74 for f in ${B}/bin/go* 40 for f in ${B}/${GO_BUILD_BINDIR}/*; do
75 do 41 name=`basename $f`
76 install -m755 $f ${D}${bindir} 42 install -m 0755 $f ${D}${libdir}/go/bin/
43 ln -sf ../${BASELIB}/go/bin/$name ${D}${bindir}/
77 done 44 done
78} 45}
79do_package_qa[noexec] = "1"
80 46
81RDEPENDS_${PN} += "perl" 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"