config/functions: add go_configure() helpers

This commit is contained in:
MilhouseVH 2020-04-28 10:26:52 +01:00 committed by awiouy
parent 3c186abdfc
commit 4d15490c67

View File

@ -911,6 +911,47 @@ target_has_feature() {
listcontains "$TARGET_FEATURES" "$1"
}
# configure variables for go
go_configure() {
unset GOARCH GOARM
case ${TARGET_ARCH} in
x86_64)
export GOARCH=amd64
;;
arm)
export GOARCH=arm
case ${TARGET_CPU} in
arm1176jzf-s)
export GOARM=6
;;
*)
export GOARM=7
;;
esac
;;
aarch64)
export GOARCH=arm64
;;
esac
export GOOS=linux
export GOROOT=${TOOLCHAIN}/lib/golang
export PATH=${PATH}:${GOROOT}/bin
go_configure_path
export CGO_ENABLED=1
export CGO_NO_EMULATION=1
export CGO_CFLAGS=$CFLAGS
}
go_configure_path() {
export GOLANG=${TOOLCHAIN}/lib/golang/bin/go
export GOPATH=${PKG_BUILD}/.gopath
export GOFLAGS="-modcacherw"
}
# find path for matching file or directory, searching standard directory hierarchy, using optional default
# if a path is located it will be set in FOUND_PATH and exit code will be 0.
find_path() {