diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2020-01-31 09:47:44 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2020-01-31 09:47:44 +0000 |
commit | 5adf47c168aff63878872383e5fd2c0e7757818d (patch) | |
tree | df7ae971a7bedaff916f929fb8c94fc93fd64ef7 | |
parent | 4f5b0a14bdd715a36cd276788bc79e0a67a7672e (diff) | |
download | abuild-5adf47c168aff63878872383e5fd2c0e7757818d.tar.bz2 abuild-5adf47c168aff63878872383e5fd2c0e7757818d.tar.xz |
functions.sh: use apk --print-arch for CARCH if gcc is missing
-rw-r--r-- | functions.sh.in | 7 |
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)" |