aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-04-14 00:35:06 +0900
committerOphestra <cat@gensokyo.uk>2026-04-14 00:35:42 +0900
commitac825640ab2d03d47101f36a81b9edab7204fced (patch)
treeeed62bc56c4dc05954a20a84116b426bf1c72a94
parenta7f7ce17959ccf36201338faeecdbf85d404fe7d (diff)
internal/rosa/llvm: migrate musl
This removes the pointless special treatment given to musl. Signed-off-by: Ophestra <cat@gensokyo.uk>
-rw-r--r--cmd/mbf/main.go14
-rw-r--r--internal/rosa/llvm.go30
-rw-r--r--internal/rosa/musl.go13
-rw-r--r--internal/rosa/rosa.go4
-rw-r--r--internal/rosa/stage0.go4
5 files changed, 32 insertions, 33 deletions
diff --git a/cmd/mbf/main.go b/cmd/mbf/main.go
index 96e00ef8..e593c33b 100644
--- a/cmd/mbf/main.go
+++ b/cmd/mbf/main.go
@@ -396,9 +396,9 @@ func main() {
rosa.SetGentooStage3(flagGentoo, checksum)
}
- _, _, stage1 := (t - 2).NewLLVM()
- _, _, stage2 := (t - 1).NewLLVM()
- _, _, stage3 := t.NewLLVM()
+ _, stage1 := (t - 2).NewLLVM()
+ _, stage2 := (t - 1).NewLLVM()
+ _, stage3 := t.NewLLVM()
var (
pathname *check.Absolute
checksum [2]unique.Handle[pkg.Checksum]
@@ -578,8 +578,12 @@ func main() {
if flagWithToolchain {
boot := rosa.Std - 1
- musl, runtimes, clang := boot.NewLLVM()
- root = append(root, musl, boot.Load(rosa.LLVMCompilerRT), runtimes, clang)
+ runtimes, clang := boot.NewLLVM()
+ root = append(root,
+ boot.Load(rosa.Musl),
+ boot.Load(rosa.LLVMCompilerRT),
+ runtimes, clang,
+ )
} else {
root = append(root, rosa.Std.Load(rosa.Musl))
}
diff --git a/internal/rosa/llvm.go b/internal/rosa/llvm.go
index d0498744..f1eb7981 100644
--- a/internal/rosa/llvm.go
+++ b/internal/rosa/llvm.go
@@ -69,10 +69,7 @@ func (t Toolchain) newLLVMVariant(variant string, attr *llvmAttr) pkg.Artifact {
}
func (t Toolchain) newCompilerRT() (pkg.Artifact, string) {
- muslHeaders, _ := t.newMusl(true, []string{
- "CC=clang",
- })
-
+ muslHeaders, _ := t.newMusl(true)
return t.newLLVMVariant("compiler-rt", &llvmAttr{
env: stage0ExclConcat(t, []string{},
"LDFLAGS="+earlyLDFLAGS(false),
@@ -128,7 +125,7 @@ func init() {
}
// newLLVM returns LLVM toolchain across multiple [pkg.Artifact].
-func (t Toolchain) newLLVM() (musl, runtimes, clang pkg.Artifact) {
+func (t Toolchain) newLLVM() (runtimes, clang pkg.Artifact) {
target := "'AArch64;RISCV;X86'"
if t.isStage0() {
switch runtime.GOARCH {
@@ -151,16 +148,7 @@ func (t Toolchain) newLLVM() (musl, runtimes, clang pkg.Artifact) {
}
compilerRT := t.Load(LLVMCompilerRT)
-
- musl, _ = t.newMusl(false, stage0ExclConcat(t, []string{
- "CC=clang",
- "LIBCC=/system/lib/clang/" + llvmVersionMajor + "/lib/" +
- triplet() + "/libclang_rt.builtins.a",
- "AR=ar",
- "RANLIB=ranlib",
- },
- "LDFLAGS="+earlyLDFLAGS(false),
- ), compilerRT)
+ musl := t.Load(Musl)
runtimes = t.newLLVMVariant("runtimes", &llvmAttr{
env: stage0ExclConcat(t, []string{},
@@ -242,7 +230,7 @@ ninja check-all
func init() {
artifactsM[LLVMRuntimes] = Metadata{
f: func(t Toolchain) (pkg.Artifact, string) {
- _, runtimes, _ := t.newLLVM()
+ runtimes, _ := t.newLLVM()
return runtimes, llvmVersion
},
@@ -253,7 +241,7 @@ func init() {
artifactsM[LLVMClang] = Metadata{
f: func(t Toolchain) (pkg.Artifact, string) {
- _, _, clang := t.newLLVM()
+ _, clang := t.newLLVM()
return clang, llvmVersion
},
@@ -288,15 +276,15 @@ func init() {
var (
// llvm stores the result of Toolchain.newLLVM.
- llvm [_toolchainEnd][3]pkg.Artifact
+ llvm [_toolchainEnd][2]pkg.Artifact
// llvmOnce is for lazy initialisation of llvm.
llvmOnce [_toolchainEnd]sync.Once
)
// NewLLVM returns LLVM toolchain across multiple [pkg.Artifact].
-func (t Toolchain) NewLLVM() (musl, runtimes, clang pkg.Artifact) {
+func (t Toolchain) NewLLVM() (runtimes, clang pkg.Artifact) {
llvmOnce[t].Do(func() {
- llvm[t][0], llvm[t][1], llvm[t][2] = t.newLLVM()
+ llvm[t][0], llvm[t][1] = t.newLLVM()
})
- return llvm[t][0], llvm[t][1], llvm[t][2]
+ return llvm[t][0], llvm[t][1]
}
diff --git a/internal/rosa/musl.go b/internal/rosa/musl.go
index f6ad8bb6..226cf8ca 100644
--- a/internal/rosa/musl.go
+++ b/internal/rosa/musl.go
@@ -4,7 +4,6 @@ import "hakurei.app/internal/pkg"
func (t Toolchain) newMusl(
headers bool,
- env []string,
extra ...pkg.Artifact,
) (pkg.Artifact, string) {
const (
@@ -47,7 +46,15 @@ rmdir -v /work/lib
// expected to be writable in copies
Chmod: true,
- Env: env,
+ Env: stage0ExclConcat(t, []string{
+ "CC=clang",
+ "LIBCC=/system/lib/clang/" + llvmVersionMajor + "/lib/" +
+ triplet() + "/libclang_rt.builtins.a",
+ "AR=ar",
+ "RANLIB=ranlib",
+ },
+ "LDFLAGS="+earlyLDFLAGS(false),
+ ),
}, &helper,
Coreutils,
), version
@@ -55,7 +62,7 @@ rmdir -v /work/lib
func init() {
artifactsM[Musl] = Metadata{
f: func(t Toolchain) (pkg.Artifact, string) {
- return t.newMusl(false, nil)
+ return t.newMusl(false, t.Load(LLVMCompilerRT))
},
Name: "musl",
diff --git a/internal/rosa/rosa.go b/internal/rosa/rosa.go
index 89f1c900..b2ae683b 100644
--- a/internal/rosa/rosa.go
+++ b/internal/rosa/rosa.go
@@ -329,12 +329,12 @@ mkdir -vp /work/system/bin
}
boot := t - 1
- musl, runtimes, clang := boot.NewLLVM()
+ runtimes, clang := boot.NewLLVM()
toybox := Toybox
if flag&TEarly != 0 {
toybox = toyboxEarly
}
- std := []pkg.Artifact{cureEtc{newIANAEtc()}, musl}
+ std := []pkg.Artifact{cureEtc{newIANAEtc()}, boot.Load(Musl)}
toolchain := []pkg.Artifact{boot.Load(LLVMCompilerRT), runtimes, clang}
utils := []pkg.Artifact{
boot.Load(Mksh),
diff --git a/internal/rosa/stage0.go b/internal/rosa/stage0.go
index ae5dc611..d147440e 100644
--- a/internal/rosa/stage0.go
+++ b/internal/rosa/stage0.go
@@ -7,9 +7,9 @@ import (
)
func (t Toolchain) newStage0() (pkg.Artifact, string) {
- musl, runtimes, clang := t.NewLLVM()
+ runtimes, clang := t.NewLLVM()
return t.New("rosa-stage0", 0, []pkg.Artifact{
- musl,
+ t.Load(Musl),
t.Load(LLVMCompilerRT),
runtimes,
clang,