Files
hakurei/internal/rosa/toybox.go
Ophestra 1ef7bedfb5
All checks were successful
Test / Create distribution (push) Successful in 59s
Test / Sandbox (push) Successful in 2m36s
Test / Hakurei (push) Successful in 3m52s
Test / ShareFS (push) Successful in 3m58s
Test / Hpkg (push) Successful in 4m27s
Test / Sandbox (race detector) (push) Successful in 5m7s
Test / Hakurei (race detector) (push) Successful in 5m54s
Test / Flake checks (push) Successful in 1m43s
internal/rosa/toybox: do not assume bash location
For compatibility with Gentoo stage3 as bootstrap seed.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-02-11 01:36:41 +09:00

67 lines
1.4 KiB
Go

package rosa
import "hakurei.app/internal/pkg"
func (t Toolchain) newToybox(suffix, script string) pkg.Artifact {
const (
version = "0.8.13"
checksum = "rZ1V1ATDte2WeQZanxLVoiRGdfPXhMlEo5-exX-e-ml8cGn9qOv0ABEUVZpX3wTI"
)
return t.New("toybox-"+version+suffix, TEarly, stage0Concat(t, []pkg.Artifact{},
t.Load(Make),
t.Load(Bash),
t.Load(Gzip),
t.Load(KernelHeaders),
), nil, stage0Concat(t, []string{},
"ROSA_CHECK=make USER=cure tests",
), `
chmod +w /bin/
ln -rs "$(which bash)" /bin/ || true
cd /usr/src/toybox
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+`
make \
"-j$(nproc)" \
LDFLAGS="${LDFLAGS} -static"
${ROSA_CHECK}
PREFIX=/work/system/bin make install_flat
mkdir -p /work/usr/bin
ln -s ../../system/bin/env /work/usr/bin
`, pkg.Path(AbsUsrSrc.Append("toybox"), true, pkg.NewHTTPGetTar(
nil,
"https://landley.net/toybox/downloads/toybox-"+version+".tar.gz",
mustDecode(checksum),
pkg.TarGzip,
)))
}
func init() {
artifactsF[Toybox] = func(t Toolchain) pkg.Artifact {
return t.newToybox("", "")
}
artifactsF[toyboxEarly] = func(t Toolchain) pkg.Artifact {
return t.newToybox("-early", `
echo '
CONFIG_EXPR=y
CONFIG_TR=y
CONFIG_AWK=y
CONFIG_DIFF=y
' >> .config
`)
}
}