add require_cc()
to test existence of CC other than GCC
This commit is contained in:
parent
152ebe6e61
commit
9ce760c798
@ -622,30 +622,48 @@ fix_directory_permissions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
require_gcc() {
|
require_gcc() {
|
||||||
local gcc="$(locate_gcc || true)"
|
require_cc "gcc"
|
||||||
|
}
|
||||||
|
|
||||||
if [ -z "$gcc" ]; then
|
require_cc() {
|
||||||
|
local cc ccname
|
||||||
|
for ccname in "$@"; do
|
||||||
|
cc="$(locate_cc "$ccname" || true)"
|
||||||
|
if [ -n "$cc" ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "$cc" ]; then
|
||||||
local esc=$'\033'
|
local esc=$'\033'
|
||||||
{ echo
|
{ echo
|
||||||
echo "${esc}[1mERROR${esc}[0m: This package must be compiled with GCC, but python-build couldn't"
|
echo "${esc}[1mERROR${esc}[0m: This package must be compiled with $@, but python-build couldn't"
|
||||||
echo "find a suitable \`gcc\` executable on your system. Please install GCC"
|
echo "find a suitable \`cc\` executable on your system. Please install $@"
|
||||||
echo "and try again."
|
echo "and try again."
|
||||||
echo
|
echo
|
||||||
} >&3
|
} >&3
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export CC="$gcc"
|
export CC="$cc"
|
||||||
}
|
}
|
||||||
|
|
||||||
locate_gcc() {
|
locate_gcc() {
|
||||||
local gcc gccs
|
locate_cc "gcc" "$@"
|
||||||
IFS=: gccs=($(gccs_in_path))
|
}
|
||||||
|
|
||||||
verify_gcc "$CC" ||
|
locate_cc() {
|
||||||
verify_gcc "$(command -v gcc || true)" || {
|
local ccname="$1"; shift
|
||||||
for gcc in "${gccs[@]}"; do
|
if [ -z "$ccname" ]; then
|
||||||
verify_gcc "$gcc" && break || true
|
return 1
|
||||||
|
fi
|
||||||
|
local cc ccs
|
||||||
|
IFS=: ccs=($(ccs_in_path "${ccname}"))
|
||||||
|
|
||||||
|
verify_cc "${ccname}" "$CC" ||
|
||||||
|
verify_cc "${ccname}" "$(command -v "${ccname}" || true)" || {
|
||||||
|
for cc in "${ccs[@]}"; do
|
||||||
|
verify_cc "${ccname}" "$cc" && break || true
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -653,33 +671,49 @@ locate_gcc() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gccs_in_path() {
|
gccs_in_path() {
|
||||||
local gcc path paths
|
ccs_in_path "$gcc" "$@"
|
||||||
local gccs=()
|
}
|
||||||
|
|
||||||
|
ccs_in_path() {
|
||||||
|
local ccname="$1"; shift
|
||||||
|
if [ -z "$ccname" ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
local cc path paths
|
||||||
|
local ccs=()
|
||||||
IFS=: paths=($PATH)
|
IFS=: paths=($PATH)
|
||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
for path in "${paths[@]}"; do
|
for path in "${paths[@]}"; do
|
||||||
for gcc in "$path"/gcc-*; do
|
for cc in "$path"/${ccname}-*; do
|
||||||
gccs["${#gccs[@]}"]="$gcc"
|
ccs["${#ccs[@]}"]="$cc"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
shopt -u nullglob
|
shopt -u nullglob
|
||||||
|
|
||||||
printf :%s "${gccs[@]}"
|
printf :%s "${ccs[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
verify_gcc() {
|
verify_gcc() {
|
||||||
local gcc="$1"
|
verify_cc "gcc" "$@"
|
||||||
if [ -z "$gcc" ]; then
|
}
|
||||||
|
|
||||||
|
verify_cc() {
|
||||||
|
local ccname="$1"; shift
|
||||||
|
if [ -z "$ccname" ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
local cc="$1"
|
||||||
|
if [ -z "$cc" ]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local version="$("$gcc" --version || true)"
|
local version="$("$cc" --version || true)"
|
||||||
if [ -z "$version" ]; then
|
if [ -z "$version" ]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$gcc"
|
echo "$cc"
|
||||||
}
|
}
|
||||||
|
|
||||||
has_broken_mac_openssl() {
|
has_broken_mac_openssl() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user