package rosa

import "hakurei.app/internal/pkg"

func (t Toolchain) newNinja() (pkg.Artifact, string) {
	const (
		version  = "1.13.2"
		checksum = "ygKWMa0YV2lWKiFro5hnL-vcKbc_-RACZuPu0Io8qDvgQlZ0dxv7hPNSFkt4214v"
	)
	return t.New("ninja-"+version, 0, []pkg.Artifact{
		t.Load(Python),
		t.Load(Bash),
	}, nil, nil, `
cd "$(mktemp -d)"
python3 /usr/src/ninja/configure.py \
	--verbose \
	--bootstrap \
	--gtest-source-dir=/usr/src/googletest
./ninja `+jobsFlagE+` all
./ninja_test

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() {
	artifactsM[Ninja] = Metadata{
		f: Toolchain.newNinja,

		Name:        "ninja",
		Description: "a small build system with a focus on speed",
		Website:     "https://ninja-build.org/",

		ID: 2089,
	}
}
