Conan_Kudo / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone

Blame subr/build_args.subr

Lucio Andrés Illanes Albornoz (arab, vxp) 0185bc
#
Lucio Andrés Illanes Albornoz (arab, vxp) 0185bc
# set -o noglob is assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) 0185bc
#
Lucio Andrés Illanes Albornoz (arab, vxp) 0185bc
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
build_args() {
Lucio Andrés Illanes Albornoz b7d16e
	local _opt="" _shiftfl=0;
Lucio Andrés Illanes Albornoz b7d16e
	while [ "${#}" -gt 0 ]; do
Lucio Andrés Illanes Albornoz b7d16e
		case "${1}" in
Lucio Andrés Illanes Albornoz b7d16e
		--as-needed)	ARG_AS_NEEDED=1; _shiftfl=1; ;;
Lucio Andrés Illanes Albornoz b7d16e
		--debug-minipx)	ARG_DEBUG_MINIPIX=1; _shiftfl=1; ;;
Lucio Andrés Illanes Albornoz b7d16e
		-v*)		_opt="${1#-}"; while [ -n "${_opt}" ]; do
Lucio Andrés Illanes Albornoz b7d16e
					: $((ARG_VERBOSE+=1)); _opt="${_opt#?}";
Lucio Andrés Illanes Albornoz b7d16e
				done; _shiftfl=1; ;;
Lucio Andrés Illanes Albornoz b7d16e
		*)		_shiftfl=0; ;;
Lucio Andrés Illanes Albornoz b7d16e
		esac;
Lucio Andrés Illanes Albornoz b7d16e
		if [ "${_shiftfl}" -gt 0 ]; then
Lucio Andrés Illanes Albornoz b7d16e
			shift "${_shiftfl}"; continue;
Lucio Andrés Illanes Albornoz b7d16e
		elif getopts a:b:C:D:FhPr:R _opt; then
Lucio Andrés Illanes Albornoz b7d16e
			case "${_opt}" in
Lucio Andrés Illanes Albornoz b7d16e
			a)	ARCH="${OPTARG}"; ;;
Lucio Andrés Illanes Albornoz b7d16e
			b)	BUILD="${OPTARG}"; ;;	
Lucio Andrés Illanes Albornoz b7d16e
			C)	ARG_CLEAN_BUILDS="${OPTARG}"; ;;
Lucio Andrés Illanes Albornoz b7d16e
			D)	ARG_DIST="${OPTARG}"; ;;
Lucio Andrés Illanes Albornoz b7d16e
			F)	ARG_FETCH_FORCE=1; ;;
Lucio Andrés Illanes Albornoz b7d16e
			h)	cat etc/build.usage; exit 0; ;;
Lucio Andrés Illanes Albornoz b7d16e
			P)	ARG_PARALLEL="${OPTARG:-auto}"; ;;
Lucio Andrés Illanes Albornoz b7d16e
			r)	ARG_RESTART="${OPTARG}"; ;;
Lucio Andrés Illanes Albornoz b7d16e
			R)	ARG_RELAXED=1; ;;
Lucio Andrés Illanes Albornoz b7d16e
			*)	cat etc/build.usage; exit 1; ;;
Lucio Andrés Illanes Albornoz b7d16e
			esac; shift $((${OPTIND}-1));
Lucio Andrés Illanes Albornoz 03dd23
		else
Lucio Andrés Illanes Albornoz b7d16e
			break;
Lucio Andrés Illanes Albornoz 03dd23
		fi;
Lucio Andrés Illanes Albornoz 03dd23
	done;
Lucio Andrés Illanes Albornoz 8c791c
	if [ -n "${ARG_RESTART}" ]\
Lucio Andrés Illanes Albornoz 8c791c
	&& [ "${ARG_RESTART#\*}" != "${ARG_RESTART}" ]; then
Lucio Andrés Illanes Albornoz 8c791c
		ARG_RESTART="${ARG_RESTART#\*}"; ARG_RESTART_RECURSIVE=1;
Lucio Andrés Illanes Albornoz f84af6
	fi;
Lucio Andrés Illanes Albornoz cc86a5
	case "${ARG_RESTART}" in
Lucio Andrés Illanes Albornoz cc86a5
	ALL)	ARG_RESTART_AT=ALL; ;;
Lucio Andrés Illanes Albornoz cc86a5
	LAST)	ARG_RESTART_AT=""; ;;
Lucio Andrés Illanes Albornoz cc86a5
	"")	;;
Lucio Andrés Illanes Albornoz b7d16e
	*:*)	ARG_RESTART_AT="${ARG_RESTART#*:}"; ARG_RESTART="${ARG_RESTART%:*}"; ;;
Lucio Andrés Illanes Albornoz b7d16e
	*)	ARG_RESTART="$(echo "${ARG_RESTART}" | sed "s/,/ /g")"; ARG_RESTART_AT=ALL; ;;
Lucio Andrés Illanes Albornoz 03dd23
	esac;
Lucio Andrés Illanes Albornoz (arab, vxp) f6a5cb
	while [ ${#} -gt 0 ]; do
Lucio Andrés Illanes Albornoz (arab, vxp) f6a5cb
	case "${1}" in
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	*=*)	ex_rtl_set_var_unsafe "${1%%=*}" "${1#*=}"; ;;
Lucio Andrés Illanes Albornoz b96c60
	*)	BUILD_GROUPS="${BUILD_GROUPS:+${BUILD_GROUPS} }${1}"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) f6a5cb
	esac; shift; done;
Lucio Andrés Illanes Albornoz (arab, vxp) f6a5cb
};
Lucio Andrés Illanes Albornoz (arab, vxp) f6a5cb
Lucio Andrés Illanes Albornoz (arab, vxp) f6a5cb
# vim:filetype=sh