-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathgen_dot_install.sh
executable file
·50 lines (44 loc) · 1.03 KB
/
gen_dot_install.sh
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
#!/bin/sh
install_file() {
# install_file <src> [dest]
if [ -z "$2" ]; then
printf ' "%s"\n' "$1"
else
printf ' "%s" { "%s" }\n' "$1" "$2"
fi
}
walk_tree() {
# walk_tree <srcprefix> <destprefix> [extension]
# where *prefix are not empty
for f in "$1"/*"$3"; do
base="${f##*/}"
if [ -d "$f" ]; then
walk_tree "$f" "$2/$base" "$3"
else
install_file "$f" "$2/$base"
fi
done
}
main() {
printf '%s: [\n' bin
for f in "$@"; do
install_file "$f"
done
printf ']\n'
printf '%s: [\n' lib_root
install_file _build/solo5.conf findlib.conf.d/solo5.conf
printf ']\n'
printf '%s: [\n' lib
walk_tree nolibc/include include
install_file nolibc/libnolibc.a lib/libnolibc.a
walk_tree openlibm/include include
walk_tree openlibm/src include .h
install_file openlibm/libopenlibm.a lib/libopenlibm.a
# dummy packages
for pkg in nolibc threads is_solo5; do
install_file _build/empty-META lib/$pkg/META
done
printf ']\n'
}
# The only arguments are the toolchain tools
main "$@"