Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make langdale branch aligned with master branch #47

Merged
merged 6 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions compat/dunfell/backport-go/go/go-1.20.1.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require go-common.inc

FILESEXTRAPATHS:prepend := "${FILE_DIRNAME}/go:"

LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"

SRC_URI += "\
file://0001-cmd-go-make-content-based-hash-generation-less-pedan.patch \
file://0002-cmd-go-Allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch \
file://0003-ld-add-soname-to-shareable-objects.patch \
file://0004-make.bash-override-CC-when-building-dist-and-go_boot.patch \
file://0005-cmd-dist-separate-host-and-target-builds.patch \
file://0006-cmd-go-make-GOROOT-precious-by-default.patch \
file://0007-exec.go-do-not-write-linker-flags-into-buildids.patch \
file://0008-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch \
file://0009-go-Filter-build-paths-on-staticly-linked-arches.patch \
file://0010-cmd-compile-re-compile-instantiated-generic-methods-.patch \
file://CVE-2023-24532.patch \
"
SRC_URI[main.sha256sum] = "b5c1a3af52c385a6d1c76aed5361cf26459023980d0320de7658bae3915831a2"
50 changes: 50 additions & 0 deletions compat/dunfell/backport-go/go/go-binary-native_1.20.1.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This recipe is for bootstrapping our go-cross from a prebuilt binary of Go from golang.org.

SUMMARY = "Go programming language compiler (upstream binary for bootstrap)"
HOMEPAGE = " http://golang.org/"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"

PROVIDES = "go-native"

# Checksums available at https://go.dev/dl/
SRC_URI = "https://dl.google.com/go/go${PV}.${BUILD_GOOS}-${BUILD_GOARCH}.tar.gz;name=go_${BUILD_GOTUPLE}"
SRC_URI[go_linux_amd64.sha256sum] = "000a5b1fca4f75895f78befeb2eecf10bfff3c428597f3f1e69133b63b911b02"
SRC_URI[go_linux_arm64.sha256sum] = "5e5e2926733595e6f3c5b5ad1089afac11c1490351855e87849d0e7702b1ec2e"
SRC_URI[go_linux_ppc64le.sha256sum] = "85cfd4b89b48c94030783b6e9e619e35557862358b846064636361421d0b0c52"

UPSTREAM_CHECK_URI = "https://golang.org/dl/"
UPSTREAM_CHECK_REGEX = "go(?P<pver>\d+(\.\d+)+)\.linux"

CVE_PRODUCT = "go"

S = "${WORKDIR}/go"

inherit goarch native

do_compile() {
:
}

make_wrapper() {
rm -f ${D}${bindir}/$1
cat <<END >${D}${bindir}/$1
#!/bin/bash
here=\`dirname \$0\`
export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}"
\$here/../lib/go/bin/$1 "\$@"
END
chmod +x ${D}${bindir}/$1
}

do_install() {
find ${S} -depth -type d -name testdata -exec rm -rf {} +

install -d ${D}${bindir} ${D}${libdir}/go
cp --preserve=mode,timestamps -R ${S}/ ${D}${libdir}/

for f in ${S}/bin/*
do
make_wrapper `basename $f`
done
}
47 changes: 47 additions & 0 deletions compat/dunfell/backport-go/go/go-common.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
SUMMARY = "Go programming language compiler"
DESCRIPTION = " The Go programming language is an open source project to make \
programmers more productive. Go is expressive, concise, clean, and\
efficient. Its concurrency mechanisms make it easy to write programs\
that get the most out of multicore and networked machines, while its\
novel type system enables flexible and modular program construction.\
Go compiles quickly to machine code yet has the convenience of\
garbage collection and the power of run-time reflection. It's a\
fast, statically typed, compiled language that feels like a\
dynamically typed, interpreted language."

HOMEPAGE = " http://golang.org/"
LICENSE = "BSD-3-Clause"

inherit goarch

SRC_URI = "https://golang.org/dl/go${PV}.src.tar.gz;name=main"
S = "${WORKDIR}/go"
B = "${S}"
UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)\.src\.tar"

# all recipe variants are created from the same product
CVE_PRODUCT = "go"

INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
SSTATE_SCAN_CMD = "true"

export GOROOT_OVERRIDE = "1"
export GOTMPDIR ?= "${WORKDIR}/build-tmp"
GOTMPDIR[vardepvalue] = ""
export CGO_ENABLED = "1"

export GOHOSTOS ?= "${BUILD_GOOS}"
export GOHOSTARCH ?= "${BUILD_GOARCH}"
export GOROOT_BOOTSTRAP ?= "${STAGING_LIBDIR_NATIVE}/go"
export GOOS ?= "${TARGET_GOOS}"
export GOARCH ?= "${TARGET_GOARCH}"
export GOARM ?= "${TARGET_GOARM}"
export GO386 ?= "${TARGET_GO386}"
export GOMIPS ?= "${TARGET_GOMIPS}"
export GOROOT_FINAL ?= "${libdir}/go"

export GODEBUG = "gocachehash=1"

do_compile:prepend() {
BUILD_CC=${BUILD_CC}
}
61 changes: 61 additions & 0 deletions compat/dunfell/backport-go/go/go-cross-canadian.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
inherit cross-canadian

DEPENDS = "go-native virtual/${HOST_PREFIX}go-crosssdk virtual/nativesdk-${HOST_PREFIX}go-runtime \
virtual/${HOST_PREFIX}gcc-crosssdk virtual/nativesdk-libc \
virtual/nativesdk-${HOST_PREFIX}compilerlibs"
PN = "go-cross-canadian-${TRANSLATED_TARGET_ARCH}"

# it uses gcc on build machine during go-cross-canadian bootstrap, but
# the gcc version may be old and not support option '-fmacro-prefix-map'
# which is one of default values of DEBUG_PREFIX_MAP
DEBUG_PREFIX_MAP = "-fdebug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
-fdebug-prefix-map=${STAGING_DIR_HOST}= \
-fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
"

export GOTOOLDIR_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/${HOST_SYS}/go/pkg/tool/${BUILD_GOTUPLE}"
export CGO_CFLAGS = "${CFLAGS}"
export CGO_LDFLAGS = "${LDFLAGS}"
export GO_LDFLAGS = '-linkmode external -extld ${HOST_PREFIX}gcc -extldflags "--sysroot=${STAGING_DIR_HOST} ${SECURITY_NOPIE_CFLAGS} ${HOST_CC_ARCH} ${LDFLAGS}"'

do_configure[noexec] = "1"

do_compile() {
export CC_FOR_${HOST_GOTUPLE}="${HOST_PREFIX}gcc --sysroot=${STAGING_DIR_HOST} ${SECURITY_NOPIE_CFLAGS}"
export CXX_FOR_${HOST_GOTUPLE}="${HOST_PREFIX}gxx --sysroot=${STAGING_DIR_HOST} ${SECURITY_NOPIE_CFLAGS}"
cd src
./make.bash --target-only --no-banner
cd ${B}
}
do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"


make_wrapper() {
rm -f ${D}${bindir}/$2
cat <<END >${D}${bindir}/$2
#!/bin/sh
here=\`dirname \$0\`
native_goroot=\`readlink -f \$here/../../lib/${TARGET_SYS}/go\`
export GOARCH="${TARGET_GOARCH}"
export GOOS="${TARGET_GOOS}"
test -n "\$GOARM" || export GOARM="${TARGET_GOARM}"
test -n "\$GO386" || export GO386="${TARGET_GO386}"
test -n "\$GOMIPS" || export GOMIPS="${TARGET_GOMIPS}"
export GOTOOLDIR="\$native_goroot/pkg/tool/${HOST_GOTUPLE}"
test -n "\$GOROOT" || export GOROOT="\$OECORE_TARGET_SYSROOT/${target_libdir}/go"
\$here/../../lib/${TARGET_SYS}/go/bin/$1 "\$@"
END
chmod +x ${D}${bindir}/$2
}

do_install() {
install -d ${D}${libdir}/go/pkg/tool
cp --preserve=mode,timestamps -R ${B}/pkg/tool/${HOST_GOTUPLE} ${D}${libdir}/go/pkg/tool/
install -d ${D}${bindir} ${D}${libdir}/go/bin
for f in ${B}/${GO_BUILD_BINDIR}/*
do
base=`basename $f`
install -m755 $f ${D}${libdir}/go/bin
make_wrapper $base ${TARGET_PREFIX}$base
done
}
2 changes: 2 additions & 0 deletions compat/dunfell/backport-go/go/go-cross-canadian_1.20.1.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require go-cross-canadian.inc
require go-${PV}.inc
52 changes: 52 additions & 0 deletions compat/dunfell/backport-go/go/go-cross.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
inherit cross

PROVIDES = "virtual/${TUNE_PKGARCH}-go"
DEPENDS = "go-native"

PN = "go-cross-${TUNE_PKGARCH}"

export GOCACHE = "${B}/.cache"
CC = "${@d.getVar('BUILD_CC').strip()}"

do_configure[noexec] = "1"

do_compile() {
export CC_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
export CXX_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}"
cd src
./make.bash --host-only --no-banner
cd ${B}
}
do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"

make_wrapper() {
rm -f ${D}${bindir}/$2
cat <<END >${D}${bindir}/$2
#!/bin/bash
here=\`dirname \$0\`
export GOARCH="${TARGET_GOARCH}"
export GOOS="${TARGET_GOOS}"
export GOARM="\${GOARM:-${TARGET_GOARM}}"
export GO386="\${GO386:-${TARGET_GO386}}"
export GOMIPS="\${GOMIPS:-${TARGET_GOMIPS}}"
\$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@"
END
chmod +x ${D}${bindir}/$2
}

do_install() {
install -d ${D}${libdir}/go
cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
install -d ${D}${libdir}/go/src
(cd ${S}/src; for d in *; do \
[ ! -d $d ] || cp --preserve=mode,timestamps -R ${S}/src/$d ${D}${libdir}/go/src/; \
done)
find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \;
install -d ${D}${bindir} ${D}${libdir}/go/bin
for f in ${B}/bin/*
do
base=`basename $f`
install -m755 $f ${D}${libdir}/go/bin
make_wrapper $base ${TARGET_PREFIX}$base
done
}
2 changes: 2 additions & 0 deletions compat/dunfell/backport-go/go/go-cross_1.20.1.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require go-cross.inc
require go-${PV}.inc
44 changes: 44 additions & 0 deletions compat/dunfell/backport-go/go/go-crosssdk.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
inherit crosssdk

DEPENDS = "go-native virtual/${TARGET_PREFIX}gcc-crosssdk virtual/nativesdk-${TARGET_PREFIX}compilerlibs virtual/${TARGET_PREFIX}binutils-crosssdk"
PN = "go-crosssdk-${SDK_SYS}"
PROVIDES = "virtual/${TARGET_PREFIX}go-crosssdk"

export GOCACHE = "${B}/.cache"

do_configure[noexec] = "1"

do_compile() {
export CC_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}"
export CXX_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}"
cd src
./make.bash --host-only --no-banner
cd ${B}
}
do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"

make_wrapper() {
rm -f ${D}${bindir}/$2
cat <<END >${D}${bindir}/$2
#!/bin/bash
here=\`dirname \$0\`
export GOARCH="${TARGET_GOARCH}"
export GOOS="${TARGET_GOOS}"
\$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@"
END
chmod +x ${D}${bindir}/$2
}

do_install() {
install -d ${D}${libdir}/go
install -d ${D}${libdir}/go/bin
install -d ${D}${libdir}/go/pkg/tool
install -d ${D}${bindir}
cp --preserve=mode,timestamps -R ${S}/pkg/tool/${BUILD_GOTUPLE} ${D}${libdir}/go/pkg/tool/
for f in ${B}/bin/*
do
base=`basename $f`
install -m755 $f ${D}${libdir}/go/bin
make_wrapper $base ${TARGET_PREFIX}$base
done
}
2 changes: 2 additions & 0 deletions compat/dunfell/backport-go/go/go-crosssdk_1.20.1.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require go-crosssdk.inc
require go-${PV}.inc
58 changes: 58 additions & 0 deletions compat/dunfell/backport-go/go/go-native_1.20.1.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This recipe builds a native Go (written in Go) by first building an old Go 1.4
# (written in C). However this old Go does not support all hosts platforms.

require go-${PV}.inc

inherit native

SRC_URI += "https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz;name=bootstrap;subdir=go1.4"
SRC_URI[bootstrap.sha256sum] = "f4ff5b5eb3a3cae1c993723f3eab519c5bae18866b5e5f96fe1102f0cb5c3e52"

export GOOS = "${BUILD_GOOS}"
export GOARCH = "${BUILD_GOARCH}"
CC = "${@d.getVar('BUILD_CC').strip()}"

GOMAKEARGS ?= "--no-banner"

do_configure() {
cd ${WORKDIR}/go1.4/go/src
CGO_ENABLED=0 GOROOT=${WORKDIR}/go1.4/go ./make.bash
}

do_compile() {
export GOROOT_FINAL="${libdir_native}/go"
export GOROOT_BOOTSTRAP="${WORKDIR}/go1.4/go"

cd src
./make.bash ${GOMAKEARGS}
cd ${B}
}
do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin"

make_wrapper() {
rm -f ${D}${bindir}/$2$3
cat <<END >${D}${bindir}/$2$3
#!/bin/bash
here=\`dirname \$0\`
export GOROOT="${GOROOT:-\`readlink -f \$here/../lib/go\`}"
\$here/../lib/go/bin/$1 "\$@"
END
chmod +x ${D}${bindir}/$2
}

do_install() {
install -d ${D}${libdir}/go
cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
install -d ${D}${libdir}/go/src
(cd ${S}/src; for d in *; do \
[ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \
done)
find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \;
install -d ${D}${bindir} ${D}${libdir}/go/bin
for f in ${B}/bin/*
do
base=`basename $f`
install -m755 $f ${D}${libdir}/go/bin
make_wrapper $base $base
done
}
Loading
Loading