forked from rosa/hakurei
internal/rosa: key metadata by string
For upcoming azalea integration. The API is quite ugly right now to ease migration. 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() (pkg.Artifact, string) {
|
||||
version := t.Version(llvmSource)
|
||||
func (t Toolchain) newEarlyCompilerRT(s *S) (pkg.Artifact, string) {
|
||||
source, version := s.Load(t, llvmSource)
|
||||
major, _, _ := strings.Cut(version, ".")
|
||||
return t.NewPackage("early-compiler-rt", version, t.Load(llvmSource), &PackageAttr{
|
||||
return s.NewPackage(t, "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-` + linuxArch() + `.o" \
|
||||
"clang_rt.crtbegin-` + s.linuxArch() + `.o" \
|
||||
"/work/system/lib/${ROSA_TRIPLE}/crtbeginS.o"
|
||||
ln -s \
|
||||
"clang_rt.crtend-` + linuxArch() + `.o" \
|
||||
"clang_rt.crtend-` + s.linuxArch() + `.o" \
|
||||
"/work/system/lib/${ROSA_TRIPLE}/crtendS.o"
|
||||
`,
|
||||
},
|
||||
@@ -85,7 +85,7 @@ ln -s \
|
||||
), version
|
||||
}
|
||||
func init() {
|
||||
artifactsM[earlyCompilerRT] = Metadata{
|
||||
native.MustRegister(&Artifact{
|
||||
f: Toolchain.newEarlyCompilerRT,
|
||||
|
||||
Name: "early-compiler-rt",
|
||||
@@ -94,12 +94,12 @@ func init() {
|
||||
Dependencies: P{
|
||||
Musl,
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (t Toolchain) newEarlyRuntimes() (pkg.Artifact, string) {
|
||||
version := t.Version(llvmSource)
|
||||
return t.NewPackage("early-runtimes", version, t.Load(llvmSource), &PackageAttr{
|
||||
func (t Toolchain) newEarlyRuntimes(s *S) (pkg.Artifact, string) {
|
||||
source, version := s.Load(t, llvmSource)
|
||||
return s.NewPackage(t, "early-runtimes", version, source, &PackageAttr{
|
||||
Flag: TExclusive,
|
||||
}, &CMakeHelper{
|
||||
Append: []string{"runtimes"},
|
||||
@@ -145,7 +145,7 @@ func (t Toolchain) newEarlyRuntimes() (pkg.Artifact, string) {
|
||||
), version
|
||||
}
|
||||
func init() {
|
||||
artifactsM[earlyRuntimes] = Metadata{
|
||||
native.MustRegister(&Artifact{
|
||||
f: Toolchain.newEarlyRuntimes,
|
||||
|
||||
Name: "early-runtimes",
|
||||
@@ -154,11 +154,11 @@ func init() {
|
||||
Dependencies: P{
|
||||
earlyCompilerRT,
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (t Toolchain) newLLVM() (pkg.Artifact, string) {
|
||||
var early PArtifact = muslHeaders
|
||||
func (t Toolchain) newLLVM(s *S) (pkg.Artifact, string) {
|
||||
early := muslHeaders
|
||||
if t.isStage0() {
|
||||
// The LLVM build system uses the system installation when building with
|
||||
// LLVM_LINK_LLVM_DYLIB, since it builds runtimes after the fact, using
|
||||
@@ -247,7 +247,7 @@ func (t Toolchain) newLLVM() (pkg.Artifact, string) {
|
||||
// unwind: fails on musl
|
||||
"eh_frame_fde_pc_range",
|
||||
}
|
||||
switch arch {
|
||||
switch s.arch {
|
||||
case "arm64":
|
||||
skipChecks = append(skipChecks,
|
||||
// LLVM: intermittently crashes
|
||||
@@ -257,7 +257,7 @@ func (t Toolchain) newLLVM() (pkg.Artifact, string) {
|
||||
)
|
||||
}
|
||||
|
||||
if presetOpts&OptLLVMNoLTO == 0 {
|
||||
if s.opts&OptLLVMNoLTO == 0 {
|
||||
cache = append(cache, []KV{
|
||||
// very expensive
|
||||
{"LLVM_ENABLE_LTO", "Thin"},
|
||||
@@ -273,8 +273,8 @@ func (t Toolchain) newLLVM() (pkg.Artifact, string) {
|
||||
}...)
|
||||
}
|
||||
|
||||
version := t.Version(llvmSource)
|
||||
return t.NewPackage("llvm", version, t.Load(llvmSource), &PackageAttr{
|
||||
source, version := s.Load(t, llvmSource)
|
||||
return s.NewPackage(t, "llvm", version, source, &PackageAttr{
|
||||
Flag: TExclusive,
|
||||
}, &CMakeHelper{
|
||||
Append: []string{"llvm"},
|
||||
@@ -324,9 +324,9 @@ func init() {
|
||||
checksum = "32gOaLPHcUlo3hkdk5RbFumTE01XKeCAYZcpvn8IDHF95egXVfDFSl6eZL3ChMen"
|
||||
)
|
||||
|
||||
artifactsM[llvmSource] = Metadata{
|
||||
f: func(t Toolchain) (pkg.Artifact, string) {
|
||||
return t.NewPatchedSource("llvm", version, newFromGitHub(
|
||||
native.MustRegister(&Artifact{
|
||||
f: func(t Toolchain, s *S) (pkg.Artifact, string) {
|
||||
return s.NewPatchedSource(t, "llvm", version, newFromGitHub(
|
||||
"llvm/llvm-project",
|
||||
"llvmorg-"+version,
|
||||
checksum,
|
||||
@@ -337,9 +337,9 @@ func init() {
|
||||
Description: "LLVM monorepo with Rosa OS patches",
|
||||
|
||||
ID: 1830,
|
||||
}
|
||||
})
|
||||
|
||||
artifactsM[LLVM] = Metadata{
|
||||
native.MustRegister(&Artifact{
|
||||
f: Toolchain.newLLVM,
|
||||
|
||||
Name: "llvm",
|
||||
@@ -351,5 +351,5 @@ func init() {
|
||||
Zstd,
|
||||
Musl,
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user