aboutsummaryrefslogtreecommitdiff
path: root/sys-apps/busybox/build.lua
blob: 6deb64576aa3aec14fd9e81ea994b7dc413a45f1 (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
local package = {}

package.name = "busybox"
package.version = "1.38.0"
package.description = "tiny single binary coreutils"
package.arch = { "x86_64" }
package.license = { "GPLv2" }

package.deps = {
	build = {
		{ provides = "cc" },
		{ provides = "make" },
	},
}

package.sources = {
	{
		path = "https://busybox.net/downloads/busybox-1.38.0.tar.bz2",
		hash = "71d1f0992bc99813e4e32d718004fadbd8315b300508094e37713555a2e394ca77f16874ec8be55961c0aa4141365dba27728e203895aadb2c112a84764a28d9",
		out = "source.tar.gz",
	},
}

local function fix_config(path)
	path = path or ".config"

	local f = io.open(path, "r")

	if not f then
		return nil, "cannot open"
	end

	local s = f:read("*all")

	f:close()

	s = s:gsub("CONFIG_TC=y", "CONFIG_TC=n")

	f = io.open(path, "w")

	f:write(s)

	f:close()

	return true
end -- tiny hack, disables TC to fix builds on kernel 6.8+

package.build = function()
	pow.extract("source.tar.gz", "source")

	pow.chdir("source/busybox-1.38.0")

	os.execute("make defconfig")
	fix_config()

	local make_command = string.format("make %s", pow.config.makeopts)

	os.execute(make_command)
end

package.install = function()
	pow.install("busybox", "/bin/busybox")
end

return package