blob: 34875047405df395a3231b3c99f1b37bed55ce36 (
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
92
93
94
95
96
97
98
99
|
#
# set -o noglob is assumed.
#
BUILD_ARGS_SPEC="
ARG_IPV4_ONLY:-4:
ARG_IPV6_ONLY:-6:
ARCH:arg:-a:
BUILD:arg:-b:
ARG_CLEAN:-c:
ARG_CLEAN_BUILDS:arg:-C:
ARG_DEBUG_MINIPIX:--debug-minipix:
ARG_OFFLINE:-N:
ARG_PACKAGE:-p:
ARG_PARALLEL:optarg:-P:auto
ARG_RELAXED:-R:
ARG_RESTART:arg:-r:
ARG_TARBALL:selfarg:-t:
ARG_TARBALL:selfarg:-t.bz2;
ARG_TARBALL:selfarg:-t.gz:
ARG_TARBALL:selfarg:-t.xz:
ARG_VERBOSE:selfarg:-v:
ARG_VERBOSE:selfarg:-vv:
ARG_VERBOSE:selfarg:-vvv:
ARG_XTRACE:-x:";
build_args() {
local _spec="${BUILD_ARGS_SPEC}" _spec_arg _found;
while [ ${#} -gt 0 ]; do
if [ "${1#-}" = "${1}" ]; then
break;
fi;
for _spec_arg in ${_spec}; do
case "${_spec_arg}" in
*:${1}:*)
case "${_spec_arg#*:}" in
arg:*)
ex_rtl_set_var_unsafe "${_spec_arg%%:*}" "${2}"; shift; ;;
optarg:*)
if [ -n "${2}" ]\
&& [ "x${2#-}" = "x${2}" ]; then
ex_rtl_set_var_unsafe "${_spec_arg%%:*}" "${2}";
shift;
else
ex_rtl_set_var_unsafe "${_spec_arg%%:*}" \
"${_spec_arg##*:}";
fi; ;;
selfarg:*)
ex_rtl_set_var_unsafe "${_spec_arg%%:*}" "${1}"; ;;
*)
ex_rtl_set_var_unsafe "${_spec_arg%%:*}" 1; ;;
esac; _found=1; break; ;;
*) _found=0; ;;
esac;
done;
if [ "${_found:-0}" -eq 0 ]; then
exec cat etc/build.usage;
else
shift;
fi;
done;
if [ -n "${ARG_CLEAN_BUILDS}" ]; then
ARG_CLEAN_BUILDS="$(echo "${ARG_CLEAN_BUILDS}" | sed "s/,/ /g")";
fi;
if [ -n "${ARG_CLEAN_BUILDS}" ]\
|| [ "${ARG_PACKAGE:-0}" -eq 1 ]\
&& [ -n "${ARG_TARBALL}" ]; then
unset ARG_TARBALL;
elif [ -n "${ARG_TARBALL}" ]; then
if [ "${ARG_TARBALL#-t.}" != "${ARG_TARBALL}" ]; then
TARBALL_SUFFIX="${ARG_TARBALL#-t.}";
else
TARBALL_SUFFIX=xz;
fi;
fi;
case "${ARG_VERBOSE}" in
-v) ARG_VERBOSE=1; ;;
-vv) ARG_VERBOSE=2; ;;
-vvv) ARG_VERBOSE=3; ;;
esac;
if [ "${ARG_XTRACE:-0}" -eq 1 ]; then
ARG_VERBOSE=2;
fi;
if [ -n "${ARG_RESTART}" ]; then
if [ "${ARG_RESTART%:*}" != "${ARG_RESTART}" ]; then
ARG_RESTART_AT="${ARG_RESTART#*:}"; ARG_RESTART="${ARG_RESTART%:*}";
else
ARG_RESTART_AT=ALL;
fi;
ARG_RESTART="$(echo "${ARG_RESTART}" | sed "s/,/ /g")";
fi;
while [ ${#} -gt 0 ]; do
case "${1}" in
*=*) ex_rtl_set_var_unsafe "${1%%=*}" "${1#*=}"; ;;
*) BUILD_TARGETS_META="${BUILD_TARGETS_META:+${BUILD_TARGETS_META} }${1}"; ;;
esac; shift; done;
};
# vim:filetype=sh
|