internal/rosa/cmake: optional variant string
All checks were successful
Test / Create distribution (push) Successful in 1m1s
Test / Sandbox (push) Successful in 2m35s
Test / Hakurei (push) Successful in 3m55s
Test / ShareFS (push) Successful in 4m11s
Test / Hpkg (push) Successful in 4m39s
Test / Sandbox (race detector) (push) Successful in 5m3s
Test / Hakurei (race detector) (push) Successful in 6m1s
Test / Flake checks (push) Successful in 1m44s

This improves consistency with other helpers and removes the usually unnecessary variant suffix.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-02-16 12:30:04 +09:00
parent a58c9258cc
commit 74dee11822
3 changed files with 15 additions and 5 deletions

View File

@@ -42,6 +42,9 @@ func init() { artifactsF[CMake] = Toolchain.newCMake }
// CMakeAttr holds the project-specific attributes that will be applied to a new // CMakeAttr holds the project-specific attributes that will be applied to a new
// [pkg.Artifact] compiled via [CMake]. // [pkg.Artifact] compiled via [CMake].
type CMakeAttr struct { type CMakeAttr struct {
// Joined with name with a dash if non-empty.
Variant string
// Path elements joined with source. // Path elements joined with source.
Append []string Append []string
// Use source tree as scratch space. // Use source tree as scratch space.
@@ -69,12 +72,12 @@ type CMakeAttr struct {
// NewViaCMake returns a [pkg.Artifact] for compiling and installing via [CMake]. // NewViaCMake returns a [pkg.Artifact] for compiling and installing via [CMake].
func (t Toolchain) NewViaCMake( func (t Toolchain) NewViaCMake(
name, version, variant string, name, version string,
source pkg.Artifact, source pkg.Artifact,
attr *CMakeAttr, attr *CMakeAttr,
extra ...pkg.Artifact, extra ...pkg.Artifact,
) pkg.Artifact { ) pkg.Artifact {
if name == "" || version == "" || variant == "" { if name == "" || version == "" {
panic("names must be non-empty") panic("names must be non-empty")
} }
if attr == nil { if attr == nil {
@@ -98,8 +101,13 @@ func (t Toolchain) NewViaCMake(
prefix = AbsSystem prefix = AbsSystem
} }
rname := name
if attr.Variant != "" {
rname += "-" + attr.Variant
}
sourcePath := AbsUsrSrc.Append(name) sourcePath := AbsUsrSrc.Append(name)
return t.New(name+"-"+variant+"-"+version, attr.Flag, stage0Concat(t, extra, return t.New(rname+"-"+version, attr.Flag, stage0Concat(t, extra,
t.Load(CMake), t.Load(CMake),
t.Load(Ninja), t.Load(Ninja),
), nil, slices.Concat([]string{ ), nil, slices.Concat([]string{

View File

@@ -167,7 +167,7 @@ ln -s ld.lld /work/system/bin/ld
) )
} }
return t.NewViaCMake("llvm", version, variant, t.NewPatchedSource( return t.NewViaCMake("llvm", version, t.NewPatchedSource(
"llvmorg", version, pkg.NewHTTPGetTar( "llvmorg", version, pkg.NewHTTPGetTar(
nil, "https://github.com/llvm/llvm-project/archive/refs/tags/"+ nil, "https://github.com/llvm/llvm-project/archive/refs/tags/"+
"llvmorg-"+version+".tar.gz", "llvmorg-"+version+".tar.gz",
@@ -175,6 +175,8 @@ ln -s ld.lld /work/system/bin/ld
pkg.TarGzip, pkg.TarGzip,
), true, attr.patches..., ), true, attr.patches...,
), &CMakeAttr{ ), &CMakeAttr{
Variant: variant,
Cache: slices.Concat(cache, attr.cmake), Cache: slices.Concat(cache, attr.cmake),
Append: cmakeAppend, Append: cmakeAppend,
Prefix: attr.prefix, Prefix: attr.prefix,

View File

@@ -7,7 +7,7 @@ func (t Toolchain) newZstd() pkg.Artifact {
version = "1.5.7" version = "1.5.7"
checksum = "4XhfR7DwVkwo1R-TmYDAJOcx9YXv9WSFhcFUe3hWEAMmdMLPhFaznCqYIA19_xxV" checksum = "4XhfR7DwVkwo1R-TmYDAJOcx9YXv9WSFhcFUe3hWEAMmdMLPhFaznCqYIA19_xxV"
) )
return t.NewViaCMake("zstd", version, "full", pkg.NewHTTPGetTar( return t.NewViaCMake("zstd", version, pkg.NewHTTPGetTar(
nil, "https://github.com/facebook/zstd/releases/download/"+ nil, "https://github.com/facebook/zstd/releases/download/"+
"v"+version+"/zstd-"+version+".tar.gz", "v"+version+"/zstd-"+version+".tar.gz",
mustDecode(checksum), mustDecode(checksum),