aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/toybox.go
blob: 1bd118d6a041113a33589eadbf517dc01890df16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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
`)
	}
}