|
|
return 0 | return 0 |
} | } |
| |
|
# files_exist <paths> <files> (both :-separated) |
|
# Return 0 if all <files> are found in at least one of <paths> |
|
# Return 1 if one or more <files> cannot be found in any <paths> |
|
files_exist() { |
|
local paths files pathn filen ok old_IFS |
|
paths=$1 |
|
files=$2 |
|
old_IFS="${IFS}" |
|
export IFS=":" |
|
for filen in ${files}; do |
|
if [[ ${filen:0:1} == "/" ]]; then |
|
[[ -f ${filen} ]] && ok=0 || ok=1 |
|
else |
|
ok=1 |
|
for pathn in ${paths}; do |
|
[[ -f ${pathn}/${filen} ]] && ok=0 && break |
|
done |
|
[[ ${ok} == 1 ]] && break |
|
fi |
|
done |
|
export IFS="${old_IFS}" |
|
return ${ok} |
|
} |
|
|
cmd_setup() { | cmd_setup() { |
# Sourcing /etc/env.d/gcc/${CC_COMP} is going to mess up | # Sourcing /etc/env.d/gcc/${CC_COMP} is going to mess up |
# PATH among things... | # PATH among things... |
|
|
${AWK} '!/^(STDCXX_INCDIR|LDPATH|CC|CXX|CTARGET|GCCBITS|GCC_SPECS)=/ {print $0}' \ | ${AWK} '!/^(STDCXX_INCDIR|LDPATH|CC|CXX|CTARGET|GCCBITS|GCC_SPECS)=/ {print $0}' \ |
"${GCC_ENV_D}/${CC_COMP}" > "${ENV_D}/05gcc" | "${GCC_ENV_D}/${CC_COMP}" > "${ENV_D}/05gcc" |
echo "LDPATH=\"${MY_LDPATH}\"" >> "${ENV_D}/05gcc" | echo "LDPATH=\"${MY_LDPATH}\"" >> "${ENV_D}/05gcc" |
if [[ -n ${GCC_SPECS} ]] && [[ -e ${ROOT}/${GCC_SPECS} ]] ; then |
# Verify all GCC_SPECS files exist either as full paths or relative |
|
# to an LDPATH entry |
|
if [[ -n ${GCC_SPECS} ]] && files_exist ${MY_LDPATH} ${GCC_SPECS} ; then |
echo "GCC_SPECS=\"${GCC_SPECS}\"" >> "${ENV_D}/05gcc" | echo "GCC_SPECS=\"${GCC_SPECS}\"" >> "${ENV_D}/05gcc" |
else | else |
# People need to rebuild their gcc or setting GCC_SPECS to | # People need to rebuild their gcc or setting GCC_SPECS to |