Files
hakurei/internal/rosa/toybox.go
Ophestra 7636f39066
All checks were successful
Test / Create distribution (push) Successful in 59s
Test / Sandbox (push) Successful in 2m32s
Test / Hakurei (push) Successful in 3m39s
Test / ShareFS (push) Successful in 3m44s
Test / Sandbox (race detector) (push) Successful in 5m0s
Test / Hakurei (race detector) (push) Successful in 5m56s
Test / Flake checks (push) Successful in 1m29s
internal/rosa: provide package metadata
This had to be done out-of-band because there was no way to efficiently represent these within Artifact.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-03-04 21:26:23 +09:00

89 lines
1.8 KiB
Go

package rosa
import "hakurei.app/internal/pkg"
func (t Toolchain) newToybox(suffix, script string) (pkg.Artifact, string) {
const (
version = "0.8.13"
checksum = "rZ1V1ATDte2WeQZanxLVoiRGdfPXhMlEo5-exX-e-ml8cGn9qOv0ABEUVZpX3wTI"
)
return t.NewPackage("toybox"+suffix, version, pkg.NewHTTPGetTar(
nil, "https://landley.net/toybox/downloads/toybox-"+version+".tar.gz",
mustDecode(checksum),
pkg.TarGzip,
), &PackageAttr{
// uses source tree as scratch space
Writable: true,
EnterSource: true,
Flag: TEarly,
}, &MakeHelper{
OmitDefaults: true,
InPlace: true,
SkipConfigure: true,
ScriptMakeEarly: `
LDFLAGS="${LDFLAGS:-''} -static"
chmod +w /bin/
ln -rs "$(which bash)" /bin/ || true
chmod +w kconfig tests
rm \
tests/du.test \
tests/sed.test \
tests/tar.test \
tests/ls.test \
tests/taskset.test
make defconfig
sed -i \
's/^CONFIG_TOYBOX_ZHELP=y$/CONFIG_TOYBOX_ZHELP=0/' \
.config
` + script,
SkipCheck: t.isStage0(),
Check: []string{
"USER=cure",
"tests",
},
Install: "PREFIX=/work/system/bin make install_flat",
Script: `
mkdir -p /work/usr/bin
ln -s ../../system/bin/env /work/usr/bin
`,
},
Bash,
Gzip,
KernelHeaders,
), version
}
func init() {
artifactsM[Toybox] = Metadata{
f: func(t Toolchain) (pkg.Artifact, string) {
return t.newToybox("", "")
},
Name: "toybox",
Description: "many common Linux command line utilities",
Website: "https://landley.net/toybox/",
}
artifactsM[toyboxEarly] = Metadata{
f: func(t Toolchain) (pkg.Artifact, string) {
return t.newToybox("-early", `
echo '
CONFIG_EXPR=y
CONFIG_TR=y
CONFIG_AWK=y
CONFIG_DIFF=y
' >> .config
`)
},
Name: "toybox-early",
Description: "a build of toybox with unfinished tools enabled to break dependency loops",
Website: "https://landley.net/toybox/",
}
}