forked from rosa/hakurei
internal/rosa: key metadata by string
For upcoming azalea integration. The API is quite ugly right now to ease migration. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -7,9 +7,9 @@ import (
|
||||
)
|
||||
|
||||
// newGoBootstrap returns the Go bootstrap toolchain.
|
||||
func (t Toolchain) newGoBootstrap() pkg.Artifact {
|
||||
func (s *S) newGoBootstrap(t Toolchain) pkg.Artifact {
|
||||
const checksum = "8o9JL_ToiQKadCTb04nvBDkp8O1xiWOolAxVEqaTGodieNe4lOFEjlOxN3bwwe23"
|
||||
return t.New("go1.4-bootstrap", 0, t.AppendPresets(nil,
|
||||
return s.New(t, "go1.4-bootstrap", 0, s.AppendPresets(t, nil,
|
||||
Bash,
|
||||
), nil, []string{
|
||||
"CGO_ENABLED=0",
|
||||
@@ -28,17 +28,18 @@ chmod -R +w ..
|
||||
}
|
||||
|
||||
// newGo returns a specific version of the Go toolchain.
|
||||
func (t Toolchain) newGo(
|
||||
func (s *S) newGo(
|
||||
t Toolchain,
|
||||
version, checksum string,
|
||||
env []string,
|
||||
script string,
|
||||
extra ...pkg.Artifact,
|
||||
) pkg.Artifact {
|
||||
name := "all"
|
||||
if presetOpts&OptSkipCheck != 0 {
|
||||
if s.opts&OptSkipCheck != 0 {
|
||||
name = "make"
|
||||
}
|
||||
return t.New("go"+version, 0, t.AppendPresets(extra,
|
||||
return s.New(t, "go"+version, 0, s.AppendPresets(t, extra,
|
||||
Bash,
|
||||
), nil, slices.Concat([]string{
|
||||
"CC=cc",
|
||||
@@ -65,27 +66,27 @@ ln -s \
|
||||
)))
|
||||
}
|
||||
|
||||
func (t Toolchain) newGoLatest() (pkg.Artifact, string) {
|
||||
func (t Toolchain) newGoLatest(s *S) (pkg.Artifact, string) {
|
||||
var (
|
||||
bootstrapEnv []string
|
||||
bootstrapExtra []pkg.Artifact
|
||||
|
||||
finalEnv []string
|
||||
)
|
||||
switch arch {
|
||||
switch s.arch {
|
||||
case "amd64":
|
||||
bootstrapExtra = append(bootstrapExtra, t.newGoBootstrap())
|
||||
bootstrapExtra = append(bootstrapExtra, s.newGoBootstrap(t))
|
||||
|
||||
case "arm64", "riscv64":
|
||||
bootstrapEnv = append(bootstrapEnv, "GOROOT_BOOTSTRAP=/system")
|
||||
bootstrapExtra = t.AppendPresets(bootstrapExtra, gcc)
|
||||
bootstrapExtra = s.AppendPresets(t, bootstrapExtra, gcc)
|
||||
finalEnv = append(finalEnv, "CGO_ENABLED=0")
|
||||
|
||||
default:
|
||||
panic("unsupported target " + arch)
|
||||
panic("unsupported target " + s.arch)
|
||||
}
|
||||
|
||||
go119 := t.newGo(
|
||||
go119 := s.newGo(t,
|
||||
"1.19",
|
||||
"9_e0aFHsIkVxWVGsp9T2RvvjOc3p4n9o9S8tkNe9Cvgzk_zI2FhRQB7ioQkeAAro",
|
||||
append(bootstrapEnv, "CGO_ENABLED=0"), `
|
||||
@@ -101,13 +102,13 @@ echo \
|
||||
os/rawconn_test.go
|
||||
`, bootstrapExtra...)
|
||||
|
||||
go121 := t.newGo(
|
||||
go121 := s.newGo(t,
|
||||
"1.21.13",
|
||||
"YtrDka402BOAEwywx03Vz4QlVwoBiguJHzG7PuythMCPHXS8CVMLvzmvgEbu4Tzu",
|
||||
[]string{"CGO_ENABLED=0"}, `
|
||||
sed -i \
|
||||
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
|
||||
cmd/link/internal/`+arch+`/obj.go
|
||||
's,/lib/ld-musl-`+s.linuxArch()+`.so.1,/system/bin/linker,' \
|
||||
cmd/link/internal/`+s.arch+`/obj.go
|
||||
|
||||
rm \
|
||||
crypto/tls/handshake_client_test.go \
|
||||
@@ -119,23 +120,23 @@ echo \
|
||||
`, go119,
|
||||
)
|
||||
|
||||
go123 := t.newGo(
|
||||
go123 := s.newGo(t,
|
||||
"1.23.12",
|
||||
"wcI32bl1tkqbgcelGtGWPI4RtlEddd-PTd76Eb-k7nXA5LbE9yTNdIL9QSOOxMOs",
|
||||
[]string{"CGO_ENABLED=0"}, `
|
||||
sed -i \
|
||||
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
|
||||
cmd/link/internal/`+arch+`/obj.go
|
||||
's,/lib/ld-musl-`+s.linuxArch()+`.so.1,/system/bin/linker,' \
|
||||
cmd/link/internal/`+s.arch+`/obj.go
|
||||
`, go121,
|
||||
)
|
||||
|
||||
go125 := t.newGo(
|
||||
go125 := s.newGo(t,
|
||||
"1.25.10",
|
||||
"TwKwatkpwal-j9U2sDSRPEdM3YesI4Gm88YgGV59wtU-L85K9gA7UPy9SCxn6PMb",
|
||||
[]string{"CGO_ENABLED=0"}, `
|
||||
sed -i \
|
||||
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
|
||||
cmd/link/internal/`+arch+`/obj.go
|
||||
's,/lib/ld-musl-`+s.linuxArch()+`.so.1,/system/bin/linker,' \
|
||||
cmd/link/internal/`+s.arch+`/obj.go
|
||||
|
||||
rm \
|
||||
os/root_unix_test.go \
|
||||
@@ -147,13 +148,13 @@ rm \
|
||||
version = "1.26.3"
|
||||
checksum = "lEiFocZFnN5fKvZzmwVdqc9pYUjAuhzqZGbuiOqxUP4XdcY8yECisKcqsQ_eNn1N"
|
||||
)
|
||||
return t.newGo(
|
||||
return s.newGo(t,
|
||||
version,
|
||||
checksum,
|
||||
finalEnv, `
|
||||
sed -i \
|
||||
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
|
||||
cmd/link/internal/`+arch+`/obj.go
|
||||
's,/lib/ld-musl-`+s.linuxArch()+`.so.1,/system/bin/linker,' \
|
||||
cmd/link/internal/`+s.arch+`/obj.go
|
||||
sed -i \
|
||||
's/cpu.X86.HasAVX512VBMI/& \&\& cpu.X86.HasPOPCNT/' \
|
||||
internal/runtime/gc/scan/scan_amd64.go
|
||||
@@ -166,7 +167,7 @@ rm \
|
||||
), version
|
||||
}
|
||||
func init() {
|
||||
artifactsM[Go] = Metadata{
|
||||
native.MustRegister(&Artifact{
|
||||
f: Toolchain.newGoLatest,
|
||||
|
||||
Name: "go",
|
||||
@@ -174,5 +175,5 @@ func init() {
|
||||
Website: "https://go.dev/",
|
||||
|
||||
ID: 1227,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user