internal/rosa: configurable architecture
All checks were successful
Test / Create distribution (push) Successful in 1m21s
Test / Sandbox (push) Successful in 3m23s
Test / ShareFS (push) Successful in 4m48s
Test / Hakurei (push) Successful in 4m57s
Test / Sandbox (race detector) (push) Successful in 6m18s
Test / Hakurei (race detector) (push) Successful in 7m17s
Test / Flake checks (push) Successful in 1m22s
All checks were successful
Test / Create distribution (push) Successful in 1m21s
Test / Sandbox (push) Successful in 3m23s
Test / ShareFS (push) Successful in 4m48s
Test / Hakurei (push) Successful in 4m57s
Test / Sandbox (race detector) (push) Successful in 6m18s
Test / Hakurei (race detector) (push) Successful in 7m17s
Test / Flake checks (push) Successful in 1m22s
This enables curing via binfmt. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"hakurei.app/fhs"
|
||||
@@ -88,7 +87,7 @@ func (a busyboxBin) Cure(t *pkg.TContext) (err error) {
|
||||
// the https://busybox.net/downloads/binaries/ binary release.
|
||||
func newBusyboxBin() pkg.Artifact {
|
||||
var version, url, checksum string
|
||||
switch runtime.GOARCH {
|
||||
switch arch {
|
||||
case "amd64":
|
||||
version = "1.35.0"
|
||||
url = "https://busybox.net/downloads/binaries/" +
|
||||
@@ -101,7 +100,7 @@ func newBusyboxBin() pkg.Artifact {
|
||||
checksum = "npJjBO7iwhjW6Kx2aXeSxf8kXhVgTCDChOZTTsI8ZfFfa3tbsklxRiidZQdrVERg"
|
||||
|
||||
default:
|
||||
panic("unsupported target " + runtime.GOARCH)
|
||||
panic("unsupported target " + arch)
|
||||
}
|
||||
|
||||
return pkg.NewExec(
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package rosa
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -843,7 +842,7 @@ func (t Toolchain) newGnuTLS() (pkg.Artifact, string) {
|
||||
)
|
||||
|
||||
var configureExtra []KV
|
||||
switch runtime.GOARCH {
|
||||
switch arch {
|
||||
case "arm64":
|
||||
configureExtra = []KV{
|
||||
{"disable-hardware-acceleration"},
|
||||
@@ -1148,7 +1147,7 @@ func (t Toolchain) newGCC() (pkg.Artifact, string) {
|
||||
)
|
||||
|
||||
var configureExtra []KV
|
||||
switch runtime.GOARCH {
|
||||
switch arch {
|
||||
case "amd64", "arm64":
|
||||
configureExtra = append(configureExtra, KV{"with-multilib-list", "''"})
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package rosa
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"slices"
|
||||
|
||||
"hakurei.app/internal/pkg"
|
||||
@@ -69,7 +68,7 @@ func (t Toolchain) newGoLatest() (pkg.Artifact, string) {
|
||||
|
||||
finalEnv []string
|
||||
)
|
||||
switch runtime.GOARCH {
|
||||
switch arch {
|
||||
case "amd64":
|
||||
bootstrapExtra = append(bootstrapExtra, t.newGoBootstrap())
|
||||
|
||||
@@ -79,7 +78,7 @@ func (t Toolchain) newGoLatest() (pkg.Artifact, string) {
|
||||
finalEnv = append(finalEnv, "CGO_ENABLED=0")
|
||||
|
||||
default:
|
||||
panic("unsupported target " + runtime.GOARCH)
|
||||
panic("unsupported target " + arch)
|
||||
}
|
||||
|
||||
go119 := t.newGo(
|
||||
@@ -104,7 +103,7 @@ echo \
|
||||
[]string{"CGO_ENABLED=0"}, `
|
||||
sed -i \
|
||||
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
|
||||
cmd/link/internal/`+runtime.GOARCH+`/obj.go
|
||||
cmd/link/internal/`+arch+`/obj.go
|
||||
|
||||
rm \
|
||||
crypto/tls/handshake_client_test.go \
|
||||
@@ -122,7 +121,7 @@ echo \
|
||||
[]string{"CGO_ENABLED=0"}, `
|
||||
sed -i \
|
||||
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
|
||||
cmd/link/internal/`+runtime.GOARCH+`/obj.go
|
||||
cmd/link/internal/`+arch+`/obj.go
|
||||
`, go121,
|
||||
)
|
||||
|
||||
@@ -132,7 +131,7 @@ sed -i \
|
||||
[]string{"CGO_ENABLED=0"}, `
|
||||
sed -i \
|
||||
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
|
||||
cmd/link/internal/`+runtime.GOARCH+`/obj.go
|
||||
cmd/link/internal/`+arch+`/obj.go
|
||||
|
||||
rm \
|
||||
os/root_unix_test.go \
|
||||
@@ -150,7 +149,7 @@ rm \
|
||||
finalEnv, `
|
||||
sed -i \
|
||||
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
|
||||
cmd/link/internal/`+runtime.GOARCH+`/obj.go
|
||||
cmd/link/internal/`+arch+`/obj.go
|
||||
sed -i \
|
||||
's/cpu.X86.HasAVX512VBMI/& \&\& cpu.X86.HasPOPCNT/' \
|
||||
internal/runtime/gc/scan/scan_amd64.go
|
||||
|
||||
@@ -2,7 +2,6 @@ package rosa
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"runtime"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
@@ -248,7 +247,7 @@ func (t Toolchain) newLLVM() (pkg.Artifact, string) {
|
||||
// unwind: fails on musl
|
||||
"eh_frame_fde_pc_range",
|
||||
}
|
||||
switch runtime.GOARCH {
|
||||
switch arch {
|
||||
case "arm64":
|
||||
skipChecks = append(skipChecks,
|
||||
// LLVM: intermittently crashes
|
||||
|
||||
@@ -4,7 +4,6 @@ package rosa
|
||||
import (
|
||||
"errors"
|
||||
"path"
|
||||
"runtime"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -54,10 +53,9 @@ var (
|
||||
AbsSystem = fhs.AbsRoot.Append("system")
|
||||
)
|
||||
|
||||
// linuxArch returns the architecture name used by linux corresponding to
|
||||
// [runtime.GOARCH].
|
||||
// linuxArch returns the architecture name used by linux corresponding to arch.
|
||||
func linuxArch() string {
|
||||
switch runtime.GOARCH {
|
||||
switch arch {
|
||||
case "amd64":
|
||||
return "x86_64"
|
||||
case "arm64":
|
||||
@@ -66,11 +64,11 @@ func linuxArch() string {
|
||||
return "riscv64"
|
||||
|
||||
default:
|
||||
panic("unsupported target " + runtime.GOARCH)
|
||||
panic("unsupported target " + arch)
|
||||
}
|
||||
}
|
||||
|
||||
// triplet returns the Rosa OS host triple corresponding to [runtime.GOARCH].
|
||||
// triplet returns the Rosa OS host triple corresponding to arch.
|
||||
func triplet() string {
|
||||
return linuxArch() + "-rosa-linux-musl"
|
||||
}
|
||||
@@ -80,9 +78,9 @@ type perArch[T any] map[string]T
|
||||
|
||||
// unwrap returns the value for the current architecture.
|
||||
func (p perArch[T]) unwrap() T {
|
||||
v, ok := p[runtime.GOARCH]
|
||||
v, ok := p[arch]
|
||||
if !ok {
|
||||
panic("unsupported target " + runtime.GOARCH)
|
||||
panic("unsupported target " + arch)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
package rosa
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
|
||||
"hakurei.app/internal/pkg"
|
||||
)
|
||||
import "hakurei.app/internal/pkg"
|
||||
|
||||
func (t Toolchain) newTamaGo() (pkg.Artifact, string) {
|
||||
const (
|
||||
@@ -26,7 +22,7 @@ chmod -R +w ..
|
||||
|
||||
sed -i \
|
||||
's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
|
||||
cmd/link/internal/`+runtime.GOARCH+`/obj.go
|
||||
cmd/link/internal/`+arch+`/obj.go
|
||||
sed -i \
|
||||
's/cpu.X86.HasAVX512VBMI/& \&\& cpu.X86.HasPOPCNT/' \
|
||||
internal/runtime/gc/scan/scan_amd64.go
|
||||
|
||||
Reference in New Issue
Block a user