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