diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-02-07 13:23:13 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-02-07 13:23:13 +0900 |
| commit | 697c91e04d992f62b0439fd292f6d4721ec628eb (patch) | |
| tree | 962eba9f1e546afbd2da3f95845b597273dbe8d4 /internal/rosa/cmake.go | |
| parent | 3f7b8b43327805a674897ace49d738120232cc0b (diff) | |
internal/rosa/cmake: expose earlier build script
This allows for more flexible build setups.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/cmake.go')
| -rw-r--r-- | internal/rosa/cmake.go | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/internal/rosa/cmake.go b/internal/rosa/cmake.go index 5a97dfff..13ad9177 100644 --- a/internal/rosa/cmake.go +++ b/internal/rosa/cmake.go @@ -51,13 +51,17 @@ type CMakeAttr struct { Env []string // Runs before cmake. ScriptEarly string - // Runs after cmake. + // Runs after cmake, replaces default. + ScriptConfigured string + // Runs after install. Script string // Override the default installation prefix [AbsSystem]. Prefix *check.Absolute // Passed through to [Toolchain.New]. + Paths []pkg.ExecPath + // Passed through to [Toolchain.New]. Flag int } @@ -82,11 +86,9 @@ func (t Toolchain) NewViaCMake( panic("CACHE must be non-empty") } - scriptEarly := attr.ScriptEarly - if attr.Writable { - scriptEarly = ` -chmod -R +w "${ROSA_SOURCE}" -` + scriptEarly + scriptConfigured := "cmake --build .\ncmake --install .\n" + if attr.ScriptConfigured != "" { + scriptConfigured = attr.ScriptConfigured } prefix := attr.Prefix @@ -102,7 +104,7 @@ chmod -R +w "${ROSA_SOURCE}" "ROSA_SOURCE=" + sourcePath.String(), "ROSA_CMAKE_SOURCE=" + sourcePath.Append(attr.Append...).String(), "ROSA_INSTALL_PREFIX=/work" + prefix.String(), - }, attr.Env), scriptEarly+` + }, attr.Env), attr.ScriptEarly+` mkdir /cure && cd /cure cmake -G Ninja \ -DCMAKE_C_COMPILER_TARGET="${ROSA_TRIPLE}" \ @@ -117,7 +119,7 @@ cmake -G Ninja \ }), " \\\n\t")+` \ -DCMAKE_INSTALL_PREFIX="${ROSA_INSTALL_PREFIX}" \ "${ROSA_CMAKE_SOURCE}" -cmake --build . -cmake --install . -`+attr.Script, pkg.Path(sourcePath, attr.Writable, source)) +`+scriptConfigured+attr.Script, slices.Concat([]pkg.ExecPath{ + pkg.Path(sourcePath, attr.Writable, source), + }, attr.Paths)...) } |
