diff --git a/config/functions b/config/functions index b38ed56195..0107e2cf29 100644 --- a/config/functions +++ b/config/functions @@ -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() {