version 1.257, 2012/10/18 16:15:29 |
version 1.258, 2012/10/31 13:05:09 |
Line 263 progname=${0##*/} |
|
Line 263 progname=${0##*/} |
|
toppid=$$ |
toppid=$$ |
results=/dev/null |
results=/dev/null |
tab=' ' |
tab=' ' |
|
nl=' |
|
' |
trap "exit 1" 1 2 3 15 |
trap "exit 1" 1 2 3 15 |
|
|
bomb() |
bomb() |
|
|
|
|
} |
} |
|
|
|
# valid_MACHINE_ARCH -- A multi-line string, listing all valid |
|
# MACHINE/MACHINE_ARCH pairs. |
|
# |
|
# Each line contains a MACHINE and MACHINE_ARCH value, an optional ALIAS |
|
# which may be used to refer to the MACHINE/MACHINE_ARCH pair, and an |
|
# optional DEFAULT or NO_DEFAULT keyword. |
|
# |
|
# When a MACHINE corresponds to multiple possible values of |
|
# MACHINE_ARCH, then this table should list all allowed combinations. |
|
# If the MACHINE is associated with a default MACHINE_ARCH (to be |
|
# used when the user specifies the MACHINE but fails to specify the |
|
# MACHINE_ARCH), then one of the lines should have the "DEFAULT" |
|
# keyword. If there is no default MACHINE_ARCH for a particular |
|
# MACHINE, then there should be a line with the "NO_DEFAULT" keyword, |
|
# and with a blank MACHINE_ARCH. |
|
# |
|
valid_MACHINE_ARCH=' |
|
MACHINE=acorn26 MACHINE_ARCH=arm |
|
MACHINE=acorn32 MACHINE_ARCH=arm |
|
MACHINE=algor MACHINE_ARCH=mips64el ALIAS=algor64 |
|
MACHINE=algor MACHINE_ARCH=mipsel DEFAULT |
|
MACHINE=alpha MACHINE_ARCH=alpha |
|
MACHINE=amd64 MACHINE_ARCH=x86_64 |
|
MACHINE=amiga MACHINE_ARCH=m68k |
|
MACHINE=amigappc MACHINE_ARCH=powerpc |
|
MACHINE=arc MACHINE_ARCH=mips64el ALIAS=arc64 |
|
MACHINE=arc MACHINE_ARCH=mipsel DEFAULT |
|
MACHINE=atari MACHINE_ARCH=m68k |
|
MACHINE=bebox MACHINE_ARCH=powerpc |
|
MACHINE=cats MACHINE_ARCH=arm DEFAULT |
|
MACHINE=cats MACHINE_ARCH=earm |
|
MACHINE=cesfic MACHINE_ARCH=m68k |
|
MACHINE=cobalt MACHINE_ARCH=mips64el ALIAS=cobalt64 |
|
MACHINE=cobalt MACHINE_ARCH=mipsel DEFAULT |
|
MACHINE=dreamcast MACHINE_ARCH=sh3el |
|
MACHINE=emips MACHINE_ARCH=mipseb |
|
MACHINE=evbarm MACHINE_ARCH=arm ALIAS=evbarm-el DEFAULT |
|
MACHINE=evbarm MACHINE_ARCH=armeb ALIAS=evbarm-eb |
|
MACHINE=evbarm MACHINE_ARCH=earm ALIAS=evbearm-el |
|
MACHINE=evbarm MACHINE_ARCH=earmeb ALIAS=evbearm-eb |
|
MACHINE=evbmips MACHINE_ARCH= NO_DEFAULT |
|
MACHINE=evbmips MACHINE_ARCH=mips64eb ALIAS=evbmips64-eb |
|
MACHINE=evbmips MACHINE_ARCH=mips64el ALIAS=evbmips64-el |
|
MACHINE=evbmips MACHINE_ARCH=mipseb ALIAS=evbmips-eb |
|
MACHINE=evbmips MACHINE_ARCH=mipsel ALIAS=evbmips-el |
|
MACHINE=evbppc MACHINE_ARCH=powerpc DEFAULT |
|
MACHINE=evbppc MACHINE_ARCH=powerpc64 ALIAS=evbppc64 |
|
MACHINE=evbsh3 MACHINE_ARCH= NO_DEFAULT |
|
MACHINE=evbsh3 MACHINE_ARCH=sh3eb ALIAS=evbsh3-eb |
|
MACHINE=evbsh3 MACHINE_ARCH=sh3el ALIAS=evbsh3-el |
|
MACHINE=ews4800mips MACHINE_ARCH=mipseb |
|
MACHINE=hp300 MACHINE_ARCH=m68k |
|
MACHINE=hp700 MACHINE_ARCH=hppa |
|
MACHINE=hpcarm MACHINE_ARCH=arm |
|
MACHINE=hpcmips MACHINE_ARCH=mipsel |
|
MACHINE=hpcsh MACHINE_ARCH=sh3el |
|
MACHINE=i386 MACHINE_ARCH=i386 |
|
MACHINE=ia64 MACHINE_ARCH=ia64 |
|
MACHINE=ibmnws MACHINE_ARCH=powerpc |
|
MACHINE=iyonix MACHINE_ARCH=arm DEFAULT |
|
MACHINE=iyonix MACHINE_ARCH=earm |
|
MACHINE=landisk MACHINE_ARCH=sh3el |
|
MACHINE=luna68k MACHINE_ARCH=m68k |
|
MACHINE=mac68k MACHINE_ARCH=m68k |
|
MACHINE=macppc MACHINE_ARCH=powerpc DEFAULT |
|
MACHINE=macppc MACHINE_ARCH=powerpc64 ALIAS=macppc64 |
|
MACHINE=mipsco MACHINE_ARCH=mipseb |
|
MACHINE=mmeye MACHINE_ARCH=sh3eb |
|
MACHINE=mvme68k MACHINE_ARCH=m68k |
|
MACHINE=mvmeppc MACHINE_ARCH=powerpc |
|
MACHINE=netwinder MACHINE_ARCH=arm DEFAULT |
|
MACHINE=netwinder MACHINE_ARCH=earm |
|
MACHINE=news68k MACHINE_ARCH=m68k |
|
MACHINE=newsmips MACHINE_ARCH=mipseb |
|
MACHINE=next68k MACHINE_ARCH=m68k |
|
MACHINE=ofppc MACHINE_ARCH=powerpc DEFAULT |
|
MACHINE=ofppc MACHINE_ARCH=powerpc64 ALIAS=ofppc64 |
|
MACHINE=pmax MACHINE_ARCH=mips64el ALIAS=pmax64 |
|
MACHINE=pmax MACHINE_ARCH=mipsel DEFAULT |
|
MACHINE=prep MACHINE_ARCH=powerpc |
|
MACHINE=rs6000 MACHINE_ARCH=powerpc |
|
MACHINE=sandpoint MACHINE_ARCH=powerpc |
|
MACHINE=sbmips MACHINE_ARCH= NO_DEFAULT |
|
MACHINE=sbmips MACHINE_ARCH=mips64eb ALIAS=sbmips64-eb |
|
MACHINE=sbmips MACHINE_ARCH=mips64el ALIAS=sbmips64-el |
|
MACHINE=sbmips MACHINE_ARCH=mipseb ALIAS=sbmips-eb |
|
MACHINE=sbmips MACHINE_ARCH=mipsel ALIAS=sbmips-el |
|
MACHINE=sgimips MACHINE_ARCH=mips64eb ALIAS=sgimips64 |
|
MACHINE=sgimips MACHINE_ARCH=mipseb DEFAULT |
|
MACHINE=shark MACHINE_ARCH=arm DEFAULT |
|
MACHINE=shark MACHINE_ARCH=earm |
|
MACHINE=sparc MACHINE_ARCH=sparc |
|
MACHINE=sparc64 MACHINE_ARCH=sparc64 |
|
MACHINE=sun2 MACHINE_ARCH=m68000 |
|
MACHINE=sun3 MACHINE_ARCH=m68k |
|
MACHINE=vax MACHINE_ARCH=vax |
|
MACHINE=x68k MACHINE_ARCH=m68k |
|
MACHINE=zaurus MACHINE_ARCH=arm DEFAULT |
|
MACHINE=zaurus MACHINE_ARCH=earm |
|
' |
|
|
|
# getarch -- find the default MACHINE_ARCH for a MACHINE, |
|
# or convert an alias to a MACHINE/MACHINE_ARCH pair. |
|
# |
|
# Saves MACHINE in makewrappermachine before possibly modifying MACHINE. |
|
# |
|
# Sets MACHINE and MACHINE_ARCH if the input MACHINE value is |
|
# recognised as an alias, or recognised as a machine that has a default |
|
# MACHINE_ARCH (or that has only one possible MACHINE_ARCH). |
|
# |
|
# Leaves MACHINE and MACHINE_ARCH unchanged if MACHINE is recognised |
|
# as being associated with multiple MACHINE_ARCH values with no default. |
|
# |
|
# Bombs if MACHINE is not recognised. |
|
# |
getarch() |
getarch() |
{ |
{ |
# Translate some MACHINE name aliases (known only to build.sh) |
local IFS |
# into proper MACHINE and MACHINE_ARCH names. Save the alias |
local found="" |
# name in makewrappermachine. |
local line |
# |
|
case "${MACHINE}" in |
IFS="${nl}" |
|
makewrappermachine="${MACHINE}" |
evbearm-e[bl]) |
for line in ${valid_MACHINE_ARCH}; do |
makewrappermachine=${MACHINE} |
line="${line%%#*}" # ignore comments |
# MACHINE_ARCH is "arm" or "armeb", not "armel" |
line="$( IFS=" ${tab}" ; echo $line )" # normalise white space |
MACHINE_ARCH=earm${MACHINE##*-} |
case "${line} " in |
MACHINE_ARCH=${MACHINE_ARCH%el} |
"") |
MACHINE=evbarm |
# skip blank lines or comment lines |
;; |
continue |
|
;; |
evbarm-e[bl]) |
*" ALIAS=${MACHINE} "*) |
makewrappermachine=${MACHINE} |
# Found a line with a matching ALIAS=<alias>. |
# MACHINE_ARCH is "arm" or "armeb", not "armel" |
found="$line" |
MACHINE_ARCH=arm${MACHINE##*-} |
break |
MACHINE_ARCH=${MACHINE_ARCH%el} |
;; |
MACHINE=${MACHINE%-e[bl]} |
"MACHINE=${MACHINE} "*" NO_DEFAULT"*) |
;; |
# Found an explicit "NO_DEFAULT" for this MACHINE. |
|
found="$line" |
evbmips-e[bl]|sbmips-e[bl]) |
break |
makewrappermachine=${MACHINE} |
;; |
MACHINE_ARCH=mips${MACHINE##*-} |
"MACHINE=${MACHINE} "*" DEFAULT"*) |
MACHINE=${MACHINE%-e[bl]} |
# Found an explicit "DEFAULT" for this MACHINE. |
;; |
found="$line" |
|
break |
evbmips64-e[bl]|sbmips64-e[bl]) |
;; |
makewrappermachine=${MACHINE} |
"MACHINE=${MACHINE} "*) |
MACHINE_ARCH=mips64${MACHINE##*-} |
# Found a line for this MACHINE. If it's the |
MACHINE=${MACHINE%64-e[bl]} |
# first such line, then tentatively accept it. |
;; |
# If it's not the first matching line, then |
|
# remember that there was more than one match. |
evbsh3-e[bl]) |
case "$found" in |
makewrappermachine=${MACHINE} |
'') found="$line" ;; |
MACHINE_ARCH=sh3${MACHINE##*-} |
*) found="MULTIPLE_MATCHES" ; break ;; |
MACHINE=${MACHINE%-e[bl]} |
esac |
;; |
;; |
|
esac |
esac |
done |
|
|
# Translate a MACHINE into a default MACHINE_ARCH. |
|
# |
|
case "${MACHINE}" in |
|
|
|
acorn26|acorn32|cats|hpcarm|iyonix|netwinder|shark|zaurus) |
|
MACHINE_ARCH=arm |
|
;; |
|
|
|
evbarm) # unspecified MACHINE_ARCH gets LE |
|
MACHINE_ARCH=${MACHINE_ARCH:=arm} |
|
;; |
|
|
|
hp700) |
|
MACHINE_ARCH=hppa |
|
;; |
|
|
|
sun2) |
|
MACHINE_ARCH=m68000 |
|
;; |
|
|
|
amiga|atari|cesfic|hp300|luna68k|mac68k|mvme68k|news68k|next68k|sun3|x68k) |
|
MACHINE_ARCH=m68k |
|
;; |
|
|
|
evbmips|sbmips) # no default MACHINE_ARCH |
|
;; |
|
|
|
sgimips64) |
|
makewrappermachine=${MACHINE} |
|
MACHINE=${MACHINE%64} |
|
MACHINE_ARCH=mips64eb |
|
;; |
|
|
|
ews4800mips|mipsco|newsmips|sgimips|emips) |
|
MACHINE_ARCH=mipseb |
|
;; |
|
|
|
algor64|arc64|cobalt64|pmax64) |
|
makewrappermachine=${MACHINE} |
|
MACHINE=${MACHINE%64} |
|
MACHINE_ARCH=mips64el |
|
;; |
|
|
|
algor|arc|cobalt|hpcmips|pmax) |
|
MACHINE_ARCH=mipsel |
|
;; |
|
|
|
evbppc64|macppc64|ofppc64) |
|
makewrappermachine=${MACHINE} |
|
MACHINE=${MACHINE%64} |
|
MACHINE_ARCH=powerpc64 |
|
;; |
|
|
|
amigappc|bebox|evbppc|ibmnws|macppc|mvmeppc|ofppc|prep|rs6000|sandpoint) |
|
MACHINE_ARCH=powerpc |
|
;; |
|
|
|
evbsh3) # no default MACHINE_ARCH |
|
;; |
|
|
|
mmeye) |
|
MACHINE_ARCH=sh3eb |
|
;; |
|
|
|
dreamcast|hpcsh|landisk) |
|
MACHINE_ARCH=sh3el |
|
;; |
|
|
|
amd64) |
|
MACHINE_ARCH=x86_64 |
|
;; |
|
|
|
alpha|i386|sparc|sparc64|vax|ia64) |
case "$found" in |
MACHINE_ARCH=${MACHINE} |
*NO_DEFAULT*|*MULTIPLE_MATCHES*) |
|
# MACHINE is OK, but MACHINE_ARCH is still unknown |
|
return |
|
;; |
|
"MACHINE="*" MACHINE_ARCH="*) |
|
# Obey the MACHINE= and MACHINE_ARCH= parts of the line. |
|
IFS=" " |
|
for frag in ${found}; do |
|
case "$frag" in |
|
MACHINE=*|MACHINE_ARCH=*) |
|
eval "$frag" |
|
;; |
|
esac |
|
done |
;; |
;; |
|
|
*) |
*) |
bomb "Unknown target MACHINE: ${MACHINE}" |
bomb "Unknown target MACHINE: ${MACHINE}" |
;; |
;; |
|
|
esac |
esac |
} |
} |
|
|
|
# validatearch -- check that the MACHINE/MACHINE_ARCH pair is supported. |
|
# |
|
# Bombs if the pair is not supported. |
|
# |
validatearch() |
validatearch() |
{ |
{ |
# Ensure that the MACHINE_ARCH exists (and is supported by build.sh). |
local IFS |
# |
local line |
case "${MACHINE_ARCH}" in |
local foundpair=false foundmachine=false foundarch=false |
|
|
alpha|arm|armeb|earm|earmeb|hppa|i386|m68000|m68k|mipse[bl]|mips64e[bl]|powerpc|powerpc64|sh3e[bl]|sparc|sparc64|vax|x86_64|ia64) |
|
;; |
|
|
|
|
case "${MACHINE_ARCH}" in |
"") |
"") |
bomb "No MACHINE_ARCH provided" |
bomb "No MACHINE_ARCH provided" |
;; |
;; |
|
|
*) |
|
bomb "Unknown target MACHINE_ARCH: ${MACHINE_ARCH}" |
|
;; |
|
|
|
esac |
esac |
|
|
# Determine valid MACHINE_ARCHs for MACHINE |
IFS="${nl}" |
# |
for line in ${valid_MACHINE_ARCH}; do |
case "${MACHINE}" in |
line="${line%%#*}" # ignore comments |
|
line="$( IFS=" ${tab}" ; echo $line )" # normalise white space |
evbarm) |
case "${line} " in |
arches="arm armeb earm earmeb" |
"") |
;; |
# skip blank lines or comment lines |
|
continue |
cats|iyonix|netwinder|shark|zaurus) |
;; |
arches="arm earm" |
"MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH} "*) |
;; |
foundpair=true |
|
;; |
algor|arc|cobalt|pmax) |
"MACHINE=${MACHINE} "*) |
arches="mipsel mips64el" |
foundmachine=true |
;; |
;; |
|
*"MACHINE_ARCH=${MACHINE_ARCH} "*) |
evbmips|sbmips) |
foundarch=true |
arches="mipseb mipsel mips64eb mips64el" |
;; |
;; |
esac |
|
done |
|
|
sgimips) |
case "${foundpair}:${foundmachine}:${foundarch}" in |
arches="mipseb mips64eb" |
true:*) |
|
: OK |
;; |
;; |
|
*:false:*) |
evbsh3) |
bomb "Unknown target MACHINE: ${MACHINE}" |
arches="sh3eb sh3el" |
|
;; |
;; |
|
*:*:false) |
macppc|evbppc|ofppc) |
bomb "Unknown target MACHINE_ARCH: ${MACHINE_ARCH}" |
arches="powerpc powerpc64" |
|
;; |
;; |
*) |
*) |
oma="${MACHINE_ARCH}" |
bomb "MACHINE_ARCH '${MACHINE_ARCH}' does not support MACHINE '${MACHINE}'" |
getarch |
|
arches="${MACHINE_ARCH}" |
|
MACHINE_ARCH="${oma}" |
|
;; |
;; |
|
|
esac |
esac |
|
|
# Ensure that MACHINE_ARCH supports MACHINE |
|
# |
|
archok=false |
|
for a in ${arches}; do |
|
if [ "${a}" = "${MACHINE_ARCH}" ]; then |
|
archok=true |
|
break |
|
fi |
|
done |
|
${archok} || |
|
bomb "MACHINE_ARCH '${MACHINE_ARCH}' does not support MACHINE '${MACHINE}'" |
|
} |
} |
|
|
# nobomb_getmakevar -- |
# nobomb_getmakevar -- |