blob: 8b4be9ec74876af9e1f1fb7a46af44e6240521da [file] [log] [blame]
Patrick Williamsd849ec72016-08-17 14:59:38 -05001inherit native
2
3export GOOS = "${BUILD_GOOS}"
4export GOARCH = "${BUILD_GOARCH}"
5export GOROOT_FINAL = "${STAGING_LIBDIR_NATIVE}/go"
6export CGO_ENABLED = "1"
7
8do_configure[noexec] = "1"
9
10do_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 ./make.bash --host-only
20}
21
22
23make_wrapper() {
24 rm -f ${D}${bindir}/$2
25 cat <<END >${D}${bindir}/$2
26#!/bin/bash
27here=\`dirname \$0\`
28export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}"
29\$here/../lib/go/bin/$1 "\$@"
30END
31 chmod +x ${D}${bindir}/$2
32}
33
34do_install() {
35 install -d ${D}${libdir}/go
36 cp -a ${B}/pkg ${D}${libdir}/go/
37 install -d ${D}${libdir}/go/src
38 (cd ${S}/src; for d in *; do \
39 [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \
40 done)
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
50do_package[noexec] = "1"
51do_packagedata[noexec] = "1"
52do_package_write_ipk[noexec] = "1"
53do_package_write_deb[noexec] = "1"
54do_package_write_rpm[noexec] = "1"