aboutsummaryrefslogtreecommitdiff
blob: 7e2282eb5496875e6ada011c2863e0812211d73c (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
#!/bin/bash

TOPDIR=__TOPDIR__

config_site_arch() {
	local host=$(echo ${CHOST/-/ } | awk '{print $1}')

	[[ ${host/arm.*eb/} != ${host} ]] && host=armeb
	[[ ${host/arm/} != ${host} ]] && [[ ${host} != armeb ]] && host=arm

	[[ ${host/mips.*el/} != ${host} ]] && host=mipsel

	#[[ ${host/i[4-5]/6} != ${host} ]] && host=i686

	echo ${host}
}

config_site_names() {
	local site_arch=$(config_site_arch)
	local sites=""
	local x

	[[ ${CHOST/-linux-/} != $CHOST ]] && sites="${sites} linux"
	[[ ${CHOST/darwin/} != $CHOST ]] && sites="${sites} darwin"

	[[ ${CHOST/-linux-uclibc/} != $CHOST ]] && sites="${sites} ${site_arch}-linux-uclibc linux-uclibc"
	[[ ${CHOST/-linux-gnu/} != $CHOST ]] && sites="${sites} ${site_arch}-linux-gnu linux-gnu"

	[[ ${CHOST/-linux-uclibceabi/} != $CHOST ]] && sites="${sites} ${site_arch}-linux-uclibceabi linux-uclibceabi"
	[[ ${CHOST/-linux-gnueabi/} != $CHOST ]] && sites="${sites} ${site_arch}-linux-gnueabi linux-gnueabi"

	for x in ${CHOST} ${sites} ${site}; do
		[[ -e ${TOPDIR}/$x ]] && echo ${TOPDIR}/$x
	done
}

if [[ ${CHOST} != "" ]]; then
	sites="$(config_site_names)"
	if [[ ${sites} != "" ]]; then
		for site in ${sites}; do
			echo "$(basename $0): loading site script $site"
			. ${site}
		done
	fi
	unset site
	unset sites
fi