Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 1 | # Use immediate assingment here to get the original (/usr/lib) |
| 2 | # instead of the one rewritten by native.bbclass. |
| 3 | nonstaging_libdir := "${libdir}" |
| 4 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 5 | inherit native |
| 6 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 7 | SRC_URI_append = " http://golang.org/dl/go1.4.3.src.tar.gz;name=bootstrap;subdir=go1.4" |
| 8 | SRC_URI[bootstrap.md5sum] = "dfb604511115dd402a77a553a5923a04" |
| 9 | SRC_URI[bootstrap.sha256sum] = "9947fc705b0b841b5938c48b22dc33e9647ec0752bae66e50278df4f23f64959" |
| 10 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 11 | export GOOS = "${BUILD_GOOS}" |
| 12 | export GOARCH = "${BUILD_GOARCH}" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 13 | CC = "${@d.getVar('BUILD_CC').strip()}" |
| 14 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 15 | export CGO_ENABLED = "1" |
| 16 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 17 | do_configure() { |
| 18 | cd ${WORKDIR}/go1.4/go/src |
| 19 | CGO_ENABLED=0 GOROOT=${WORKDIR}/go1.4/go ./make.bash |
| 20 | } |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 21 | |
| 22 | do_compile() { |
| 23 | export GOBIN="${B}/bin" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 24 | export GOROOT_FINAL="${nonstaging_libdir}/go" |
| 25 | export GOROOT_BOOTSTRAP="${WORKDIR}/go1.4/go" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 26 | rm -rf ${GOBIN} |
| 27 | mkdir ${GOBIN} |
| 28 | |
| 29 | export TMPDIR=${WORKDIR}/build-tmp |
| 30 | mkdir -p ${WORKDIR}/build-tmp |
| 31 | |
| 32 | cd src |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 33 | ./make.bash --host-only |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | make_wrapper() { |
| 37 | rm -f ${D}${bindir}/$2$3 |
| 38 | cat <<END >${D}${bindir}/$2$3 |
| 39 | #!/bin/bash |
| 40 | here=\`dirname \$0\` |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 41 | export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}" |
| 42 | \$here/../lib/go/bin/$1 "\$@" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 43 | END |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 44 | chmod +x ${D}${bindir}/$2 |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | do_install() { |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 48 | install -d ${D}${libdir}/go |
| 49 | cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/ |
| 50 | install -d ${D}${libdir}/go/src |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 51 | (cd ${S}/src; for d in *; do \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 52 | [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 53 | done) |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 54 | rm -rf ${D}${libdir}/go/src/runtime/pprof/testdata |
| 55 | install -d ${D}${bindir} ${D}${libdir}/go/bin |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 56 | for f in ${B}/bin/* |
| 57 | do |
| 58 | base=`basename $f` |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 59 | install -m755 $f ${D}${libdir}/go/bin |
| 60 | make_wrapper $base $base |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 61 | done |
| 62 | } |