xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-devtools/go/go-binary-native_1.17.13.bb (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1# This recipe is for bootstrapping our go-cross from a prebuilt binary of Go from golang.org.
2
3SUMMARY = "Go programming language compiler (upstream binary for bootstrap)"
4HOMEPAGE = " http://golang.org/"
5LICENSE = "BSD-3-Clause"
6LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"
7
8PROVIDES = "go-native"
9
10SRC_URI = "https://dl.google.com/go/go${PV}.${BUILD_GOOS}-${BUILD_GOARCH}.tar.gz;name=go_${BUILD_GOTUPLE}"
11SRC_URI[go_linux_amd64.sha256sum] = "4cdd2bc664724dc7db94ad51b503512c5ae7220951cac568120f64f8e94399fc"
12SRC_URI[go_linux_arm64.sha256sum] = "914daad3f011cc2014dea799bb7490442677e4ad6de0b2ac3ded6cee7e3f493d"
13
14UPSTREAM_CHECK_URI = "https://golang.org/dl/"
15UPSTREAM_CHECK_REGEX = "go(?P<pver>\d+(\.\d+)+)\.linux"
16
17S = "${WORKDIR}/go"
18
19inherit goarch native
20
21do_compile() {
22    :
23}
24
25make_wrapper() {
26	rm -f ${D}${bindir}/$1
27	cat <<END >${D}${bindir}/$1
28#!/bin/bash
29here=\`dirname \$0\`
30export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}"
31\$here/../lib/go/bin/$1 "\$@"
32END
33	chmod +x ${D}${bindir}/$1
34}
35
36do_install() {
37    find ${S} -depth -type d -name testdata -exec rm -rf {} +
38
39	install -d ${D}${bindir} ${D}${libdir}/go
40	cp --preserve=mode,timestamps -R ${S}/ ${D}${libdir}/
41
42	for f in ${S}/bin/*
43	do
44	  	make_wrapper `basename $f`
45	done
46}
47