blob: 613e9c7c0fdb6f8c2e33e9d5254109d17dde1a63 [file] [log] [blame]
Patrick Williamsd849ec72016-08-17 14:59:38 -05001inherit cross
2
3DEPENDS += "go-native"
4
5export GOHOSTOS = "${BUILD_GOOS}"
6export GOHOSTARCH = "${BUILD_GOARCH}"
7export GOOS = "${TARGET_GOOS}"
8export GOARCH = "${TARGET_GOARCH}"
9export GOARM = "${TARGET_GOARM}"
10export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go"
11export GOROOT_FINAL = "${libdir}/go"
12export CGO_ENABLED = "1"
13export CC_FOR_TARGET="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
14export CXX_FOR_TARGET="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
15CC = "${@d.getVar('BUILD_CC', True).strip()}"
16
17do_configure[noexec] = "1"
18
19do_compile() {
20 export GOBIN="${B}/bin"
21 rm -rf ${GOBIN} ${B}/pkg
22 mkdir ${GOBIN}
23
24 export TMPDIR=${WORKDIR}/build-tmp
25 mkdir -p ${WORKDIR}/build-tmp
26
27 cd src
28 ./make.bash --host-only
29}
30
31do_install() {
32 install -d ${D}${libdir}/go
33 cp -a ${B}/pkg ${D}${libdir}/go/
34 install -d ${D}${libdir}/go/src
35 (cd ${S}/src; for d in *; do \
36 [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \
37 done)
38 install -d ${D}${bindir}
39 for f in ${B}/bin/*
40 do
41 install -m755 $f ${D}${bindir}
42 done
43}
44
45do_package[noexec] = "1"
46do_packagedata[noexec] = "1"
47do_package_write_ipk[noexec] = "1"
48do_package_write_deb[noexec] = "1"
49do_package_write_rpm[noexec] = "1"