functions.sh: use apk --print-arch for CARCH if gcc is missing

This commit is contained in:
Natanael Copa 2020-01-31 09:47:44 +00:00
parent 4f5b0a14bd
commit 5adf47c168
1 changed files with 7 additions and 0 deletions

View File

@ -125,6 +125,13 @@ readconfig() {
[ "$(arch_to_hostspec $CTARGET)" != "unknown" ] && CTARGET="$(arch_to_hostspec $CTARGET)"
[ -z "$CARCH" ] && CARCH="$(hostspec_to_arch $CHOST)"
# use apk --print-arch for CARCH if gcc is missing
if [ "$CARCH" = "unknown" ]; then
local apk_arch="$(${APK:-apk} --print-arch 2>/dev/null)"
CARCH=${apk_arch:-unknown}
fi
[ -z "$CLIBC" ] && CLIBC="$(hostspec_to_libc $CHOST)"
[ -z "$CBUILD_ARCH" ] && CBUILD_ARCH="$(hostspec_to_arch $CBUILD)"
[ -z "$CTARGET_ARCH" ] && CTARGET_ARCH="$(hostspec_to_arch $CTARGET)"