forked from rosa/hakurei
internal/rosa: pass stage alongside state
This cleans up many function signatures. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -29,10 +29,10 @@ func litArgs(verbose bool, skipChecks ...string) string {
|
||||
return "'" + strings.Join(args, " ") + "'"
|
||||
}
|
||||
|
||||
func (t Toolchain) newEarlyCompilerRT(s *S) (pkg.Artifact, string) {
|
||||
source, version := s.Load(t, llvmSource)
|
||||
func (t Toolchain) newEarlyCompilerRT() (pkg.Artifact, string) {
|
||||
source, version := t.Load(llvmSource)
|
||||
major, _, _ := strings.Cut(version, ".")
|
||||
return s.NewPackage(t, "early-compiler-rt", version, source, &PackageAttr{
|
||||
return t.NewPackage("early-compiler-rt", version, source, &PackageAttr{
|
||||
Flag: TExclusive,
|
||||
}, &CMakeHelper{
|
||||
Append: []string{"compiler-rt"},
|
||||
@@ -71,10 +71,10 @@ ln -s \
|
||||
"/work/system/lib/clang/` + major + `/lib/"
|
||||
|
||||
ln -s \
|
||||
"clang_rt.crtbegin-` + s.linuxArch() + `.o" \
|
||||
"clang_rt.crtbegin-` + t.linuxArch() + `.o" \
|
||||
"/work/system/lib/${ROSA_TRIPLE}/crtbeginS.o"
|
||||
ln -s \
|
||||
"clang_rt.crtend-` + s.linuxArch() + `.o" \
|
||||
"clang_rt.crtend-` + t.linuxArch() + `.o" \
|
||||
"/work/system/lib/${ROSA_TRIPLE}/crtendS.o"
|
||||
`,
|
||||
},
|
||||
@@ -97,9 +97,9 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func (t Toolchain) newEarlyRuntimes(s *S) (pkg.Artifact, string) {
|
||||
source, version := s.Load(t, llvmSource)
|
||||
return s.NewPackage(t, "early-runtimes", version, source, &PackageAttr{
|
||||
func (t Toolchain) newEarlyRuntimes() (pkg.Artifact, string) {
|
||||
source, version := t.Load(llvmSource)
|
||||
return t.NewPackage("early-runtimes", version, source, &PackageAttr{
|
||||
Flag: TExclusive,
|
||||
}, &CMakeHelper{
|
||||
Append: []string{"runtimes"},
|
||||
@@ -157,9 +157,9 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func (t Toolchain) newLLVM(s *S) (pkg.Artifact, string) {
|
||||
func (t Toolchain) newLLVM() (pkg.Artifact, string) {
|
||||
early := muslHeaders
|
||||
if t.isStage0() {
|
||||
if t.stage.isStage0() {
|
||||
// The LLVM build system uses the system installation when building with
|
||||
// LLVM_LINK_LLVM_DYLIB, since it builds runtimes after the fact, using
|
||||
// the just-built toolchain. This is unacceptable in stage0 due to the
|
||||
@@ -217,7 +217,7 @@ func (t Toolchain) newLLVM(s *S) (pkg.Artifact, string) {
|
||||
}, ";") + "'"},
|
||||
}
|
||||
|
||||
if !t.isStage0() {
|
||||
if !t.stage.isStage0() {
|
||||
skipChecks := []string{
|
||||
// expensive, pointless to run here
|
||||
"benchmarks",
|
||||
@@ -247,7 +247,7 @@ func (t Toolchain) newLLVM(s *S) (pkg.Artifact, string) {
|
||||
// unwind: fails on musl
|
||||
"eh_frame_fde_pc_range",
|
||||
}
|
||||
switch s.arch {
|
||||
switch t.arch {
|
||||
case "arm64":
|
||||
skipChecks = append(skipChecks,
|
||||
// LLVM: intermittently crashes
|
||||
@@ -257,7 +257,7 @@ func (t Toolchain) newLLVM(s *S) (pkg.Artifact, string) {
|
||||
)
|
||||
}
|
||||
|
||||
if s.opts&OptLLVMNoLTO == 0 {
|
||||
if t.opts&OptLLVMNoLTO == 0 {
|
||||
cache = append(cache, []KV{
|
||||
// very expensive
|
||||
{"LLVM_ENABLE_LTO", "Thin"},
|
||||
@@ -273,8 +273,8 @@ func (t Toolchain) newLLVM(s *S) (pkg.Artifact, string) {
|
||||
}...)
|
||||
}
|
||||
|
||||
source, version := s.Load(t, llvmSource)
|
||||
return s.NewPackage(t, "llvm", version, source, &PackageAttr{
|
||||
source, version := t.Load(llvmSource)
|
||||
return t.NewPackage("llvm", version, source, &PackageAttr{
|
||||
Flag: TExclusive,
|
||||
}, &CMakeHelper{
|
||||
Append: []string{"llvm"},
|
||||
@@ -291,7 +291,7 @@ ln -s clang++ /work/system/bin/c++
|
||||
// installation into test environment, and the tests end up testing the
|
||||
// system installation instead. Tests are disabled on stage0 and relies
|
||||
// on 3-stage determinism to test later stages.
|
||||
SkipTest: t.isStage0(),
|
||||
SkipTest: t.stage.isStage0(),
|
||||
|
||||
Test: `
|
||||
chmod +w /bin && ln -s \
|
||||
@@ -325,8 +325,8 @@ func init() {
|
||||
)
|
||||
|
||||
native.MustRegister(&Artifact{
|
||||
f: func(t Toolchain, s *S) (pkg.Artifact, string) {
|
||||
return s.NewPatchedSource(t, "llvm", version, newFromGitHub(
|
||||
f: func(t Toolchain) (pkg.Artifact, string) {
|
||||
return t.NewPatchedSource("llvm", version, newFromGitHub(
|
||||
"llvm/llvm-project",
|
||||
"llvmorg-"+version,
|
||||
checksum,
|
||||
|
||||
Reference in New Issue
Block a user