blob: 207708745e0b5c9cd800c738a2c19027b9a8f4d0 [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001inherit native
2
Brad Bishop316dfdd2018-06-25 12:45:53 -04003SRC_URI_append = " https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz;name=bootstrap;subdir=go1.4"
4SRC_URI[bootstrap.md5sum] = "dbf727a4b0e365bf88d97cbfde590016"
5SRC_URI[bootstrap.sha256sum] = "f4ff5b5eb3a3cae1c993723f3eab519c5bae18866b5e5f96fe1102f0cb5c3e52"
Brad Bishopd7bf8c12018-02-25 22:55:05 -05006
Brad Bishop6e60e8b2018-02-01 10:27:11 -05007export GOOS = "${BUILD_GOOS}"
8export GOARCH = "${BUILD_GOARCH}"
Brad Bishopd7bf8c12018-02-25 22:55:05 -05009CC = "${@d.getVar('BUILD_CC').strip()}"
10
Brad Bishop316dfdd2018-06-25 12:45:53 -040011GOMAKEARGS ?= "--no-banner"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050012
Brad Bishopd7bf8c12018-02-25 22:55:05 -050013do_configure() {
Brad Bishop316dfdd2018-06-25 12:45:53 -040014 cd ${WORKDIR}/go1.4/go/src
15 CGO_ENABLED=0 GOROOT=${WORKDIR}/go1.4/go ./make.bash
Brad Bishopd7bf8c12018-02-25 22:55:05 -050016}
Brad Bishop6e60e8b2018-02-01 10:27:11 -050017
18do_compile() {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080019 export GOROOT_FINAL="${libdir_native}/go"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050020 export GOROOT_BOOTSTRAP="${WORKDIR}/go1.4/go"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050021
22 cd src
Brad Bishop316dfdd2018-06-25 12:45:53 -040023 ./make.bash ${GOMAKEARGS}
24 cd ${B}
Brad Bishop6e60e8b2018-02-01 10:27:11 -050025}
Brad Bishop316dfdd2018-06-25 12:45:53 -040026do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin"
27do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050028
29make_wrapper() {
30 rm -f ${D}${bindir}/$2$3
31 cat <<END >${D}${bindir}/$2$3
32#!/bin/bash
33here=\`dirname \$0\`
Brad Bishopd7bf8c12018-02-25 22:55:05 -050034export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}"
35\$here/../lib/go/bin/$1 "\$@"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050036END
Brad Bishopd7bf8c12018-02-25 22:55:05 -050037 chmod +x ${D}${bindir}/$2
Brad Bishop6e60e8b2018-02-01 10:27:11 -050038}
39
40do_install() {
Brad Bishopd7bf8c12018-02-25 22:55:05 -050041 install -d ${D}${libdir}/go
42 cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
43 install -d ${D}${libdir}/go/src
Brad Bishop6e60e8b2018-02-01 10:27:11 -050044 (cd ${S}/src; for d in *; do \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050045 [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050046 done)
Brad Bishop316dfdd2018-06-25 12:45:53 -040047 find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \;
Brad Bishopd7bf8c12018-02-25 22:55:05 -050048 install -d ${D}${bindir} ${D}${libdir}/go/bin
Brad Bishop6e60e8b2018-02-01 10:27:11 -050049 for f in ${B}/bin/*
50 do
51 base=`basename $f`
Brad Bishopd7bf8c12018-02-25 22:55:05 -050052 install -m755 $f ${D}${libdir}/go/bin
53 make_wrapper $base $base
Brad Bishop6e60e8b2018-02-01 10:27:11 -050054 done
55}