Blob Blame History Raw
#
# set -o noglob is assumed.
#

build_args() {
	local _opt="" _shiftfl=0;
	while [ "${#}" -gt 0 ]; do
		case "${1}" in
		--as-needed)	ARG_AS_NEEDED=1; _shiftfl=1; ;;
		--debug-minipx)	ARG_DEBUG_MINIPIX=1; _shiftfl=1; ;;
		-v*)		_opt="${1#-}"; while [ -n "${_opt}" ]; do
					: $((ARG_VERBOSE+=1)); _opt="${_opt#?}";
				done; _shiftfl=1; ;;
		*)		_shiftfl=0; ;;
		esac;
		if [ "${_shiftfl}" -gt 0 ]; then
			shift "${_shiftfl}"; continue;
		elif getopts a:b:C:D:FhPr:R _opt; then
			case "${_opt}" in
			a)	ARCH="${OPTARG}"; ;;
			b)	BUILD="${OPTARG}"; ;;	
			C)	ARG_CLEAN_BUILDS="${OPTARG}"; ;;
			D)	ARG_DIST="${OPTARG}"; ;;
			F)	ARG_FETCH_FORCE=1; ;;
			h)	cat etc/build.usage; exit 0; ;;
			P)	ARG_PARALLEL="${OPTARG:-auto}"; ;;
			r)	ARG_RESTART="${OPTARG}"; ;;
			R)	ARG_RELAXED=1; ;;
			*)	cat etc/build.usage; exit 1; ;;
			esac; shift $((${OPTIND}-1));
		else
			break;
		fi;
	done;
	if [ -n "${ARG_RESTART}" ]\
	&& [ "${ARG_RESTART#\*}" != "${ARG_RESTART}" ]; then
		ARG_RESTART="${ARG_RESTART#\*}"; ARG_RESTART_RECURSIVE=1;
	fi;
	case "${ARG_RESTART}" in
	ALL)	ARG_RESTART_AT=ALL; ;;
	LAST)	ARG_RESTART_AT=""; ;;
	"")	;;
	*:*)	ARG_RESTART_AT="${ARG_RESTART#*:}"; ARG_RESTART="${ARG_RESTART%:*}"; ;;
	*)	ARG_RESTART="$(echo "${ARG_RESTART}" | sed "s/,/ /g")"; ARG_RESTART_AT=ALL; ;;
	esac;
	while [ ${#} -gt 0 ]; do
	case "${1}" in
	*=*)	ex_rtl_set_var_unsafe "${1%%=*}" "${1#*=}"; ;;
	*)	BUILD_GROUPS="${BUILD_GROUPS:+${BUILD_GROUPS} }${1}"; ;;
	esac; shift; done;
};

# vim:filetype=sh