Reicher82 / python / sbpython3

Forked from python/sbpython3 3 years ago
Clone
Blob Blame History Raw
# cfghost.sh: map the target or native hosts, as reported by
# the -dumpmachine mechanism of their respective compilers,
# to project-specific hosts.

# internal variables of interest:
# mb_internal_cchost:  the host reported by -dumpmachine
# mb_internal_cfghost: the unified, project-specific host name
# mb_internal_cfgtype: the type of host being test (target/native)

cfghost_internal_test()
{
	if [ -z "$mb_internal_cchost" ]; then
		error_msg 'cfghost_internal_test(): $mb_internal_cchost is empty.'
		exit 2
	fi

	if [ -d "$mb_project_dir/config/$mb_internal_cchost" ]; then
		mb_internal_cfghost=$mb_internal_cchost
	fi

	if [ -z $mb_internal_cfghost ]; then
		case $mb_internal_cchost in
			*-linux | *-linux-* )
				mb_internal_cfghost='linux' ;;

			*-midipix | *-midipix-* )
				mb_internal_cfghost='midipix' ;;

			* )
				mb_internal_cfghost='any-host' ;;
		esac
	fi

	if [ $mb_internal_cfgtype = 'host' ]; then
		mb_cfghost="$mb_internal_cfghost"
	else
		mb_native_cfghost="$mb_internal_cfghost"
	fi
}

cfghost_set_target_cfghost()
{
	mb_internal_cchost="$mb_cchost"
	mb_internal_cfghost="$mb_cfghost"
	mb_internal_cfgtype='host'

	cfghost_internal_test
}

cfghost_set_native_cfghost()
{
	mb_internal_cchost="$mb_native_cchost"
	mb_internal_cfghost="$mb_native_cfghost"
	mb_internal_cfgtype='native'

	cfghost_internal_test
}