blob: 317498784ae4e48a73a28c9b180811736337f5cd [file] [log] [blame]
Patrick Williamsd849ec72016-08-17 14:59:38 -05001inherit cross
2
Patrick Williamse69d2352017-02-23 20:56:04 -06003# libgcc is required for the target specific libraries to build properly
4DEPENDS += "go-native libgcc"
5
6# Prevent runstrip from running because you get errors when the host arch != target arch
7#INHIBIT_PACKAGE_STRIP = "1"
8STRIP = "echo"
Patrick Williamsd849ec72016-08-17 14:59:38 -05009
10export GOHOSTOS = "${BUILD_GOOS}"
11export GOHOSTARCH = "${BUILD_GOARCH}"
12export GOOS = "${TARGET_GOOS}"
13export GOARCH = "${TARGET_GOARCH}"
14export GOARM = "${TARGET_GOARM}"
15export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go"
16export GOROOT_FINAL = "${libdir}/go"
17export CGO_ENABLED = "1"
18export CC_FOR_TARGET="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
19export CXX_FOR_TARGET="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
20CC = "${@d.getVar('BUILD_CC', True).strip()}"
21
22do_configure[noexec] = "1"
23
24do_compile() {
25 export GOBIN="${B}/bin"
26 rm -rf ${GOBIN} ${B}/pkg
27 mkdir ${GOBIN}
28
29 export TMPDIR=${WORKDIR}/build-tmp
30 mkdir -p ${WORKDIR}/build-tmp
31
32 cd src
33 ./make.bash --host-only
Patrick Williamse69d2352017-02-23 20:56:04 -060034 # Ensure cgo.a is built with the target toolchain
35 export GOBIN="${B}/target/bin"
36 rm -rf ${GOBIN}
37 mkdir -p ${GOBIN}
38 GO_FLAGS="-a" ./make.bash
Patrick Williamsd849ec72016-08-17 14:59:38 -050039}
40
41do_install() {
42 install -d ${D}${libdir}/go
43 cp -a ${B}/pkg ${D}${libdir}/go/
44 install -d ${D}${libdir}/go/src
45 (cd ${S}/src; for d in *; do \
46 [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \
47 done)
48 install -d ${D}${bindir}
49 for f in ${B}/bin/*
50 do
51 install -m755 $f ${D}${bindir}
52 done
53}
54
55do_package[noexec] = "1"
56do_packagedata[noexec] = "1"
57do_package_write_ipk[noexec] = "1"
58do_package_write_deb[noexec] = "1"
59do_package_write_rpm[noexec] = "1"