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.inc87
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 @@
1inherit goarch
2# libgcc is required for the target specific libraries to build properly
3DEPENDS += " go-native libgcc"
4# Prevent runstrip from running because you get errors when the host arch != target arch
5INHIBIT_PACKAGE_STRIP = "1"
6INHIBIT_SYSROOT_STRIP = "1"
7
8# Incompatible with musl, at least for now
9COMPATIBLE_HOST_libc-musl_class-target = "null"
10# x32 ABI is not supported on go compiler so far
11COMPATIBLE_HOST_linux-gnux32 = "null"
12# ppc32 is not supported in go compilers
13COMPATIBLE_HOST_powerpc = "null"
14
15export GOHOSTOS = "${BUILD_GOOS}"
16export GOHOSTARCH = "${BUILD_GOARCH}"
17export GOOS = "${TARGET_GOOS}"
18export GOARCH = "${TARGET_GOARCH}"
19export GOARM = "${TARGET_GOARM}"
20export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go"
21export GOROOT_FINAL = "${libdir}/go"
22export CGO_ENABLED = "1"
23export CC_FOR_TARGET = "${CC}"
24export CXX_FOR_TARGET = "${CXX}"
25
26do_configure[noexec] = "1"
27
28do_compile_prepend_class-cross() {
29 export CGO_ENABLED=0
30}
31
32do_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
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}
65
66do_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
80INSANE_SKIP_${PN} += "staticdev"
81RDEPENDS_${PN} += "perl"
82
83do_package[noexec] = "1"
84do_packagedata[noexec] = "1"
85do_package_write_ipk[noexec] = "1"
86do_package_write_deb[noexec] = "1"
87do_package_write_rpm[noexec] = "1"