This repository has been archived by the owner on Jan 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
mk
executable file
·103 lines (90 loc) · 1.42 KB
/
mk
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
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/sh -e
_ROOT=$(readlink -f $(dirname $0))
_FILE=$_ROOT/file
_PATCH=$_ROOT/patch
_PKG=$_ROOT/pkg
_SRC=$_ROOT/src
_SUM=$_ROOT/sum
for _f in $_SRC/mk/*.sh; do
. $_f
done
unset _f
for _dir in \
bootstrap/cross \
bootstrap/native \
bootstrap/support \
build \
cache \
contain \
dest \
dist \
log \
repo; do
eval _$(undercase $(uppercase $_dir))=$_ROOT/$_dir
mkdir -p $_ROOT/$_dir
done
unset _dir
_usage() {
cat <<-EOF
mk <command|step> [<args>]
Commands:
sum <pkg>
clean [pkg]
link <pkg>
query <pkg> <field>
stale [pkg]
bump <pkg> <version>
bootstrap
image
enter
Ordered steps:
$(printf ' %s <pkg>\n' $MK_STEPS | grep -v ' pkg <')
pkg [pkg]
Options:
-k keep build artifacts
-f force rebuild or total clean
-n skip step dependencies
-j number of parallel build procs
-m message for bump
-v verbose output
EOF
exit 64
}
while getopts fknvj:m: opt; do
case $opt in
f)
MK_FORCE=yes
;;
k)
MK_KEEP=yes
;;
n)
MK_NO_STEP_DEP=yes
;;
v)
MK_VERBOSE=yes
;;
j)
MK_NPROC=$OPTARG
;;
m)
MK_MSG="$OPTARG"
;;
esac
done
unset opt
for i in $(seq $(($OPTIND - 1))); do
eval MK_FLAGS=\"\$FLAGS \$$i\"
done
unset i
shift $(( $OPTIND - 1 ))
action=$1
[ "$action" ] || _usage
shift
if is_step $action; then
run_step $action "$1"
elif is_cmd $action; then
run_cmd $action "$@"
else
_usage
fi