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
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:
@@ -42,6 +42,9 @@ func init() { artifactsF[CMake] = Toolchain.newCMake }
|
||||
// CMakeAttr holds the project-specific attributes that will be applied to a new
|
||||
// [pkg.Artifact] compiled via [CMake].
|
||||
type CMakeAttr struct {
|
||||
// Joined with name with a dash if non-empty.
|
||||
Variant string
|
||||
|
||||
// Path elements joined with source.
|
||||
Append []string
|
||||
// Use source tree as scratch space.
|
||||
@@ -69,12 +72,12 @@ type CMakeAttr struct {
|
||||
|
||||
// NewViaCMake returns a [pkg.Artifact] for compiling and installing via [CMake].
|
||||
func (t Toolchain) NewViaCMake(
|
||||
name, version, variant string,
|
||||
name, version string,
|
||||
source pkg.Artifact,
|
||||
attr *CMakeAttr,
|
||||
extra ...pkg.Artifact,
|
||||
) pkg.Artifact {
|
||||
if name == "" || version == "" || variant == "" {
|
||||
if name == "" || version == "" {
|
||||
panic("names must be non-empty")
|
||||
}
|
||||
if attr == nil {
|
||||
@@ -98,8 +101,13 @@ func (t Toolchain) NewViaCMake(
|
||||
prefix = AbsSystem
|
||||
}
|
||||
|
||||
rname := name
|
||||
if attr.Variant != "" {
|
||||
rname += "-" + attr.Variant
|
||||
}
|
||||
|
||||
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(Ninja),
|
||||
), nil, slices.Concat([]string{
|
||||
|
||||
@@ -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(
|
||||
nil, "https://github.com/llvm/llvm-project/archive/refs/tags/"+
|
||||
"llvmorg-"+version+".tar.gz",
|
||||
@@ -175,6 +175,8 @@ ln -s ld.lld /work/system/bin/ld
|
||||
pkg.TarGzip,
|
||||
), true, attr.patches...,
|
||||
), &CMakeAttr{
|
||||
Variant: variant,
|
||||
|
||||
Cache: slices.Concat(cache, attr.cmake),
|
||||
Append: cmakeAppend,
|
||||
Prefix: attr.prefix,
|
||||
|
||||
@@ -7,7 +7,7 @@ func (t Toolchain) newZstd() pkg.Artifact {
|
||||
version = "1.5.7"
|
||||
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/"+
|
||||
"v"+version+"/zstd-"+version+".tar.gz",
|
||||
mustDecode(checksum),
|
||||
|
||||
Reference in New Issue
Block a user