summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2020-01-31 09:47:44 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2020-01-31 09:47:44 +0000
commit5adf47c168aff63878872383e5fd2c0e7757818d (patch)
treedf7ae971a7bedaff916f929fb8c94fc93fd64ef7
parent4f5b0a14bdd715a36cd276788bc79e0a67a7672e (diff)
downloadabuild-5adf47c168aff63878872383e5fd2c0e7757818d.tar.bz2
abuild-5adf47c168aff63878872383e5fd2c0e7757818d.tar.xz
functions.sh: use apk --print-arch for CARCH if gcc is missing
-rw-r--r--functions.sh.in7
1 files changed, 7 insertions, 0 deletions
diff --git a/functions.sh.in b/functions.sh.in
index 6d5181a..82ac114 100644
--- a/functions.sh.in
+++ b/functions.sh.in
@@ -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)"