Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 1 | inherit native |
| 2 | |
| 3 | BOOTSTRAP ?= "" |
| 4 | export GOOS = "${BUILD_GOOS}" |
| 5 | export GOARCH = "${BUILD_GOARCH}" |
| 6 | export GOROOT_FINAL = "${STAGING_LIBDIR_NATIVE}/go${BOOTSTRAP}" |
| 7 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go1.4" |
| 8 | export CGO_ENABLED = "1" |
| 9 | |
| 10 | do_configure[noexec] = "1" |
| 11 | |
| 12 | do_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 | |
| 24 | make_wrapper() { |
| 25 | rm -f ${D}${bindir}/$2$3 |
| 26 | cat <<END >${D}${bindir}/$2$3 |
| 27 | #!/bin/bash |
| 28 | here=\`dirname \$0\` |
| 29 | export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go$3\`}" |
| 30 | \$here/../lib/go$3/bin/$1 "\$@" |
| 31 | END |
| 32 | chmod +x ${D}${bindir}/$2$3 |
| 33 | } |
| 34 | |
| 35 | do_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 | |
| 52 | do_package[noexec] = "1" |
| 53 | do_packagedata[noexec] = "1" |
| 54 | do_package_write_ipk[noexec] = "1" |
| 55 | do_package_write_deb[noexec] = "1" |
| 56 | do_package_write_rpm[noexec] = "1" |