RetroPie-Setup/scriptmodules/supplementary/golang.sh
cmitu 6e84202206 scraper: change build method to fix FTBS
Changed the build method by using Golang's module support and creating a module from the upstream sources. Fixes the current build errors due to a transitive depedency which requires upgrading Go to 1.17+.
This simplifies applying the patch and rolling back (downgrading) the TGDB module dependency. As a bonus, we can use the normal way of retrieving the sources and generating the scriptmodule `.pkg` info file.

Fixed also the `golang` installation, the new version was not installed automatically due to a insufficient version check.
2023-09-11 04:57:26 +01:00

46 lines
1.5 KiB
Bash

# This file is part of The RetroPie Project
#
# The RetroPie Project is the legal property of its developers, whose names are
# too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source.
#
# See the LICENSE.md file at the top-level directory of this distribution and
# at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md
#
rp_module_id="golang"
rp_module_desc="Golang binary install"
rp_module_licence="BSD https://golang.org/LICENSE"
rp_module_section="depends"
rp_module_flags="noinstclean"
function _get_goroot_golang() {
echo "$rootdir/supplementary/golang"
}
function install_bin_golang() {
local target_version=1.11.13
local version
if [[ -e "$md_inst/bin/go" ]]; then
local version=$(GOROOT="$md_inst" "$md_inst/bin/go" version | sed 's/.*go\(1[^ ]*\).*/\1/')
fi
printMsgs "console" "Current Go version: $version"
if compareVersions "$version" ge "$target_version" ; then
return 0
fi
rm -rf "$md_inst"
mkdir -p "$md_inst"
local arch="armv6l"
if isPlatform "x86"; then
if isPlatform "64bit"; then
arch="amd64"
else
arch="386"
fi
fi
if isPlatform "aarch64"; then
arch="arm64"
fi
printMsgs "console" "Downloading go$target_version.linux-$arch.tar.gz"
downloadAndExtract "https://storage.googleapis.com/golang/go${target_version}.linux-$arch.tar.gz" "$md_inst" --strip-components 1 --exclude="go/test"
}