internal/rosa: bootstrap go toolchain
All checks were successful
Test / Create distribution (push) Successful in 1m6s
Test / Sandbox (push) Successful in 3m2s
Test / Hakurei (push) Successful in 4m14s
Test / ShareFS (push) Successful in 4m15s
Test / Hpkg (push) Successful in 4m45s
Test / Sandbox (race detector) (push) Successful in 5m25s
Test / Hakurei (race detector) (push) Successful in 6m29s
Test / Flake checks (push) Successful in 1m35s
All checks were successful
Test / Create distribution (push) Successful in 1m6s
Test / Sandbox (push) Successful in 3m2s
Test / Hakurei (push) Successful in 4m14s
Test / ShareFS (push) Successful in 4m15s
Test / Hpkg (push) Successful in 4m45s
Test / Sandbox (race detector) (push) Successful in 5m25s
Test / Hakurei (race detector) (push) Successful in 6m29s
Test / Flake checks (push) Successful in 1m35s
This runs without tests for now. Will be fixed in a later commit. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
77
internal/rosa/go.go
Normal file
77
internal/rosa/go.go
Normal file
@@ -0,0 +1,77 @@
|
||||
package rosa
|
||||
|
||||
import (
|
||||
"slices"
|
||||
|
||||
"hakurei.app/internal/pkg"
|
||||
)
|
||||
|
||||
// newGoBootstrap returns the Go bootstrap toolchain.
|
||||
func (t Toolchain) newGoBootstrap() pkg.Artifact {
|
||||
const checksum = "8o9JL_ToiQKadCTb04nvBDkp8O1xiWOolAxVEqaTGodieNe4lOFEjlOxN3bwwe23"
|
||||
return t.New("go1.4-bootstrap", nil, nil, []string{
|
||||
"CGO_ENABLED=0",
|
||||
}, `
|
||||
mkdir -p /var/tmp
|
||||
cp -r /usr/src/go1.4-bootstrap /work
|
||||
cd /work/go1.4-bootstrap/src
|
||||
chmod -R +w ..
|
||||
CC="${CC} ${LDFLAGS}" sh make.bash
|
||||
`, pkg.Path(AbsUsrSrc.Append("go1.4-bootstrap"), false, pkg.NewHTTPGetTar(
|
||||
nil, "https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz",
|
||||
mustDecode(checksum),
|
||||
pkg.TarGzip,
|
||||
)))
|
||||
}
|
||||
|
||||
// newGo returns a specific version of the Go toolchain.
|
||||
func (t Toolchain) newGo(
|
||||
version, checksum string,
|
||||
boot pkg.Artifact,
|
||||
env ...string,
|
||||
) pkg.Artifact {
|
||||
return t.New("go"+version, []pkg.Artifact{
|
||||
boot,
|
||||
}, nil, slices.Concat([]string{
|
||||
"GOCACHE=/tmp/gocache",
|
||||
"GOROOT_BOOTSTRAP=/system/go",
|
||||
"CGO_" + ldflags(false) + " -O2 -g",
|
||||
}, env), `
|
||||
mkdir /work/system
|
||||
cp -r /usr/src/go /work/system
|
||||
cd /work/system/go/src
|
||||
chmod -R +w ..
|
||||
sed -i 's/bash run.bash/sh run.bash/' all.bash
|
||||
sh make.bash
|
||||
`, pkg.Path(AbsUsrSrc.Append("go"), false, pkg.NewHTTPGetTar(
|
||||
nil, "https://go.dev/dl/go"+version+".src.tar.gz",
|
||||
mustDecode(checksum),
|
||||
pkg.TarGzip,
|
||||
)))
|
||||
}
|
||||
|
||||
// NewGo returns a [pkg.Artifact] containing the Go toolchain.
|
||||
func (t Toolchain) NewGo() pkg.Artifact {
|
||||
go119 := t.newGo(
|
||||
"1.19",
|
||||
"9_e0aFHsIkVxWVGsp9T2RvvjOc3p4n9o9S8tkNe9Cvgzk_zI2FhRQB7ioQkeAAro",
|
||||
t.newGoBootstrap(),
|
||||
"GOROOT_BOOTSTRAP=/go1.4-bootstrap",
|
||||
)
|
||||
go121 := t.newGo(
|
||||
"1.21.13",
|
||||
"YtrDka402BOAEwywx03Vz4QlVwoBiguJHzG7PuythMCPHXS8CVMLvzmvgEbu4Tzu",
|
||||
go119,
|
||||
)
|
||||
go123 := t.newGo(
|
||||
"1.23.12",
|
||||
"wcI32bl1tkqbgcelGtGWPI4RtlEddd-PTd76Eb-k7nXA5LbE9yTNdIL9QSOOxMOs",
|
||||
go121,
|
||||
)
|
||||
go125 := t.newGo(
|
||||
"1.25.6",
|
||||
"x0z430qoDvQbbw_fftjW0rh_GSoh0VJhPzttWk_0hj9yz9AKOjuwRMupF_Q0dbt7",
|
||||
go123,
|
||||
)
|
||||
return go125
|
||||
}
|
||||
Reference in New Issue
Block a user