diff options
Diffstat (limited to 'meta/recipes-devtools/go/go.inc')
-rw-r--r-- | meta/recipes-devtools/go/go.inc | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go.inc b/meta/recipes-devtools/go/go.inc new file mode 100644 index 0000000000..0c315afe06 --- /dev/null +++ b/meta/recipes-devtools/go/go.inc | |||
@@ -0,0 +1,87 @@ | |||
1 | inherit goarch | ||
2 | # libgcc is required for the target specific libraries to build properly | ||
3 | DEPENDS += " go-native libgcc" | ||
4 | # Prevent runstrip from running because you get errors when the host arch != target arch | ||
5 | INHIBIT_PACKAGE_STRIP = "1" | ||
6 | INHIBIT_SYSROOT_STRIP = "1" | ||
7 | |||
8 | # Incompatible with musl, at least for now | ||
9 | COMPATIBLE_HOST_libc-musl_class-target = "null" | ||
10 | # x32 ABI is not supported on go compiler so far | ||
11 | COMPATIBLE_HOST_linux-gnux32 = "null" | ||
12 | # ppc32 is not supported in go compilers | ||
13 | COMPATIBLE_HOST_powerpc = "null" | ||
14 | |||
15 | export GOHOSTOS = "${BUILD_GOOS}" | ||
16 | export GOHOSTARCH = "${BUILD_GOARCH}" | ||
17 | export GOOS = "${TARGET_GOOS}" | ||
18 | export GOARCH = "${TARGET_GOARCH}" | ||
19 | export GOARM = "${TARGET_GOARM}" | ||
20 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" | ||
21 | export GOROOT_FINAL = "${libdir}/go" | ||
22 | export CGO_ENABLED = "1" | ||
23 | export CC_FOR_TARGET = "${CC}" | ||
24 | export CXX_FOR_TARGET = "${CXX}" | ||
25 | |||
26 | do_configure[noexec] = "1" | ||
27 | |||
28 | do_compile_prepend_class-cross() { | ||
29 | export CGO_ENABLED=0 | ||
30 | } | ||
31 | |||
32 | do_compile() { | ||
33 | export GOBIN="${B}/bin" | ||
34 | export CC="${@d.getVar('BUILD_CC', True).strip()}" | ||
35 | rm -rf ${GOBIN} ${B}/pkg | ||
36 | mkdir ${GOBIN} | ||
37 | |||
38 | export TMPDIR=${WORKDIR}/build-tmp | ||
39 | mkdir -p ${WORKDIR}/build-tmp | ||
40 | |||
41 | cd src | ||
42 | ./make.bash --host-only | ||
43 | # Ensure cgo.a is built with the target toolchain | ||
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 | } | ||
65 | |||
66 | do_install_class-cross() { | ||
67 | install -d ${D}${libdir}/go | ||
68 | cp -a ${B}/pkg ${D}${libdir}/go/ | ||
69 | install -d ${D}${libdir}/go/src | ||
70 | (cd ${S}/src; for d in *; do \ | ||
71 | [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \ | ||
72 | done) | ||
73 | install -d ${D}${bindir} | ||
74 | for f in ${B}/bin/go* | ||
75 | do | ||
76 | install -m755 $f ${D}${bindir} | ||
77 | done | ||
78 | } | ||
79 | |||
80 | INSANE_SKIP_${PN} += "staticdev" | ||
81 | RDEPENDS_${PN} += "perl" | ||
82 | |||
83 | do_package[noexec] = "1" | ||
84 | do_packagedata[noexec] = "1" | ||
85 | do_package_write_ipk[noexec] = "1" | ||
86 | do_package_write_deb[noexec] = "1" | ||
87 | do_package_write_rpm[noexec] = "1" | ||