diff options
Diffstat (limited to 'meta/recipes-devtools/go/go.inc')
-rw-r--r-- | meta/recipes-devtools/go/go.inc | 68 |
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 @@ | |||
1 | inherit goarch | 1 | inherit goarch |
2 | DEPENDS += "go-native" | 2 | DEPENDS = "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. | ||
9 | DEPENDS += "${@ '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 | ||
12 | INHIBIT_PACKAGE_STRIP = "1" | ||
13 | INHIBIT_SYSROOT_STRIP = "1" | ||
14 | 3 | ||
15 | export GOHOSTOS = "${BUILD_GOOS}" | 4 | export GOHOSTOS = "${BUILD_GOOS}" |
16 | export GOHOSTARCH = "${BUILD_GOARCH}" | 5 | export GOHOSTARCH = "${BUILD_GOARCH}" |
@@ -22,13 +11,11 @@ export GOROOT_FINAL = "${libdir}/go" | |||
22 | export CGO_ENABLED = "1" | 11 | export CGO_ENABLED = "1" |
23 | export CC_FOR_TARGET = "${CC}" | 12 | export CC_FOR_TARGET = "${CC}" |
24 | export CXX_FOR_TARGET = "${CXX}" | 13 | export CXX_FOR_TARGET = "${CXX}" |
14 | export GO_TARGET_INSTALL = "cmd" | ||
15 | export GO_FLAGS = "-a" | ||
25 | 16 | ||
26 | do_configure[noexec] = "1" | 17 | do_configure[noexec] = "1" |
27 | 18 | ||
28 | do_compile_prepend_class-cross() { | ||
29 | export CGO_ENABLED=0 | ||
30 | } | ||
31 | |||
32 | do_compile() { | 19 | do_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 | |||
50 | do_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 | ||
66 | do_install_class-cross() { | 33 | do_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 | } |
79 | do_package_qa[noexec] = "1" | ||
80 | 46 | ||
81 | RDEPENDS_${PN} += "perl" | 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" | ||