internal/rosa/cmake: expose earlier build script
All checks were successful
Test / Create distribution (push) Successful in 59s
Test / Sandbox (push) Successful in 2m37s
Test / Hakurei (push) Successful in 3m54s
Test / ShareFS (push) Successful in 3m58s
Test / Hpkg (push) Successful in 4m25s
Test / Sandbox (race detector) (push) Successful in 4m59s
Test / Hakurei (race detector) (push) Successful in 6m9s
Test / Flake checks (push) Successful in 1m36s
All checks were successful
Test / Create distribution (push) Successful in 59s
Test / Sandbox (push) Successful in 2m37s
Test / Hakurei (push) Successful in 3m54s
Test / ShareFS (push) Successful in 3m58s
Test / Hpkg (push) Successful in 4m25s
Test / Sandbox (race detector) (push) Successful in 4m59s
Test / Hakurei (race detector) (push) Successful in 6m9s
Test / Flake checks (push) Successful in 1m36s
This allows for more flexible build setups. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -51,12 +51,16 @@ type CMakeAttr struct {
|
|||||||
Env []string
|
Env []string
|
||||||
// Runs before cmake.
|
// Runs before cmake.
|
||||||
ScriptEarly string
|
ScriptEarly string
|
||||||
// Runs after cmake.
|
// Runs after cmake, replaces default.
|
||||||
|
ScriptConfigured string
|
||||||
|
// Runs after install.
|
||||||
Script string
|
Script string
|
||||||
|
|
||||||
// Override the default installation prefix [AbsSystem].
|
// Override the default installation prefix [AbsSystem].
|
||||||
Prefix *check.Absolute
|
Prefix *check.Absolute
|
||||||
|
|
||||||
|
// Passed through to [Toolchain.New].
|
||||||
|
Paths []pkg.ExecPath
|
||||||
// Passed through to [Toolchain.New].
|
// Passed through to [Toolchain.New].
|
||||||
Flag int
|
Flag int
|
||||||
}
|
}
|
||||||
@@ -82,11 +86,9 @@ func (t Toolchain) NewViaCMake(
|
|||||||
panic("CACHE must be non-empty")
|
panic("CACHE must be non-empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
scriptEarly := attr.ScriptEarly
|
scriptConfigured := "cmake --build .\ncmake --install .\n"
|
||||||
if attr.Writable {
|
if attr.ScriptConfigured != "" {
|
||||||
scriptEarly = `
|
scriptConfigured = attr.ScriptConfigured
|
||||||
chmod -R +w "${ROSA_SOURCE}"
|
|
||||||
` + scriptEarly
|
|
||||||
}
|
}
|
||||||
|
|
||||||
prefix := attr.Prefix
|
prefix := attr.Prefix
|
||||||
@@ -102,7 +104,7 @@ chmod -R +w "${ROSA_SOURCE}"
|
|||||||
"ROSA_SOURCE=" + sourcePath.String(),
|
"ROSA_SOURCE=" + sourcePath.String(),
|
||||||
"ROSA_CMAKE_SOURCE=" + sourcePath.Append(attr.Append...).String(),
|
"ROSA_CMAKE_SOURCE=" + sourcePath.Append(attr.Append...).String(),
|
||||||
"ROSA_INSTALL_PREFIX=/work" + prefix.String(),
|
"ROSA_INSTALL_PREFIX=/work" + prefix.String(),
|
||||||
}, attr.Env), scriptEarly+`
|
}, attr.Env), attr.ScriptEarly+`
|
||||||
mkdir /cure && cd /cure
|
mkdir /cure && cd /cure
|
||||||
cmake -G Ninja \
|
cmake -G Ninja \
|
||||||
-DCMAKE_C_COMPILER_TARGET="${ROSA_TRIPLE}" \
|
-DCMAKE_C_COMPILER_TARGET="${ROSA_TRIPLE}" \
|
||||||
@@ -117,7 +119,7 @@ cmake -G Ninja \
|
|||||||
}), " \\\n\t")+` \
|
}), " \\\n\t")+` \
|
||||||
-DCMAKE_INSTALL_PREFIX="${ROSA_INSTALL_PREFIX}" \
|
-DCMAKE_INSTALL_PREFIX="${ROSA_INSTALL_PREFIX}" \
|
||||||
"${ROSA_CMAKE_SOURCE}"
|
"${ROSA_CMAKE_SOURCE}"
|
||||||
cmake --build .
|
`+scriptConfigured+attr.Script, slices.Concat([]pkg.ExecPath{
|
||||||
cmake --install .
|
pkg.Path(sourcePath, attr.Writable, source),
|
||||||
`+attr.Script, pkg.Path(sourcePath, attr.Writable, source))
|
}, attr.Paths)...)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,12 +22,18 @@ type llvmAttr struct {
|
|||||||
cmake [][2]string
|
cmake [][2]string
|
||||||
// Override CMakeAttr.Append.
|
// Override CMakeAttr.Append.
|
||||||
append []string
|
append []string
|
||||||
// Concatenated with default dependencies for CMakeAttr.Extra.
|
// Concatenated with default dependencies for Toolchain.NewViaCMake.
|
||||||
extra []pkg.Artifact
|
extra []pkg.Artifact
|
||||||
|
// Passed through to CMakeAttr.Paths.
|
||||||
|
paths []pkg.ExecPath
|
||||||
|
// Passed through to CMakeAttr.ScriptConfigured.
|
||||||
|
scriptConfigured string
|
||||||
// Concatenated with default fixup for CMakeAttr.Script.
|
// Concatenated with default fixup for CMakeAttr.Script.
|
||||||
script string
|
script string
|
||||||
// Passed through to CMakeAttr.Prefix.
|
// Passed through to CMakeAttr.Prefix.
|
||||||
prefix *check.Absolute
|
prefix *check.Absolute
|
||||||
|
// Passed through to CMakeAttr.Writable.
|
||||||
|
writable bool
|
||||||
|
|
||||||
// Patch name and body pairs.
|
// Patch name and body pairs.
|
||||||
patches [][2]string
|
patches [][2]string
|
||||||
@@ -186,9 +192,13 @@ cp -r /system/include /usr/include && rm -rf /system/include
|
|||||||
"ROSA_LLVM_PROJECTS=" + strings.Join(projects, ";"),
|
"ROSA_LLVM_PROJECTS=" + strings.Join(projects, ";"),
|
||||||
"ROSA_LLVM_RUNTIMES=" + strings.Join(runtimes, ";"),
|
"ROSA_LLVM_RUNTIMES=" + strings.Join(runtimes, ";"),
|
||||||
}, attr.env),
|
}, attr.env),
|
||||||
ScriptEarly: scriptEarly, Script: script + attr.script,
|
ScriptEarly: scriptEarly,
|
||||||
|
ScriptConfigured: attr.scriptConfigured,
|
||||||
|
Script: script + attr.script,
|
||||||
|
Writable: attr.writable,
|
||||||
|
|
||||||
Flag: TExclusive,
|
Paths: attr.paths,
|
||||||
|
Flag: TExclusive,
|
||||||
}, stage3Concat(t, attr.extra,
|
}, stage3Concat(t, attr.extra,
|
||||||
t.Load(Libffi),
|
t.Load(Libffi),
|
||||||
t.Load(Python),
|
t.Load(Python),
|
||||||
|
|||||||
Reference in New Issue
Block a user