internal/rosa/package: migrate cmake

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-05-19 18:42:54 +09:00
parent a770d62b9b
commit 6e8bfa6c4c
7 changed files with 159 additions and 143 deletions

View File

@@ -2,17 +2,29 @@ package rosa
import "hakurei.app/internal/pkg"
func (t Toolchain) newNinja() (pkg.Artifact, string) {
// Ninja is the build system used by [CMakeHelper] and [MesonHelper].
var Ninja = H("ninja")
func init() {
const (
version = "1.13.2"
checksum = "ygKWMa0YV2lWKiFro5hnL-vcKbc_-RACZuPu0Io8qDvgQlZ0dxv7hPNSFkt4214v"
)
_, python := t.Load(Python)
_, bash := t.Load(Bash)
return t.New("ninja-"+version, 0, []pkg.Artifact{
python,
bash,
}, nil, nil, `
meta := Metadata{
Name: "ninja",
Description: "a small build system with a focus on speed",
Website: "https://ninja-build.org",
Version: version,
ID: 2089,
}
native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) {
_, python := t.Load(Python)
_, bash := t.Load(Bash)
return &meta, t.New(meta.Name+"-"+version, 0, []pkg.Artifact{
python,
bash,
}, nil, nil, `
cd "$(mktemp -d)"
python3 /usr/src/ninja/configure.py \
--verbose \
@@ -24,26 +36,18 @@ python3 /usr/src/ninja/configure.py \
mkdir -p /work/system/bin/
cp ninja /work/system/bin/
`, pkg.Path(AbsUsrSrc.Append("googletest"), false,
newFromGitHubRelease(
"google/googletest",
"v1.16.0",
"googletest-1.16.0.tar.gz",
"NjLGvSbgPy_B-y-o1hdanlzEzaYeStFcvFGxpYV3KYlhrWWFRcugYhM3ZMzOA9B_",
pkg.TarGzip,
)), pkg.Path(AbsUsrSrc.Append("ninja"), true, t.NewPatchedSource(
"ninja", version, newFromGitHub(
"ninja-build/ninja",
"v"+version,
checksum,
), false,
))), version
}
func init() {
native.mustRegister(Toolchain.newNinja, &Metadata{
Name: "ninja",
Description: "a small build system with a focus on speed",
Website: "https://ninja-build.org/",
ID: 2089,
newFromGitHubRelease(
"google/googletest",
"v1.16.0",
"googletest-1.16.0.tar.gz",
"NjLGvSbgPy_B-y-o1hdanlzEzaYeStFcvFGxpYV3KYlhrWWFRcugYhM3ZMzOA9B_",
pkg.TarGzip,
)), pkg.Path(AbsUsrSrc.Append("ninja"), true, t.NewPatchedSource(
meta.Name, version, newFromGitHub(
"ninja-build/ninja",
"v"+version,
checksum,
), false,
)))
})
}