-
Notifications
You must be signed in to change notification settings - Fork 31
/
gen_dot_install.sh
executable file
·64 lines (55 loc) · 1.37 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh
if [ ! -e "$1.lib" ] || [ ! -e "$1.libexec" ]; then
echo "Usage: $0 <prefix.file.install>"
echo "The *.install.lib and *.install.libexec for OCaml must be available."
exit 1
fi
prefix_for_ocaml_chunks="$1"
shift
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' libexec
cat "$prefix_for_ocaml_chunks".libexec
printf ']\n'
printf '%s: [\n' lib
cat "$prefix_for_ocaml_chunks".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 left are the toolchain tools
main "$@"