internal/rosa: rename stage0 toolchain
All checks were successful
Test / Create distribution (push) Successful in 1m2s
Test / Sandbox (push) Successful in 1m48s
Test / Sandbox (race detector) (push) Successful in 2m52s
Test / Hakurei (push) Successful in 3m1s
Test / ShareFS (push) Successful in 3m16s
Test / Hakurei (race detector) (push) Successful in 3m58s
Test / Hpkg (push) Successful in 3m57s
Test / Flake checks (push) Successful in 1m48s

This is stage0 relative to Rosa OS, and stage3 relative to the toolchain it is compiled on (Gentoo in this case). Referring to the toolchain itself as stage3 is counterintuitive and misleading.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-02-09 00:50:38 +09:00
parent 3d3bd45b95
commit e1b8607101
7 changed files with 34 additions and 34 deletions

View File

@@ -97,7 +97,7 @@ func (t Toolchain) NewViaCMake(
} }
sourcePath := AbsUsrSrc.Append(name) sourcePath := AbsUsrSrc.Append(name)
return t.New(name+"-"+variant+"-"+version, attr.Flag, stage3Concat(t, extra, return t.New(name+"-"+variant+"-"+version, attr.Flag, stage0Concat(t, extra,
t.Load(CMake), t.Load(CMake),
t.Load(Ninja), t.Load(Ninja),
), nil, slices.Concat([]string{ ), nil, slices.Concat([]string{

View File

@@ -160,7 +160,7 @@ ln -s ld.lld /work/system/bin/ld
[2]string{"LIBCXX_USE_COMPILER_RT", "ON"}, [2]string{"LIBCXX_USE_COMPILER_RT", "ON"},
) )
if t > toolchainStage3 { if t > toolchainStage0 {
// libcxxabi fails to compile if c++ headers not prefixed in /usr // libcxxabi fails to compile if c++ headers not prefixed in /usr
// is found by the compiler, and doing this is easier than // is found by the compiler, and doing this is easier than
// overriding CXXFLAGS; not using mv here to avoid chown failures // overriding CXXFLAGS; not using mv here to avoid chown failures
@@ -199,7 +199,7 @@ cp -r /system/include /usr/include && rm -rf /system/include
Paths: attr.paths, Paths: attr.paths,
Flag: TExclusive, Flag: TExclusive,
}, stage3Concat(t, attr.extra, }, stage0Concat(t, attr.extra,
t.Load(Libffi), t.Load(Libffi),
t.Load(Python), t.Load(Python),
t.Load(Perl), t.Load(Perl),
@@ -233,7 +233,7 @@ func (t Toolchain) newLLVM() (musl, compilerRT, runtimes, clang pkg.Artifact) {
} }
compilerRT = t.newLLVMVariant("compiler-rt", &llvmAttr{ compilerRT = t.newLLVMVariant("compiler-rt", &llvmAttr{
env: stage3ExclConcat(t, []string{}, env: stage0ExclConcat(t, []string{},
"LDFLAGS="+earlyLDFLAGS(false), "LDFLAGS="+earlyLDFLAGS(false),
), ),
cmake: [][2]string{ cmake: [][2]string{
@@ -276,7 +276,7 @@ ln -s \
musl = t.NewMusl(&MuslAttr{ musl = t.NewMusl(&MuslAttr{
Extra: []pkg.Artifact{compilerRT}, Extra: []pkg.Artifact{compilerRT},
Env: stage3ExclConcat(t, []string{ Env: stage0ExclConcat(t, []string{
"CC=clang", "CC=clang",
"LIBCC=/system/lib/clang/21/lib/" + "LIBCC=/system/lib/clang/21/lib/" +
triplet() + "/libclang_rt.builtins.a", triplet() + "/libclang_rt.builtins.a",
@@ -288,7 +288,7 @@ ln -s \
}) })
runtimes = t.newLLVMVariant("runtimes", &llvmAttr{ runtimes = t.newLLVMVariant("runtimes", &llvmAttr{
env: stage3ExclConcat(t, []string{}, env: stage0ExclConcat(t, []string{},
"LDFLAGS="+earlyLDFLAGS(false), "LDFLAGS="+earlyLDFLAGS(false),
), ),
flags: llvmRuntimeLibunwind | llvmRuntimeLibcxx | llvmRuntimeLibcxxABI, flags: llvmRuntimeLibunwind | llvmRuntimeLibcxx | llvmRuntimeLibcxxABI,
@@ -308,7 +308,7 @@ ln -s \
clang = t.newLLVMVariant("clang", &llvmAttr{ clang = t.newLLVMVariant("clang", &llvmAttr{
flags: llvmProjectClang | llvmProjectLld, flags: llvmProjectClang | llvmProjectLld,
env: stage3ExclConcat(t, []string{}, env: stage0ExclConcat(t, []string{},
"CFLAGS="+earlyCFLAGS, "CFLAGS="+earlyCFLAGS,
"CXXFLAGS="+earlyCXXFLAGS(), "CXXFLAGS="+earlyCXXFLAGS(),
"LDFLAGS="+earlyLDFLAGS(false), "LDFLAGS="+earlyLDFLAGS(false),

View File

@@ -36,8 +36,8 @@ type MakeAttr struct {
// Do not include default extras. // Do not include default extras.
OmitDefaults bool OmitDefaults bool
// Dependencies not provided by stage3. // Dependencies not provided by stage0.
NonStage3 []pkg.Artifact NonStage0 []pkg.Artifact
// Additional environment variables. // Additional environment variables.
Env []string Env []string
@@ -148,8 +148,8 @@ func (t Toolchain) NewViaMake(
panic("cannot remain in root") panic("cannot remain in root")
} }
return t.New(name+"-"+version, attr.Flag, stage3Concat(t, return t.New(name+"-"+version, attr.Flag, stage0Concat(t,
attr.NonStage3, attr.NonStage0,
finalExtra..., finalExtra...,
), nil, attr.Env, scriptEarly+` ), nil, attr.Env, scriptEarly+`
/usr/src/`+name+`/configure \ /usr/src/`+name+`/configure \

View File

@@ -7,7 +7,7 @@ func (t Toolchain) newMksh() pkg.Artifact {
version = "59c" version = "59c"
checksum = "0Zj-k4nXEu3IuJY4lvwD2OrC2t27GdZj8SPy4DoaeuBRH1padWb7oREpYgwY8JNq" checksum = "0Zj-k4nXEu3IuJY4lvwD2OrC2t27GdZj8SPy4DoaeuBRH1padWb7oREpYgwY8JNq"
) )
return t.New("mksh-"+version, 0, stage3Concat(t, []pkg.Artifact{}, return t.New("mksh-"+version, 0, stage0Concat(t, []pkg.Artifact{},
t.Load(Perl), t.Load(Perl),
t.Load(Coreutils), t.Load(Coreutils),
), nil, []string{ ), nil, []string{

View File

@@ -42,7 +42,7 @@ rmdir -v /work/lib
script = "" script = ""
} }
return t.New("musl-"+version, 0, stage3Concat(t, attr.Extra, return t.New("musl-"+version, 0, stage0Concat(t, attr.Extra,
t.Load(Make), t.Load(Make),
t.Load(Coreutils), t.Load(Coreutils),
), nil, slices.Concat([]string{ ), nil, slices.Concat([]string{

View File

@@ -82,11 +82,11 @@ func earlyLDFLAGS(static bool) string {
return s return s
} }
// earlyCFLAGS is reference CFLAGS for the stage3 toolchain. // earlyCFLAGS is reference CFLAGS for the stage0 toolchain.
const earlyCFLAGS = "-Qunused-arguments " + const earlyCFLAGS = "-Qunused-arguments " +
"-isystem/system/include" "-isystem/system/include"
// earlyCXXFLAGS returns reference CXXFLAGS for the stage3 toolchain // earlyCXXFLAGS returns reference CXXFLAGS for the stage0 toolchain
// corresponding to [runtime.GOARCH]. // corresponding to [runtime.GOARCH].
func earlyCXXFLAGS() string { func earlyCXXFLAGS() string {
return "--start-no-unused-arguments " + return "--start-no-unused-arguments " +
@@ -105,12 +105,12 @@ const (
// binary distribution. This is for decompressing unsupported formats. // binary distribution. This is for decompressing unsupported formats.
toolchainBusybox Toolchain = iota toolchainBusybox Toolchain = iota
// toolchainStage3 denotes the Gentoo stage3 toolchain. Special care must be // toolchainStage0 denotes the stage0 toolchain. Special care must be taken
// taken to compile correctly against this toolchain. // to compile correctly against this toolchain.
toolchainStage3 toolchainStage0
// toolchainIntermediate denotes the intermediate toolchain compiled against // toolchainIntermediate denotes the intermediate toolchain compiled against
// toolchainStage3. This toolchain should be functionally identical to [Std] // toolchainStage0. This toolchain should be functionally identical to [Std]
// and is used to bootstrap [Std]. // and is used to bootstrap [Std].
toolchainIntermediate toolchainIntermediate
@@ -122,19 +122,19 @@ const (
_toolchainEnd _toolchainEnd
) )
// stage3Concat concatenates s and values. If the current toolchain is // stage0Concat concatenates s and values. If the current toolchain is
// toolchainStage3, stage3Concat returns s as is. // toolchainStage0, stage0Concat returns s as is.
func stage3Concat[S ~[]E, E any](t Toolchain, s S, values ...E) S { func stage0Concat[S ~[]E, E any](t Toolchain, s S, values ...E) S {
if t == toolchainStage3 { if t == toolchainStage0 {
return s return s
} }
return slices.Concat(s, values) return slices.Concat(s, values)
} }
// stage3ExclConcat concatenates s and values. If the current toolchain is not // stage0ExclConcat concatenates s and values. If the current toolchain is not
// toolchainStage3, stage3ExclConcat returns s as is. // toolchainStage0, stage0ExclConcat returns s as is.
func stage3ExclConcat[S ~[]E, E any](t Toolchain, s S, values ...E) S { func stage0ExclConcat[S ~[]E, E any](t Toolchain, s S, values ...E) S {
if t == toolchainStage3 { if t == toolchainStage0 {
return slices.Concat(s, values) return slices.Concat(s, values)
} }
return s return s
@@ -208,7 +208,7 @@ func (t Toolchain) New(
args[0] = "hush" args[0] = "hush"
env = fixupEnviron(env, nil, "/system/bin") env = fixupEnviron(env, nil, "/system/bin")
case toolchainStage3: case toolchainStage0:
name += "-boot" name += "-boot"
var seed string var seed string
switch runtime.GOARCH { switch runtime.GOARCH {
@@ -224,11 +224,11 @@ func (t Toolchain) New(
args[0] = "bash" args[0] = "bash"
support = slices.Concat([]pkg.Artifact{ support = slices.Concat([]pkg.Artifact{
cureEtc{}, cureEtc{},
toolchainBusybox.New("stage3", 0, nil, nil, nil, ` toolchainBusybox.New("stage0", 0, nil, nil, nil, `
tar -C /work -xf /usr/src/stage3.tar.xz tar -C /work -xf /usr/src/stage0.tar.xz
rm -rf /work/dev/ /work/proc/ rm -rf /work/dev/ /work/proc/
ln -vs ../usr/bin /work/bin ln -vs ../usr/bin /work/bin
`, pkg.Path(AbsUsrSrc.Append("stage3.tar.xz"), false, `, pkg.Path(AbsUsrSrc.Append("stage0.tar.xz"), false,
pkg.NewHTTPGet( pkg.NewHTTPGet(
nil, "https://basement.gensokyo.uk/seed/"+seed, nil, "https://basement.gensokyo.uk/seed/"+seed,
mustDecode(seed), mustDecode(seed),
@@ -328,7 +328,7 @@ cat /usr/src/` + name + `-patches/* | \
` `
aname += "-patched" aname += "-patched"
} }
return t.New(aname, 0, stage3Concat(t, []pkg.Artifact{}, return t.New(aname, 0, stage0Concat(t, []pkg.Artifact{},
t.Load(Patch), t.Load(Patch),
), nil, nil, script, paths...) ), nil, nil, script, paths...)
} }

View File

@@ -7,13 +7,13 @@ func (t Toolchain) newToybox(suffix, script string) pkg.Artifact {
version = "0.8.13" version = "0.8.13"
checksum = "rZ1V1ATDte2WeQZanxLVoiRGdfPXhMlEo5-exX-e-ml8cGn9qOv0ABEUVZpX3wTI" checksum = "rZ1V1ATDte2WeQZanxLVoiRGdfPXhMlEo5-exX-e-ml8cGn9qOv0ABEUVZpX3wTI"
) )
return t.New("toybox-"+version+suffix, TEarly, stage3Concat(t, []pkg.Artifact{}, return t.New("toybox-"+version+suffix, TEarly, stage0Concat(t, []pkg.Artifact{},
t.Load(Make), t.Load(Make),
t.Load(Bash), t.Load(Bash),
t.Load(Gzip), t.Load(Gzip),
t.Load(KernelHeaders), t.Load(KernelHeaders),
), nil, stage3Concat(t, []string{}, ), nil, stage0Concat(t, []string{},
"ROSA_CHECK=make USER=cure tests", "ROSA_CHECK=make USER=cure tests",
), ` ), `
ln -s ../system/bin/bash /bin/ || true ln -s ../system/bin/bash /bin/ || true