diff options
Diffstat (limited to 'recipes-devtools/go-cross/go-native.inc')
| -rw-r--r-- | recipes-devtools/go-cross/go-native.inc | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/recipes-devtools/go-cross/go-native.inc b/recipes-devtools/go-cross/go-native.inc new file mode 100644 index 00000000..ae3dc830 --- /dev/null +++ b/recipes-devtools/go-cross/go-native.inc | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | inherit native | ||
| 2 | |||
| 3 | export GOOS = "${BUILD_GOOS}" | ||
| 4 | export GOARCH = "${BUILD_GOARCH}" | ||
| 5 | export GOROOT_FINAL = "${STAGING_LIBDIR_NATIVE}/go" | ||
| 6 | export CGO_ENABLED = "1" | ||
| 7 | |||
| 8 | do_configure[noexec] = "1" | ||
| 9 | |||
| 10 | do_compile() { | ||
| 11 | export GOBIN="${B}/bin" | ||
| 12 | rm -rf ${GOBIN} | ||
| 13 | mkdir ${GOBIN} | ||
| 14 | cd src | ||
| 15 | ./make.bash --host-only | ||
| 16 | } | ||
| 17 | |||
| 18 | |||
| 19 | make_wrapper() { | ||
| 20 | rm -f ${D}${bindir}/$2 | ||
| 21 | cat <<END >${D}${bindir}/$2 | ||
| 22 | #!/bin/bash | ||
| 23 | here=\`dirname \$0\` | ||
| 24 | export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}" | ||
| 25 | \$here/../lib/go/bin/$1 "\$@" | ||
| 26 | END | ||
| 27 | chmod +x ${D}${bindir}/$2 | ||
| 28 | } | ||
| 29 | |||
| 30 | do_install() { | ||
| 31 | install -d ${D}${libdir}/go | ||
| 32 | cp -a ${B}/pkg ${D}${libdir}/go/ | ||
| 33 | install -d ${D}${libdir}/go/src | ||
| 34 | (cd ${S}/src; for d in *; do \ | ||
| 35 | [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \ | ||
| 36 | done) | ||
| 37 | install -d ${D}${bindir} ${D}${libdir}/go/bin | ||
| 38 | for f in ${B}/bin/* | ||
| 39 | do | ||
| 40 | base=`basename $f` | ||
| 41 | install -m755 $f ${D}${libdir}/go/bin | ||
| 42 | make_wrapper $base $base | ||
| 43 | done | ||
| 44 | } | ||
| 45 | |||
| 46 | do_package[noexec] = "1" | ||
| 47 | do_packagedata[noexec] = "1" | ||
| 48 | do_package_write_ipk[noexec] = "1" | ||
| 49 | do_package_write_deb[noexec] = "1" | ||
| 50 | do_package_write_rpm[noexec] = "1" | ||
