Patrick Williams | d849ec7 | 2016-08-17 14:59:38 -0500 | [diff] [blame] | 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 | ./make.bash --host-only |
| 20 | } |
| 21 | |
| 22 | |
| 23 | make_wrapper() { |
| 24 | rm -f ${D}${bindir}/$2 |
| 25 | cat <<END >${D}${bindir}/$2 |
| 26 | #!/bin/bash |
| 27 | here=\`dirname \$0\` |
| 28 | export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}" |
| 29 | \$here/../lib/go/bin/$1 "\$@" |
| 30 | END |
| 31 | chmod +x ${D}${bindir}/$2 |
| 32 | } |
| 33 | |
| 34 | do_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 | |
| 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" |