summaryrefslogtreecommitdiff
path: root/pkg/ubase/gen.lua
blob: 7048ba53e43c82e65b82ab2b3d8ae32cff248c96 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
cflags{
	'-std=c99', '-Wall', '-Wpedantic',
	'-Wno-maybe-uninitialized', '-Wno-overflow', '-Wno-format-truncation',
	'-D _GNU_SOURCE',
	'-D _XOPEN_SOURCE=700',
	'-I $dir',
}

lib('libutil.a', [[libutil/(
	agetcwd.c
	agetline.c
	apathmax.c
	concat.c
	ealloc.c
	eprintf.c
	estrtol.c
	estrtoul.c
	explicit_bzero.c
	passwd.c
	proc.c
	putword.c
	recurse.c
	strlcat.c
	strlcpy.c
	strtonum.c
	tty.c
)]])

local tools = {
	{'blkdiscard', 8},
	{'chvt', 1},
	{'clear', 1},
	{'ctrlaltdel', 8},
	{'df', 1},
	{'dmesg', 1},
	{'eject', 1},
	{'fallocate', 1},
	{'free', 1},
	{'freeramdisk', 8},
	{'fsfreeze', 8},
	{'getty', 8},
	{'halt', 8},
	{'hwclock', 8},
	{'id', 1},
	{'insmod', 8},
	{'killall5', 8},
	{'last'},
	{'lastlog', 8},
	{'login', 1},
	{'lsmod', 8},
	{'lsusb', 8},
	{'mesg', 1},
	{'mkswap', 8},
	{'mount', 8},
	{'mountpoint', 1},
	{'nologin', 8},
	{'pagesize', 1},
	{'passwd', 1, '4755'},
	{'pidof', 1},
	{'pivot_root', 8},
	{'ps', 1},
	{'pwdx', 1},
	{'readahead', 8},
	{'respawn', 1},
	{'rmmod', 8},
	{'stat', 1},
	{'stty'},
	{'swaplabel', 8},
	{'swapoff', 8},
	{'swapon', 8},
	{'switch_root', 8},
	{'sysctl', 8},
	{'truncate', 1},
	{'umount', 8},
	{'unshare', 1},
	{'uptime', 1},
	{'vmstat'},
	{'vtallow', 1},
	{'watch', 1},
	{'who', 1},
}

for _, tool in ipairs(tools) do
	local name, sect, mode = tool[1], tool[2], tool[3]
	file('bin/'..name, mode or '755', exe(name, {name..'.c', 'libutil.a'}))
	if sect then
		man{name..'.'..sect}
	end
end

fetch 'git'