aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-01-29 04:29:20 +0900
committerOphestra <cat@gensokyo.uk>2026-01-29 17:44:30 +0900
commitdd4326418c6a0d44751abba9f7a149ec140dca4e (patch)
tree1a0566de50c42fdfbc80e20a407acec97d8d0bdc
parent79c0106ea091ac042621874876385a848a287f34 (diff)
internal/rosa: toybox artifact
This compiles surprisingly quickly and required no workarounds, unlike busybox. Signed-off-by: Ophestra <cat@gensokyo.uk>
-rw-r--r--internal/rosa/all.go2
-rw-r--r--internal/rosa/toybox.go53
2 files changed, 55 insertions, 0 deletions
diff --git a/internal/rosa/all.go b/internal/rosa/all.go
index c76a15c4..5cffdbef 100644
--- a/internal/rosa/all.go
+++ b/internal/rosa/all.go
@@ -51,6 +51,7 @@ const (
Python
Rsync
Setuptools
+ Toybox
Wayland
WaylandProtocols
XCB
@@ -126,6 +127,7 @@ func (t Toolchain) ResolveName(name string) (p PArtifact, ok bool) {
"python": Python,
"rsync": Rsync,
"setuptools": Setuptools,
+ "toybox": Toybox,
"wayland": Wayland,
"wayland-protocols": WaylandProtocols,
"xcb": XCB,
diff --git a/internal/rosa/toybox.go b/internal/rosa/toybox.go
new file mode 100644
index 00000000..f2e83a08
--- /dev/null
+++ b/internal/rosa/toybox.go
@@ -0,0 +1,53 @@
+package rosa
+
+import "hakurei.app/internal/pkg"
+
+func (t Toolchain) newToybox() pkg.Artifact {
+ const (
+ version = "0.8.13"
+ checksum = "rZ1V1ATDte2WeQZanxLVoiRGdfPXhMlEo5-exX-e-ml8cGn9qOv0ABEUVZpX3wTI"
+ )
+ return t.New("toybox-"+version, false, stage3Concat(t, []pkg.Artifact{},
+ t.Load(Make),
+ t.Load(Bash),
+
+ t.Load(KernelHeaders),
+ ), nil, stage3Concat(t, []string{},
+ "ROSA_CHECK=make USER=cure tests",
+ ), `
+ln -s ../system/bin/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
+echo '
+CONFIG_EXPR=y
+CONFIG_TR=y
+CONFIG_AWK=y
+CONFIG_DIFF=y
+' >> .config
+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] = Toolchain.newToybox }