diff --git a/build-go.sh b/build-go.sh index e59e874..6135772 100755 --- a/build-go.sh +++ b/build-go.sh @@ -10,11 +10,16 @@ url="https://github.com/golang/go/archive" v14="go1.4.3" v14_sum="65e8d2ea08447f02f8b6ab63778e4d98586ac4fd676401dae0eda494c7829965" -bootstrap="${install_dir}/bootstrap-${v14}" +v14_bootstrap="${install_dir}/bootstrap-${v14}" tgz14="${v14}.tar.gz" path_v14="${install_dir}/${tgz14}" +v19="go1.19.6" +v19_sum="0c7f4e6d2de3ae07d60377754955842ad357b0366df01116554fc619b1e99672" +v19_bootstrap="${install_dir}/bootstrap-${v19}" +tgz19="${v19}.tar.gz" +path_v19="${install_dir}/${tgz19}" -v="${1-1.19}" +v="${1-1.20.1}" case "${v}" in 1.16.7) new_sum="07502f16366fbc697b1b09b842d29116e6d6607c9dc42b1d7c54b96f528c7952";; 1.17.1) new_sum="670ce36e100669f9be572a1603858ce4a64eb4b21a31fa5cdefb778609c40337";; @@ -25,9 +30,15 @@ case "${v}" in 1.18.2) new_sum="b76e590857060fdc575a37d4204c15df33de6d23e49d5cf9bdce93083e4dcddb";; 1.18.3) new_sum="cc0e73239f5bc1521de9ddc54f46eb0e69cc41faabe3f468865483bb0f844b68";; 1.18.4) new_sum="283442519c28f5c24dd8c849ebe0570a3ad92cd94610378b33b2053f60391fdf";; + 1.18.5) new_sum="30c07c08c9b9a79d652272ac3298c249a810a4c908e8937cf5e58d2414af1cc3";; 1.19) new_sum="6ac64f39e3f477ac793896437237e84b06d67c7657fbb34abcdbf73c77f6b7a3";; + 1.19.1) new_sum="884439c3de751c705e47a120af6b92b65770a952a7b8788244bc6d73b2548c3e";; + 1.19.5) new_sum="1c24a6a2bf71d64d0ca8e228028d6108521f06b6edc7bf6b34ed6d767a795809";; + 1.19.6) new_sum="0c7f4e6d2de3ae07d60377754955842ad357b0366df01116554fc619b1e99672";; + 1.20.1) new_sum="5db737840a740457c1b4b73b90dad6daa57af0da420f3ea51c39a1a81abbcc41";; *) errx "no hash found for version ${v}";; esac +[[ "${v}" =~ 1\.2* ]] && v1_20=1 || v1_20=0 new="go${v}" new_dir="${install_dir}/go-${new}" @@ -36,11 +47,18 @@ path_new="${install_dir}/${tgznew}" rm -f ${go_dir} -if [[ ! -d "${bootstrap}" ]]; then +if [[ ! -d "${v14_bootstrap}" ]]; then curl -sSL "${url}/${tgz14}" >${path_v14} [[ "$(sha256sum ${path_v14}|cut -d" " -f1)" != "${v14_sum}" ]] && errx "wrong checksum: ${path_v14}" tar xfz ${path_v14} -C ${install_dir} - mv ${install_dir}/go-${v14} ${bootstrap} + mv ${install_dir}/go-${v14} ${v14_bootstrap} +fi + +if [[ "${v1_20}" -eq 1 ]] && [[ ! -d "${v19_bootstrap}" ]]; then + curl -sSL "${url}/${tgz19}" >${path_v19} + [[ "$(sha256sum ${path_v19}|cut -d" " -f1)" != "${v19_sum}" ]] && errx "wrong checksum: ${path_v19}" + tar xfz ${path_v19} -C ${install_dir} + mv ${install_dir}/go-${v19} ${v19_bootstrap} fi if [[ ! -d "${new_dir}" ]]; then @@ -52,12 +70,19 @@ fi export CGO_ENABLED=0 -if [[ ! -x "${bootstrap}/bin/go" ]]; then - cd ${bootstrap}/src +if [[ ! -x "${v14_bootstrap}/bin/go" ]]; then + cd ${v14_bootstrap}/src + ./make.bash +fi + +if [[ "${v1_20}" -eq 1 ]] && [[ ! -x "${v19_bootstrap}/bin/go" ]]; then + export GOROOT_BOOTSTRAP=${v14_bootstrap} + cd ${v19_bootstrap}/src ./make.bash fi if [[ ! -x "${new_dir}/bin/go" ]]; then + [[ "${v1_20}" -eq 1 ]] && bootstrap=${v19_bootstrap} || bootstrap=${v14_bootstrap} export GOROOT_BOOTSTRAP=${bootstrap} [[ "$(uname -m)" == "x86_64" ]] && export GOARCH=amd64 || export GOARCH=386 cd ${new_dir}/src