Skip to content

Commit 8d54295

Browse files
authored
Merge pull request #147 from kpandu987/go_upgrade
RDKBACCL-699 : unified-wifi-mesh integration in BPI
2 parents 9480fd7 + be3971e commit 8d54295

24 files changed

+1327
-0
lines changed

NOTICE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ Licensed under the Apache License, Version 2.0
88

99
Copyright [2014] [Cisco Systems, Inc.]
1010
Licensed under the Apache License, Version 2.0
11+
12+
Some material is derived from openembedded.org or the yocto project and is licensed in the same manner here (MIT for metadata; source code to match the associated recipe license).
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
require go-common.inc
2+
3+
FILESEXTRAPATHS:prepend := "${FILE_DIRNAME}/go:"
4+
5+
LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"
6+
7+
SRC_URI += "\
8+
file://0001-cmd-go-make-content-based-hash-generation-less-pedan.patch \
9+
file://0003-allow-GOTOOLDIR-to-be-overridden-in-the-environment.patch \
10+
file://0004-ld-add-soname-to-shareable-objects.patch \
11+
file://0005-make.bash-override-CC-when-building-dist-and-go_boot.patch \
12+
file://0006-cmd-dist-separate-host-and-target-builds.patch \
13+
file://0007-cmd-go-make-GOROOT-precious-by-default.patch \
14+
file://0001-exec.go-do-not-write-linker-flags-into-buildids.patch \
15+
file://0001-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch \
16+
file://filter-build-paths.patch \
17+
"
18+
SRC_URI[main.sha256sum] = "775bdf285ceaba940da8a2fe20122500efd7a0b65dbcee85247854a8d7402633"
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# This recipe is for bootstrapping our go-cross from a prebuilt binary of Go from golang.org.
2+
3+
SUMMARY = "Go programming language compiler (upstream binary for bootstrap)"
4+
HOMEPAGE = " http://golang.org/"
5+
LICENSE = "BSD-3-Clause"
6+
LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"
7+
8+
PROVIDES = "go-native"
9+
10+
# Checksums available at https://go.dev/dl/
11+
SRC_URI = "https://dl.google.com/go/go${PV}.${BUILD_GOOS}-${BUILD_GOARCH}.tar.gz;name=go_${BUILD_GOTUPLE}"
12+
SRC_URI[go_linux_amd64.sha256sum] = "7a75720c9b066ae1750f6bcc7052aba70fa3813f4223199ee2a2315fd3eb533d"
13+
SRC_URI[go_linux_arm64.sha256sum] = "071ea7bf386fdd08df524859b878d99fc359e491e7ad65c1c1cc55b67972c882"
14+
15+
UPSTREAM_CHECK_URI = "https://golang.org/dl/"
16+
UPSTREAM_CHECK_REGEX = "go(?P<pver>\d+(\.\d+)+)\.linux"
17+
18+
S = "${WORKDIR}/go"
19+
20+
inherit goarch native
21+
22+
do_compile() {
23+
:
24+
}
25+
26+
make_wrapper() {
27+
rm -f ${D}${bindir}/$1
28+
cat <<END >${D}${bindir}/$1
29+
#!/bin/bash
30+
here=\`dirname \$0\`
31+
export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}"
32+
\$here/../lib/go/bin/$1 "\$@"
33+
END
34+
chmod +x ${D}${bindir}/$1
35+
}
36+
37+
do_install() {
38+
find ${S} -depth -type d -name testdata -exec rm -rf {} +
39+
40+
install -d ${D}${bindir} ${D}${libdir}/go
41+
cp --preserve=mode,timestamps -R ${S}/ ${D}${libdir}/
42+
43+
for f in ${S}/bin/*
44+
do
45+
make_wrapper `basename $f`
46+
done
47+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
SUMMARY = "Go programming language compiler"
2+
DESCRIPTION = " The Go programming language is an open source project to make \
3+
programmers more productive. Go is expressive, concise, clean, and\
4+
efficient. Its concurrency mechanisms make it easy to write programs\
5+
that get the most out of multicore and networked machines, while its\
6+
novel type system enables flexible and modular program construction.\
7+
Go compiles quickly to machine code yet has the convenience of\
8+
garbage collection and the power of run-time reflection. It's a\
9+
fast, statically typed, compiled language that feels like a\
10+
dynamically typed, interpreted language."
11+
12+
HOMEPAGE = " http://golang.org/"
13+
LICENSE = "BSD-3-Clause"
14+
15+
inherit goarch
16+
17+
SRC_URI = "https://golang.org/dl/go${PV}.src.tar.gz;name=main"
18+
S = "${WORKDIR}/go"
19+
B = "${S}"
20+
UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)\.src\.tar"
21+
22+
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
23+
SSTATE_SCAN_CMD = "true"
24+
25+
export GOROOT_OVERRIDE = "1"
26+
export GOTMPDIR ?= "${WORKDIR}/build-tmp"
27+
GOTMPDIR[vardepvalue] = ""
28+
export CGO_ENABLED = "1"
29+
30+
export GOHOSTOS ?= "${BUILD_GOOS}"
31+
export GOHOSTARCH ?= "${BUILD_GOARCH}"
32+
export GOROOT_BOOTSTRAP ?= "${STAGING_LIBDIR_NATIVE}/go"
33+
export GOOS ?= "${TARGET_GOOS}"
34+
export GOARCH ?= "${TARGET_GOARCH}"
35+
export GOARM ?= "${TARGET_GOARM}"
36+
export GO386 ?= "${TARGET_GO386}"
37+
export GOMIPS ?= "${TARGET_GOMIPS}"
38+
export GOROOT_FINAL ?= "${libdir}/go"
39+
40+
export GODEBUG = "gocachehash=1"
41+
42+
do_compile:prepend() {
43+
BUILD_CC=${BUILD_CC}
44+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
inherit cross-canadian
2+
3+
DEPENDS = "go-native virtual/${HOST_PREFIX}go-crosssdk virtual/nativesdk-${HOST_PREFIX}go-runtime \
4+
virtual/${HOST_PREFIX}gcc-crosssdk virtual/nativesdk-libc \
5+
virtual/nativesdk-${HOST_PREFIX}compilerlibs"
6+
PN = "go-cross-canadian-${TRANSLATED_TARGET_ARCH}"
7+
8+
# it uses gcc on build machine during go-cross-canadian bootstrap, but
9+
# the gcc version may be old and not support option '-fmacro-prefix-map'
10+
# which is one of default values of DEBUG_PREFIX_MAP
11+
DEBUG_PREFIX_MAP = "-fdebug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
12+
-fdebug-prefix-map=${STAGING_DIR_HOST}= \
13+
-fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
14+
"
15+
16+
export GOTOOLDIR_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/${HOST_SYS}/go/pkg/tool/${BUILD_GOTUPLE}"
17+
export CGO_CFLAGS = "${CFLAGS}"
18+
export CGO_LDFLAGS = "${LDFLAGS}"
19+
export GO_LDFLAGS = '-linkmode external -extld ${HOST_PREFIX}gcc -extldflags "--sysroot=${STAGING_DIR_HOST} ${SECURITY_NOPIE_CFLAGS} ${HOST_CC_ARCH} ${LDFLAGS}"'
20+
21+
do_configure[noexec] = "1"
22+
23+
do_compile() {
24+
export CC_FOR_${HOST_GOTUPLE}="${HOST_PREFIX}gcc --sysroot=${STAGING_DIR_HOST}${SDKPATHNATIVE} ${SECURITY_NOPIE_CFLAGS}"
25+
export CXX_FOR_${HOST_GOTUPLE}="${HOST_PREFIX}gxx --sysroot=${STAGING_DIR_HOST}${SDKPATHNATIVE} ${SECURITY_NOPIE_CFLAGS}"
26+
cd src
27+
./make.bash --host-only --no-banner
28+
cd ${B}
29+
}
30+
do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
31+
32+
33+
make_wrapper() {
34+
rm -f ${D}${bindir}/$2
35+
cat <<END >${D}${bindir}/$2
36+
#!/bin/sh
37+
here=\`dirname \$0\`
38+
native_goroot=\`readlink -f \$here/../../lib/${TARGET_SYS}/go\`
39+
export GOARCH="${TARGET_GOARCH}"
40+
export GOOS="${TARGET_GOOS}"
41+
test -n "\$GOARM" || export GOARM="${TARGET_GOARM}"
42+
test -n "\$GO386" || export GO386="${TARGET_GO386}"
43+
test -n "\$GOMIPS" || export GOMIPS="${TARGET_GOMIPS}"
44+
export GOTOOLDIR="\$native_goroot/pkg/tool/${HOST_GOTUPLE}"
45+
test -n "\$GOROOT" || export GOROOT="\$OECORE_TARGET_SYSROOT/${target_libdir}/go"
46+
\$here/../../lib/${TARGET_SYS}/go/bin/$1 "\$@"
47+
END
48+
chmod +x ${D}${bindir}/$2
49+
}
50+
51+
do_install() {
52+
install -d ${D}${libdir}/go/pkg/tool
53+
cp --preserve=mode,timestamps -R ${B}/pkg/tool/${HOST_GOTUPLE} ${D}${libdir}/go/pkg/tool/
54+
install -d ${D}${bindir} ${D}${libdir}/go/bin
55+
for f in ${B}/${GO_BUILD_BINDIR}/*
56+
do
57+
base=`basename $f`
58+
install -m755 $f ${D}${libdir}/go/bin
59+
make_wrapper $base ${TARGET_PREFIX}$base
60+
done
61+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require go-cross-canadian.inc
2+
require go-${PV}.inc
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
inherit cross
2+
3+
PROVIDES = "virtual/${TUNE_PKGARCH}-go"
4+
DEPENDS = "go-native"
5+
6+
PN = "go-cross-${TUNE_PKGARCH}"
7+
8+
export GOCACHE = "${B}/.cache"
9+
CC = "${@d.getVar('BUILD_CC').strip()}"
10+
11+
do_configure[noexec] = "1"
12+
13+
do_compile() {
14+
export CC_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
15+
export CXX_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
16+
cd src
17+
./make.bash --host-only --no-banner
18+
cd ${B}
19+
}
20+
do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
21+
22+
make_wrapper() {
23+
rm -f ${D}${bindir}/$2
24+
cat <<END >${D}${bindir}/$2
25+
#!/bin/bash
26+
here=\`dirname \$0\`
27+
export GOARCH="${TARGET_GOARCH}"
28+
export GOOS="${TARGET_GOOS}"
29+
export GOARM="\${GOARM:-${TARGET_GOARM}}"
30+
export GO386="\${GO386:-${TARGET_GO386}}"
31+
export GOMIPS="\${GOMIPS:-${TARGET_GOMIPS}}"
32+
\$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@"
33+
END
34+
chmod +x ${D}${bindir}/$2
35+
}
36+
37+
do_install() {
38+
install -d ${D}${libdir}/go
39+
cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
40+
install -d ${D}${libdir}/go/src
41+
(cd ${S}/src; for d in *; do \
42+
[ ! -d $d ] || cp --preserve=mode,timestamps -R ${S}/src/$d ${D}${libdir}/go/src/; \
43+
done)
44+
find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \;
45+
install -d ${D}${bindir} ${D}${libdir}/go/bin
46+
for f in ${B}/bin/*
47+
do
48+
base=`basename $f`
49+
install -m755 $f ${D}${libdir}/go/bin
50+
make_wrapper $base ${TARGET_PREFIX}$base
51+
done
52+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require go-cross.inc
2+
require go-${PV}.inc
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
inherit crosssdk
2+
3+
DEPENDS = "go-native virtual/${TARGET_PREFIX}gcc-crosssdk virtual/nativesdk-${TARGET_PREFIX}compilerlibs virtual/${TARGET_PREFIX}binutils-crosssdk"
4+
PN = "go-crosssdk-${SDK_SYS}"
5+
PROVIDES = "virtual/${TARGET_PREFIX}go-crosssdk"
6+
7+
export GOCACHE = "${B}/.cache"
8+
9+
do_configure[noexec] = "1"
10+
11+
do_compile() {
12+
export CC_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}"
13+
export CXX_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}"
14+
cd src
15+
./make.bash --host-only --no-banner
16+
cd ${B}
17+
}
18+
do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
19+
20+
make_wrapper() {
21+
rm -f ${D}${bindir}/$2
22+
cat <<END >${D}${bindir}/$2
23+
#!/bin/bash
24+
here=\`dirname \$0\`
25+
export GOARCH="${TARGET_GOARCH}"
26+
export GOOS="${TARGET_GOOS}"
27+
\$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@"
28+
END
29+
chmod +x ${D}${bindir}/$2
30+
}
31+
32+
do_install() {
33+
install -d ${D}${libdir}/go
34+
install -d ${D}${libdir}/go/bin
35+
install -d ${D}${libdir}/go/pkg/tool
36+
install -d ${D}${bindir}
37+
cp --preserve=mode,timestamps -R ${S}/pkg/tool/${BUILD_GOTUPLE} ${D}${libdir}/go/pkg/tool/
38+
for f in ${B}/bin/*
39+
do
40+
base=`basename $f`
41+
install -m755 $f ${D}${libdir}/go/bin
42+
make_wrapper $base ${TARGET_PREFIX}$base
43+
done
44+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require go-crosssdk.inc
2+
require go-${PV}.inc

0 commit comments

Comments
 (0)