aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-01-31 02:42:01 +0900
committerOphestra <cat@gensokyo.uk>2026-01-31 02:42:01 +0900
commit47490823be4d81643ed3895263feec1da64f751e (patch)
tree5e8141781366093022d04ae4a04bc5a9b7a72705
parent1ac8ca7a80527645000f22a193b4278a12a654c0 (diff)
internal/rosa: improve cmake interface
This should make the call site look better for new artifacts. Signed-off-by: Ophestra <cat@gensokyo.uk>
-rw-r--r--internal/rosa/cmake.go18
-rw-r--r--internal/rosa/llvm.go27
2 files changed, 19 insertions, 26 deletions
diff --git a/internal/rosa/cmake.go b/internal/rosa/cmake.go
index 5dab313d..5a97dfff 100644
--- a/internal/rosa/cmake.go
+++ b/internal/rosa/cmake.go
@@ -38,14 +38,12 @@ make DESTDIR=/work install
func init() { artifactsF[CMake] = Toolchain.newCMake }
// 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 {
// Path elements joined with source.
Append []string
// Use source tree as scratch space.
Writable bool
- // Dependencies concatenated with the build system itself.
- Extra []pkg.Artifact
// CMake CACHE entries.
Cache [][2]string
@@ -59,15 +57,16 @@ type CMakeAttr struct {
// Override the default installation prefix [AbsSystem].
Prefix *check.Absolute
- // Return an exclusive artifact.
- Exclusive bool
+ // Passed through to [Toolchain.New].
+ Flag int
}
-// 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(
name, version, variant string,
source pkg.Artifact,
attr *CMakeAttr,
+ extra ...pkg.Artifact,
) pkg.Artifact {
if name == "" || version == "" || variant == "" {
panic("names must be non-empty")
@@ -95,13 +94,8 @@ chmod -R +w "${ROSA_SOURCE}"
prefix = AbsSystem
}
- var flag int
- if attr.Exclusive {
- flag |= TExclusive
- }
-
sourcePath := AbsUsrSrc.Append(name)
- return t.New(name+"-"+variant+"-"+version, flag, stage3Concat(t, attr.Extra,
+ return t.New(name+"-"+variant+"-"+version, attr.Flag, stage3Concat(t, extra,
t.Load(CMake),
t.Load(Ninja),
), nil, slices.Concat([]string{
diff --git a/internal/rosa/llvm.go b/internal/rosa/llvm.go
index e86050f8..101258bf 100644
--- a/internal/rosa/llvm.go
+++ b/internal/rosa/llvm.go
@@ -180,18 +180,6 @@ cp -r /system/include /usr/include && rm -rf /system/include
), &CMakeAttr{
Cache: slices.Concat(cache, attr.cmake),
Append: cmakeAppend,
- Extra: stage3Concat(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),
-
- t.Load(KernelHeaders),
- ),
Prefix: attr.prefix,
Env: slices.Concat([]string{
@@ -200,8 +188,19 @@ cp -r /system/include /usr/include && rm -rf /system/include
}, attr.env),
ScriptEarly: scriptEarly, Script: script + attr.script,
- Exclusive: true,
- })
+ Flag: TExclusive,
+ }, stage3Concat(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),
+
+ t.Load(KernelHeaders),
+ )...)
}
// newLLVM returns LLVM toolchain across multiple [pkg.Artifact].