diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-05-21 18:08:00 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-05-21 18:10:02 +0900 |
| commit | af4c3bbff2d4ef012db945963680f8f764e592ae (patch) | |
| tree | 2ac36029a7f9ae35fde6177ca8b089f9d0047e42 /internal/rosa/rosa.go | |
| parent | 54aae9d72a12ae8af93ba35d00a3817e3105dcce (diff) | |
internal/rosa/package: migrate toybox
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/rosa.go')
| -rw-r--r-- | internal/rosa/rosa.go | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/internal/rosa/rosa.go b/internal/rosa/rosa.go index b83b7d07..d3ee5f03 100644 --- a/internal/rosa/rosa.go +++ b/internal/rosa/rosa.go @@ -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") |
