blob: c21f8fda78382d38bcf0ab018c2d16dbfeeb069a [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001inherit native
2
3BOOTSTRAP ?= ""
4export GOOS = "${BUILD_GOOS}"
5export GOARCH = "${BUILD_GOARCH}"
6export GOROOT_FINAL = "${STAGING_LIBDIR_NATIVE}/go${BOOTSTRAP}"
7export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go1.4"
8export CGO_ENABLED = "1"
9
10do_configure[noexec] = "1"
11
12do_compile() {
13 export GOBIN="${B}/bin"
14 rm -rf ${GOBIN}
15 mkdir ${GOBIN}
16
17 export TMPDIR=${WORKDIR}/build-tmp
18 mkdir -p ${WORKDIR}/build-tmp
19
20 cd src
21 CGO_ENABLED=0 ./make.bash --host-only
22}
23
24make_wrapper() {
25 rm -f ${D}${bindir}/$2$3
26 cat <<END >${D}${bindir}/$2$3
27#!/bin/bash
28here=\`dirname \$0\`
29export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go$3\`}"
30\$here/../lib/go$3/bin/$1 "\$@"
31END
32 chmod +x ${D}${bindir}/$2$3
33}
34
35do_install() {
36 install -d ${D}${libdir}/go${BOOTSTRAP}
37 cp -a ${B}/pkg ${D}${libdir}/go${BOOTSTRAP}/
38 install -d ${D}${libdir}/go${BOOTSTRAP}/src
39 (cd ${S}/src; for d in *; do \
40 [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go${BOOTSTRAP}/src/; \
41 done)
42
43 install -d ${D}${bindir} ${D}${libdir}/go${BOOTSTRAP}/bin
44 for f in ${B}/bin/*
45 do
46 base=`basename $f`
47 install -m755 $f ${D}${libdir}/go${BOOTSTRAP}/bin
48 make_wrapper $base $base ${BOOTSTRAP}
49 done
50}
51
52do_package[noexec] = "1"
53do_packagedata[noexec] = "1"
54do_package_write_ipk[noexec] = "1"
55do_package_write_deb[noexec] = "1"
56do_package_write_rpm[noexec] = "1"