diff options
| author | Khem Raj <raj.khem@gmail.com> | 2017-03-07 22:40:22 -0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-10 15:51:55 +0000 |
| commit | 760e81678cec80dcdaab12c2a0a0148e3e0ba275 (patch) | |
| tree | 6b587a2e9bd13c68788c1ff20df54db7e2f38c53 /meta/recipes-devtools/go/go-native.inc | |
| parent | 0efe58df2e5389f86dfbd53f90afc8f2970def7d (diff) | |
| download | poky-760e81678cec80dcdaab12c2a0a0148e3e0ba275.tar.gz | |
go: Add recipes for golang compilers and tools
* This is converging the recipes for go from
meta-virtualization and oe-meta-go
* Add recipes for go 1.7
* go.bbclass is added to ease out writing
recipes for go packages
* go-examples: Add an example, helloworld written in go
This should serve as temlate for writing go recipes
* Disable for musl, at least for now
* Disable for x32/ppc32 which is not supported
(From OE-Core rev: 78615e9260fb5d6569de4883521b049717fa4340)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/go/go-native.inc')
| -rw-r--r-- | meta/recipes-devtools/go/go-native.inc | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-native.inc b/meta/recipes-devtools/go/go-native.inc new file mode 100644 index 0000000000..89bc63459d --- /dev/null +++ b/meta/recipes-devtools/go/go-native.inc | |||
| @@ -0,0 +1,54 @@ | |||
| 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 | |||
| 15 | export TMPDIR=${WORKDIR}/build-tmp | ||
| 16 | mkdir -p ${WORKDIR}/build-tmp | ||
| 17 | |||
| 18 | cd src | ||
| 19 | CGO_ENABLED=0 ./make.bash --host-only | ||
| 20 | } | ||
| 21 | |||
| 22 | make_wrapper() { | ||
| 23 | rm -f ${D}${bindir}/$2 | ||
| 24 | cat <<END >${D}${bindir}/$2 | ||
| 25 | #!/bin/bash | ||
| 26 | here=\`dirname \$0\` | ||
| 27 | export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}" | ||
| 28 | \$here/../lib/go/bin/$1 "\$@" | ||
| 29 | END | ||
| 30 | chmod +x ${D}${bindir}/$2 | ||
| 31 | } | ||
| 32 | |||
| 33 | do_install() { | ||
| 34 | install -d ${D}${libdir}/go | ||
| 35 | cp -a ${B}/pkg ${D}${libdir}/go/ | ||
| 36 | install -d ${D}${libdir}/go/src | ||
| 37 | (cd ${S}/src; for d in *; do \ | ||
| 38 | [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \ | ||
| 39 | done) | ||
| 40 | |||
| 41 | install -d ${D}${bindir} ${D}${libdir}/go/bin | ||
| 42 | for f in ${B}/bin/* | ||
| 43 | do | ||
| 44 | base=`basename $f` | ||
| 45 | install -m755 $f ${D}${libdir}/go/bin | ||
| 46 | make_wrapper $base $base | ||
| 47 | done | ||
| 48 | } | ||
| 49 | |||
| 50 | do_package[noexec] = "1" | ||
| 51 | do_packagedata[noexec] = "1" | ||
| 52 | do_package_write_ipk[noexec] = "1" | ||
| 53 | do_package_write_deb[noexec] = "1" | ||
| 54 | do_package_write_rpm[noexec] = "1" | ||
