internal/rosa/llvm: centralise llvm source
All checks were successful
Test / Create distribution (push) Successful in 2m25s
Test / Sandbox (push) Successful in 4m36s
Test / ShareFS (push) Successful in 6m11s
Test / Sandbox (race detector) (push) Successful in 7m20s
Test / Hakurei (race detector) (push) Successful in 11m45s
Test / Hakurei (push) Successful in 4m5s
Test / Flake checks (push) Successful in 1m41s

This avoids having to sidestep the NewPackage name formatting machinery to take the cache fast path.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-04-14 03:01:50 +09:00
parent 5b5b676132
commit 78f9676b1f
2 changed files with 22 additions and 16 deletions

View File

@@ -167,7 +167,8 @@ const (
// PresetUnexportedStart is the first unexported preset. // PresetUnexportedStart is the first unexported preset.
PresetUnexportedStart PresetUnexportedStart
buildcatrust = iota - 1 llvmSource = iota - 1
buildcatrust
utilMacros utilMacros
// Musl is a standalone libc that does not depend on the toolchain. // Musl is a standalone libc that does not depend on the toolchain.

View File

@@ -6,17 +6,26 @@ import (
"hakurei.app/internal/pkg" "hakurei.app/internal/pkg"
) )
// llvmSource is the unpatched upstream LLVM monorepo. func init() {
var llvmSource = newFromGitHub( artifactsM[llvmSource] = Metadata{
f: func(t Toolchain) (pkg.Artifact, string) {
return t.NewPatchedSource("llvm", llvmVersion, newFromGitHub(
"llvm/llvm-project", "llvm/llvm-project",
"llvmorg-"+llvmVersion, "llvmorg-"+llvmVersion,
llvmChecksum, llvmChecksum,
) ), true, llvmPatches...), llvmVersion
},
Name: "llvm-project",
Description: "LLVM monorepo with Rosa OS patches",
ID: 1830,
}
}
func (t Toolchain) newCompilerRT() (pkg.Artifact, string) { func (t Toolchain) newCompilerRT() (pkg.Artifact, string) {
muslHeaders, _ := t.newMusl(true) muslHeaders, _ := t.newMusl(true)
return t.NewPackage("compiler-rt", llvmVersion, llvmSource, &PackageAttr{ return t.NewPackage("compiler-rt", llvmVersion, t.Load(llvmSource), &PackageAttr{
Patches: llvmPatches,
NonStage0: []pkg.Artifact{ NonStage0: []pkg.Artifact{
muslHeaders, muslHeaders,
}, },
@@ -82,8 +91,7 @@ func init() {
} }
func (t Toolchain) newLLVMRuntimes() (pkg.Artifact, string) { func (t Toolchain) newLLVMRuntimes() (pkg.Artifact, string) {
return t.NewPackage("llvm-runtimes", llvmVersion, llvmSource, &PackageAttr{ return t.NewPackage("llvm-runtimes", llvmVersion, t.Load(llvmSource), &PackageAttr{
Patches: llvmPatches,
NonStage0: t.AppendPresets(nil, CompilerRT), NonStage0: t.AppendPresets(nil, CompilerRT),
Env: stage0ExclConcat(t, []string{}, Env: stage0ExclConcat(t, []string{},
"LDFLAGS="+earlyLDFLAGS(false), "LDFLAGS="+earlyLDFLAGS(false),
@@ -151,8 +159,7 @@ func (t Toolchain) newClang() (pkg.Artifact, string) {
} }
} }
return t.NewPackage("clang", llvmVersion, llvmSource, &PackageAttr{ return t.NewPackage("clang", llvmVersion, t.Load(llvmSource), &PackageAttr{
Patches: llvmPatches,
NonStage0: t.AppendPresets(nil, LLVMRuntimes), NonStage0: t.AppendPresets(nil, LLVMRuntimes),
Env: stage0ExclConcat(t, []string{}, Env: stage0ExclConcat(t, []string{},
"CFLAGS="+earlyCFLAGS, "CFLAGS="+earlyCFLAGS,
@@ -222,13 +229,11 @@ func init() {
Dependencies: P{ Dependencies: P{
LLVMRuntimes, LLVMRuntimes,
}, },
ID: 1830,
} }
} }
func (t Toolchain) newLibclc() (pkg.Artifact, string) { func (t Toolchain) newLibclc() (pkg.Artifact, string) {
return t.NewPackage("libclc", llvmVersion, llvmSource, nil, &CMakeHelper{ return t.NewPackage("libclc", llvmVersion, t.Load(llvmSource), nil, &CMakeHelper{
Append: []string{"libclc"}, Append: []string{"libclc"},
Cache: []KV{ Cache: []KV{