aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/cmake.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-02-16 12:30:04 +0900
committerOphestra <cat@gensokyo.uk>2026-02-16 12:44:40 +0900
commit74dee118227cd72a2679f8eb167b43a1b165a415 (patch)
treeeb404f82a1abe42d0819e4e30033d2ca4e8516e7 /internal/rosa/cmake.go
parenta58c9258ccdb409a6c982b8ed4c2ea339be80db6 (diff)
internal/rosa/cmake: optional variant string
This improves consistency with other helpers and removes the usually unnecessary variant suffix. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/cmake.go')
-rw-r--r--internal/rosa/cmake.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/internal/rosa/cmake.go b/internal/rosa/cmake.go
index 986f84d0..5f049dd0 100644
--- a/internal/rosa/cmake.go
+++ b/internal/rosa/cmake.go
@@ -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{