internal/rosa/package: migrate toybox
All checks were successful
Test / Create distribution (push) Successful in 1m58s
Test / Sandbox (push) Successful in 5m6s
Test / ShareFS (push) Successful in 7m41s
Test / Sandbox (race detector) (push) Successful in 8m20s
Test / Hakurei (race detector) (push) Successful in 9m28s
Test / Hakurei (push) Successful in 2m43s
Test / Flake checks (push) Successful in 1m22s
All checks were successful
Test / Create distribution (push) Successful in 1m58s
Test / Sandbox (push) Successful in 5m6s
Test / ShareFS (push) Successful in 7m41s
Test / Sandbox (race detector) (push) Successful in 8m20s
Test / Hakurei (race detector) (push) Successful in 9m28s
Test / Hakurei (push) Successful in 2m43s
Test / Flake checks (push) Successful in 1m22s
Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -76,21 +76,9 @@ func (s *S) triple() string {
|
||||
return s.linuxArch() + "-rosa-linux-musl"
|
||||
}
|
||||
|
||||
// perArch is a value that differs per architecture.
|
||||
type perArch[T any] map[string]T
|
||||
|
||||
// unwrap returns the value for the current architecture.
|
||||
func (p perArch[T]) unwrap(s *S) T {
|
||||
v, ok := p[s.arch]
|
||||
if !ok {
|
||||
panic("unsupported target " + s.arch)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
const (
|
||||
// EnvTriplet holds the return value of triplet.
|
||||
EnvTriplet = "ROSA_TRIPLE"
|
||||
// EnvTriple holds the Rosa OS host triple.
|
||||
EnvTriple = "ROSA_TRIPLE"
|
||||
)
|
||||
|
||||
// earlyLDFLAGS returns LDFLAGS corresponding to triplet.
|
||||
@@ -225,16 +213,15 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
// stage0Dist is a binary distribution of an initial toolchain [Stage]. It
|
||||
// is used by [Toolchain.New] as stageEarly.
|
||||
stage0Dist = H("stage0-dist")
|
||||
|
||||
// The Mksh shell is added by [Toolchain.New] and used by almost all packages.
|
||||
Mksh = H("mksh")
|
||||
// Toybox is standard utilities added by [Toolchain.New].
|
||||
Toybox = H("toybox")
|
||||
// LLVM is the standard toolchain added by [Toolchain.New].
|
||||
LLVM = H("llvm")
|
||||
|
||||
_stage0Dist = H("stage0-dist")
|
||||
_toyboxEarly = H("toybox-early")
|
||||
)
|
||||
|
||||
// New returns a [pkg.Artifact] based on a [Toolchain] via s.
|
||||
@@ -262,7 +249,7 @@ func (t Toolchain) New(
|
||||
support = append(support, extra...)
|
||||
support = append(support, cureEtc{})
|
||||
if t.stage == stageEarly {
|
||||
_, a := t.MustLoad(stage0Dist)
|
||||
_, a := t.MustLoad(_stage0Dist)
|
||||
support = append(support, a)
|
||||
} else {
|
||||
support = append(support, t.S.New(_stageBusybox).New("gentoo", 0, nil, nil, nil, `
|
||||
@@ -282,7 +269,7 @@ mkdir -vp /work/system/bin
|
||||
)))
|
||||
}
|
||||
env = fixupEnviron(env, []string{
|
||||
EnvTriplet + "=" + t.triple(),
|
||||
EnvTriple + "=" + t.triple(),
|
||||
lcMessages,
|
||||
"LDFLAGS=" + t.earlyLDFLAGS(true),
|
||||
}, "/system/bin",
|
||||
@@ -297,7 +284,7 @@ mkdir -vp /work/system/bin
|
||||
|
||||
toybox := Toybox
|
||||
if flag&TEarly != 0 {
|
||||
toybox = toyboxEarly
|
||||
toybox = _toyboxEarly
|
||||
}
|
||||
|
||||
base := LLVM
|
||||
@@ -313,7 +300,7 @@ mkdir -vp /work/system/bin
|
||||
toybox,
|
||||
))
|
||||
env = fixupEnviron(env, []string{
|
||||
EnvTriplet + "=" + t.triple(),
|
||||
EnvTriple + "=" + t.triple(),
|
||||
lcMessages,
|
||||
}, "/system/bin", "/bin")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user