Blame subr/build_checks.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_checks() {
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	local __ _exit _pname;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	for __ in ${DEFAULT_CHECK_PATH_VARS}; do
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		if [ -z "${___:=$(ex_rtl_get_var_unsafe "${__}")}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			ex_rtl_log_msg failexit "Error: variable \`${__}' is empty or unset.";
Lucio Andrés Illanes Albornoz (arab, vxp) d1adc7
		elif [ "${___#* *}" != "${___}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			ex_rtl_log_msg failexit "Error: variable \`${__}' contains one or more whitespace characters.";
Lucio Andrés Illanes Albornoz (arab, vxp) d1adc7
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) d1adc7
	done;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	for __ in ${DEFAULT_CHECK_PREREQ_CMDS} $(eval echo ${DEFAULT_CHECK_PREREQ_FILES_DYNAMIC}) ${DEFAULT_CHECK_PREREQ_FILES}; do
Lucio Andrés Illanes Albornoz (arab, vxp) d1adc7
		if [ "${__#/}" != "${__}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) d1adc7
			if [ ! -e "${__}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
				ex_rtl_log_msg fail "Error: missing prerequisite file \`${__}'.";
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
				_exit=1;
Lucio Andrés Illanes Albornoz (arab, vxp) d1adc7
			fi;
Lucio Andrés Illanes Albornoz (arab, vxp) d1adc7
		else
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			if ! ex_rtl_test_cmd "${__}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
				ex_rtl_log_msg fail "Error: missing prerequisite command \`${__}'.";
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
				_exit=1;
Lucio Andrés Illanes Albornoz (arab, vxp) d1adc7
			fi;
Lucio Andrés Illanes Albornoz (arab, vxp) d1adc7
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) d1adc7
	done;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	for __ in ${DEFAULT_CHECK_PREREQ_PERL_MODULES}; do
Lucio Andrés Illanes Albornoz (arab, vxp) d1adc7
		if ! perl -M"${__}" -e "" 2>/dev/null; then
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			ex_rtl_log_msg fail "Error: missing prerequisite Perl module \`${__}'.";
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
			_exit=1;
Lucio Andrés Illanes Albornoz (arab, vxp) d1adc7
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) d1adc7
	done;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
	if [ ${_exit:-0} = 1 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) d1adc7
		exit 1;
Lucio Andrés Illanes Albornoz (arab, vxp) d1adc7
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) eab6ce
	if [ "${ARG_AS_NEEDED:-0}" -eq 1 ]\
Lucio Andrés Illanes Albornoz (arab, vxp) eab6ce
	&& [ -e "${PREFIX}/build.gitref" ]\
Lucio Andrés Illanes Albornoz (arab, vxp) eab6ce
	&& [ "$(git rev-parse HEAD)" = "$(cat "${PREFIX}/build.gitref")" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) eab6ce
		ex_rtl_log_msg info "Git repository has not changed since last build and --as-needed was specified.";
Lucio Andrés Illanes Albornoz (arab, vxp) eab6ce
		exit 0;
Lucio Andrés Illanes Albornoz (arab, vxp) eab6ce
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	if [ ${ARG_CLEAN:-0} -eq 1 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_rtl_log_msg info "-c specified, cleaning prefix...";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		for _pname in ${DEFAULT_CLEAR_PREFIX_PATHS}; do
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			ex_rtl_fileop rm ${PREFIX}/${_pname};
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		done;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) d1adc7
};
Lucio Andrés Illanes Albornoz (arab, vxp) d1adc7
Lucio Andrés Illanes Albornoz (arab, vxp) d1adc7
# vim:filetype=sh