internal/rosa/cmake: migrate to helper interface
All checks were successful
Test / Create distribution (push) Successful in 1m5s
Test / Sandbox (push) Successful in 2m40s
Test / Hakurei (push) Successful in 3m51s
Test / ShareFS (push) Successful in 4m2s
Test / Hpkg (push) Successful in 4m36s
Test / Sandbox (race detector) (push) Successful in 5m2s
Test / Hakurei (race detector) (push) Successful in 6m0s
Test / Flake checks (push) Successful in 1m46s
All checks were successful
Test / Create distribution (push) Successful in 1m5s
Test / Sandbox (push) Successful in 2m40s
Test / Hakurei (push) Successful in 3m51s
Test / ShareFS (push) Successful in 4m2s
Test / Hpkg (push) Successful in 4m36s
Test / Sandbox (race detector) (push) Successful in 5m2s
Test / Hakurei (race detector) (push) Successful in 6m0s
Test / Flake checks (push) Successful in 1m46s
This change also removes some unused options. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -7,33 +7,27 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"hakurei.app/container/check"
|
||||
"hakurei.app/internal/pkg"
|
||||
)
|
||||
|
||||
// llvmAttr holds the attributes that will be applied to a new [pkg.Artifact]
|
||||
// containing a LLVM variant.
|
||||
type llvmAttr struct {
|
||||
// Passed through to PackageAttr.Flag.
|
||||
flags int
|
||||
|
||||
// Concatenated with default environment for CMakeAttr.Env.
|
||||
// Concatenated with default environment for PackageAttr.Env.
|
||||
env []string
|
||||
// Concatenated with generated entries for CMakeAttr.Cache.
|
||||
// Concatenated with generated entries for CMakeHelper.Cache.
|
||||
cmake [][2]string
|
||||
// Override CMakeAttr.Append.
|
||||
// Override CMakeHelper.Append.
|
||||
append []string
|
||||
// Concatenated with default dependencies for Toolchain.NewViaCMake.
|
||||
extra []pkg.Artifact
|
||||
// Passed through to CMakeAttr.Paths.
|
||||
// Passed through to PackageAttr.NonStage0.
|
||||
nonStage0 []pkg.Artifact
|
||||
// Passed through to PackageAttr.Paths.
|
||||
paths []pkg.ExecPath
|
||||
// Passed through to CMakeAttr.ScriptConfigured.
|
||||
scriptConfigured string
|
||||
// Concatenated with default fixup for CMakeAttr.Script.
|
||||
// Concatenated with default fixup for CMakeHelper.Script.
|
||||
script string
|
||||
// Passed through to CMakeAttr.Prefix.
|
||||
prefix *check.Absolute
|
||||
// Passed through to CMakeAttr.Writable.
|
||||
writable bool
|
||||
|
||||
// Patch name and body pairs.
|
||||
patches [][2]string
|
||||
@@ -101,7 +95,7 @@ func (t Toolchain) newLLVMVariant(variant string, attr *llvmAttr) pkg.Artifact {
|
||||
}
|
||||
}
|
||||
|
||||
var script, scriptEarly string
|
||||
var script string
|
||||
|
||||
cache := [][2]string{
|
||||
{"CMAKE_BUILD_TYPE", "Release"},
|
||||
@@ -167,43 +161,41 @@ ln -s ld.lld /work/system/bin/ld
|
||||
)
|
||||
}
|
||||
|
||||
return t.NewViaCMake("llvm", version, t.NewPatchedSource(
|
||||
return t.NewPackage("llvm", version, t.NewPatchedSource(
|
||||
"llvmorg", version, pkg.NewHTTPGetTar(
|
||||
nil, "https://github.com/llvm/llvm-project/archive/refs/tags/"+
|
||||
"llvmorg-"+version+".tar.gz",
|
||||
mustDecode(checksum),
|
||||
pkg.TarGzip,
|
||||
), true, attr.patches...,
|
||||
), &CMakeAttr{
|
||||
Variant: variant,
|
||||
|
||||
Cache: slices.Concat(cache, attr.cmake),
|
||||
Append: cmakeAppend,
|
||||
Prefix: attr.prefix,
|
||||
), &PackageAttr{
|
||||
NonStage0: attr.nonStage0,
|
||||
|
||||
Env: slices.Concat([]string{
|
||||
"ROSA_LLVM_PROJECTS=" + strings.Join(projects, ";"),
|
||||
"ROSA_LLVM_RUNTIMES=" + strings.Join(runtimes, ";"),
|
||||
}, attr.env),
|
||||
ScriptEarly: scriptEarly,
|
||||
ScriptConfigured: attr.scriptConfigured,
|
||||
Script: script + attr.script,
|
||||
Writable: attr.writable,
|
||||
|
||||
Paths: attr.paths,
|
||||
Flag: TExclusive,
|
||||
}, stage0Concat(t, attr.extra,
|
||||
t.Load(Libffi),
|
||||
t.Load(Python),
|
||||
t.Load(Perl),
|
||||
t.Load(Diffutils),
|
||||
t.Load(Bash),
|
||||
t.Load(Gawk),
|
||||
t.Load(Coreutils),
|
||||
t.Load(Findutils),
|
||||
}, &CMakeHelper{
|
||||
Variant: variant,
|
||||
|
||||
t.Load(KernelHeaders),
|
||||
)...)
|
||||
Cache: slices.Concat(cache, attr.cmake),
|
||||
Append: cmakeAppend,
|
||||
Script: script + attr.script,
|
||||
},
|
||||
Libffi,
|
||||
Python,
|
||||
Perl,
|
||||
Diffutils,
|
||||
Bash,
|
||||
Gawk,
|
||||
Coreutils,
|
||||
Findutils,
|
||||
|
||||
KernelHeaders,
|
||||
)
|
||||
}
|
||||
|
||||
// newLLVM returns LLVM toolchain across multiple [pkg.Artifact].
|
||||
@@ -246,21 +238,21 @@ func (t Toolchain) newLLVM() (musl, compilerRT, runtimes, clang pkg.Artifact) {
|
||||
{"COMPILER_RT_BUILD_XRAY", "OFF"},
|
||||
},
|
||||
append: []string{"compiler-rt"},
|
||||
extra: []pkg.Artifact{t.newMusl(true, []string{
|
||||
nonStage0: []pkg.Artifact{t.newMusl(true, []string{
|
||||
"CC=clang",
|
||||
})},
|
||||
script: `
|
||||
mkdir -p "${ROSA_INSTALL_PREFIX}/lib/clang/21/lib/"
|
||||
mkdir -p "/work/system/lib/clang/21/lib/"
|
||||
ln -s \
|
||||
"../../../${ROSA_TRIPLE}" \
|
||||
"${ROSA_INSTALL_PREFIX}/lib/clang/21/lib/"
|
||||
"/work/system/lib/clang/21/lib/"
|
||||
|
||||
ln -s \
|
||||
"clang_rt.crtbegin-` + linuxArch() + `.o" \
|
||||
"${ROSA_INSTALL_PREFIX}/lib/${ROSA_TRIPLE}/crtbeginS.o"
|
||||
"/work/system/lib/${ROSA_TRIPLE}/crtbeginS.o"
|
||||
ln -s \
|
||||
"clang_rt.crtend-` + linuxArch() + `.o" \
|
||||
"${ROSA_INSTALL_PREFIX}/lib/${ROSA_TRIPLE}/crtendS.o"
|
||||
"/work/system/lib/${ROSA_TRIPLE}/crtendS.o"
|
||||
`,
|
||||
})
|
||||
|
||||
@@ -287,7 +279,7 @@ ln -s \
|
||||
{"LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL", "OFF"},
|
||||
}, minimalDeps),
|
||||
append: []string{"runtimes"},
|
||||
extra: []pkg.Artifact{
|
||||
nonStage0: []pkg.Artifact{
|
||||
compilerRT,
|
||||
musl,
|
||||
},
|
||||
@@ -305,7 +297,7 @@ ln -s \
|
||||
{"CMAKE_CROSSCOMPILING", "OFF"},
|
||||
{"CXX_SUPPORTS_CUSTOM_LINKER", "ON"},
|
||||
}, minimalDeps),
|
||||
extra: []pkg.Artifact{
|
||||
nonStage0: []pkg.Artifact{
|
||||
musl,
|
||||
compilerRT,
|
||||
runtimes,
|
||||
|
||||
Reference in New Issue
Block a user