Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 1 | inherit native |
| 2 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 3 | SRC_URI_append = " https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz;name=bootstrap;subdir=go1.4" |
| 4 | SRC_URI[bootstrap.md5sum] = "dbf727a4b0e365bf88d97cbfde590016" |
| 5 | SRC_URI[bootstrap.sha256sum] = "f4ff5b5eb3a3cae1c993723f3eab519c5bae18866b5e5f96fe1102f0cb5c3e52" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 6 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 7 | export GOOS = "${BUILD_GOOS}" |
| 8 | export GOARCH = "${BUILD_GOARCH}" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 9 | CC = "${@d.getVar('BUILD_CC').strip()}" |
| 10 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 11 | GOMAKEARGS ?= "--no-banner" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 12 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 13 | do_configure() { |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 14 | cd ${WORKDIR}/go1.4/go/src |
| 15 | CGO_ENABLED=0 GOROOT=${WORKDIR}/go1.4/go ./make.bash |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 16 | } |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 17 | |
| 18 | do_compile() { |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 19 | export GOROOT_FINAL="${libdir_native}/go" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 20 | export GOROOT_BOOTSTRAP="${WORKDIR}/go1.4/go" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 21 | |
| 22 | cd src |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 23 | ./make.bash ${GOMAKEARGS} |
| 24 | cd ${B} |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 25 | } |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 26 | do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin" |
| 27 | do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 28 | |
| 29 | make_wrapper() { |
| 30 | rm -f ${D}${bindir}/$2$3 |
| 31 | cat <<END >${D}${bindir}/$2$3 |
| 32 | #!/bin/bash |
| 33 | here=\`dirname \$0\` |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 34 | export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}" |
| 35 | \$here/../lib/go/bin/$1 "\$@" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 36 | END |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 37 | chmod +x ${D}${bindir}/$2 |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | do_install() { |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 41 | install -d ${D}${libdir}/go |
| 42 | cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/ |
| 43 | install -d ${D}${libdir}/go/src |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 44 | (cd ${S}/src; for d in *; do \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 45 | [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 46 | done) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 47 | find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \; |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 48 | install -d ${D}${bindir} ${D}${libdir}/go/bin |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 49 | for f in ${B}/bin/* |
| 50 | do |
| 51 | base=`basename $f` |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 52 | install -m755 $f ${D}${libdir}/go/bin |
| 53 | make_wrapper $base $base |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 54 | done |
| 55 | } |