internal/rosa: improve cmake interface
All checks were successful
Test / Create distribution (push) Successful in 1m0s
Test / Sandbox (push) Successful in 2m38s
Test / Hakurei (push) Successful in 3m52s
Test / ShareFS (push) Successful in 4m0s
Test / Hpkg (push) Successful in 4m49s
Test / Sandbox (race detector) (push) Successful in 5m6s
Test / Hakurei (race detector) (push) Successful in 5m56s
Test / Flake checks (push) Successful in 1m42s
All checks were successful
Test / Create distribution (push) Successful in 1m0s
Test / Sandbox (push) Successful in 2m38s
Test / Hakurei (push) Successful in 3m52s
Test / ShareFS (push) Successful in 4m0s
Test / Hpkg (push) Successful in 4m49s
Test / Sandbox (race detector) (push) Successful in 5m6s
Test / Hakurei (race detector) (push) Successful in 5m56s
Test / Flake checks (push) Successful in 1m42s
This should make the call site look better for new artifacts. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -38,14 +38,12 @@ make DESTDIR=/work install
|
|||||||
func init() { artifactsF[CMake] = Toolchain.newCMake }
|
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 {
|
||||||
// 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.
|
||||||
Writable bool
|
Writable bool
|
||||||
// Dependencies concatenated with the build system itself.
|
|
||||||
Extra []pkg.Artifact
|
|
||||||
|
|
||||||
// CMake CACHE entries.
|
// CMake CACHE entries.
|
||||||
Cache [][2]string
|
Cache [][2]string
|
||||||
@@ -59,15 +57,16 @@ type CMakeAttr struct {
|
|||||||
// Override the default installation prefix [AbsSystem].
|
// Override the default installation prefix [AbsSystem].
|
||||||
Prefix *check.Absolute
|
Prefix *check.Absolute
|
||||||
|
|
||||||
// Return an exclusive artifact.
|
// Passed through to [Toolchain.New].
|
||||||
Exclusive bool
|
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(
|
func (t Toolchain) NewViaCMake(
|
||||||
name, version, variant string,
|
name, version, variant string,
|
||||||
source pkg.Artifact,
|
source pkg.Artifact,
|
||||||
attr *CMakeAttr,
|
attr *CMakeAttr,
|
||||||
|
extra ...pkg.Artifact,
|
||||||
) pkg.Artifact {
|
) pkg.Artifact {
|
||||||
if name == "" || version == "" || variant == "" {
|
if name == "" || version == "" || variant == "" {
|
||||||
panic("names must be non-empty")
|
panic("names must be non-empty")
|
||||||
@@ -95,13 +94,8 @@ chmod -R +w "${ROSA_SOURCE}"
|
|||||||
prefix = AbsSystem
|
prefix = AbsSystem
|
||||||
}
|
}
|
||||||
|
|
||||||
var flag int
|
|
||||||
if attr.Exclusive {
|
|
||||||
flag |= TExclusive
|
|
||||||
}
|
|
||||||
|
|
||||||
sourcePath := AbsUsrSrc.Append(name)
|
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(CMake),
|
||||||
t.Load(Ninja),
|
t.Load(Ninja),
|
||||||
), nil, slices.Concat([]string{
|
), nil, slices.Concat([]string{
|
||||||
|
|||||||
@@ -180,7 +180,16 @@ cp -r /system/include /usr/include && rm -rf /system/include
|
|||||||
), &CMakeAttr{
|
), &CMakeAttr{
|
||||||
Cache: slices.Concat(cache, attr.cmake),
|
Cache: slices.Concat(cache, attr.cmake),
|
||||||
Append: cmakeAppend,
|
Append: cmakeAppend,
|
||||||
Extra: stage3Concat(t, attr.extra,
|
Prefix: attr.prefix,
|
||||||
|
|
||||||
|
Env: slices.Concat([]string{
|
||||||
|
"ROSA_LLVM_PROJECTS=" + strings.Join(projects, ";"),
|
||||||
|
"ROSA_LLVM_RUNTIMES=" + strings.Join(runtimes, ";"),
|
||||||
|
}, attr.env),
|
||||||
|
ScriptEarly: scriptEarly, Script: script + attr.script,
|
||||||
|
|
||||||
|
Flag: TExclusive,
|
||||||
|
}, stage3Concat(t, attr.extra,
|
||||||
t.Load(Libffi),
|
t.Load(Libffi),
|
||||||
t.Load(Python),
|
t.Load(Python),
|
||||||
t.Load(Perl),
|
t.Load(Perl),
|
||||||
@@ -191,17 +200,7 @@ cp -r /system/include /usr/include && rm -rf /system/include
|
|||||||
t.Load(Findutils),
|
t.Load(Findutils),
|
||||||
|
|
||||||
t.Load(KernelHeaders),
|
t.Load(KernelHeaders),
|
||||||
),
|
)...)
|
||||||
Prefix: attr.prefix,
|
|
||||||
|
|
||||||
Env: slices.Concat([]string{
|
|
||||||
"ROSA_LLVM_PROJECTS=" + strings.Join(projects, ";"),
|
|
||||||
"ROSA_LLVM_RUNTIMES=" + strings.Join(runtimes, ";"),
|
|
||||||
}, attr.env),
|
|
||||||
ScriptEarly: scriptEarly, Script: script + attr.script,
|
|
||||||
|
|
||||||
Exclusive: true,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// newLLVM returns LLVM toolchain across multiple [pkg.Artifact].
|
// newLLVM returns LLVM toolchain across multiple [pkg.Artifact].
|
||||||
|
|||||||
Reference in New Issue
Block a user