summaryrefslogtreecommitdiff
path: root/abuild.in
diff options
context:
space:
mode:
Diffstat (limited to 'abuild.in')
-rwxr-xr-xabuild.in40
1 files changed, 23 insertions, 17 deletions
diff --git a/abuild.in b/abuild.in
index a8bfddb..6a9bfa8 100755
--- a/abuild.in
+++ b/abuild.in
@@ -1813,6 +1813,25 @@ snapshot() {
fi
}
+hostspec_to_arch() {
+ case "$1" in
+ arm*-*-*-*eabi) echo "armel" ;;
+ arm*-*-*-*eabihf) echo "armhf" ;;
+ i[0-9]86-*-*-*) echo "x86" ;;
+ x86_64-*-*-*) echo "x86_64" ;;
+ *) echo "unknown" ;;
+ esac
+}
+
+hostspec_to_libc() {
+ case "$1" in
+ *-*-*-uclibc*) echo "uclibc" ;;
+ *-*-*-musl*) echo "musl" ;;
+ *-*-*-gnu*) echo "eglibc" ;;
+ *) echo "uclibc" ;;
+ esac
+}
+
usage() {
echo "$program $abuild_ver"
echo "usage: $program [options] [-i PKG] [-P REPODEST] [-p PKGDEST]"
@@ -1907,25 +1926,12 @@ repo=${repo##*/}
SRCDEST=${SRCDEST:-$startdir}
PKGDEST=${PKGDEST:-$startdir}
-if [ -z "$CARCH" ]; then
- case "$CHOST" in
- arm*-*-*-*) CARCH="armel" ;;
- i[0-9]86-*-*-*) CARCH="x86" ;;
- x86_64-*-*-*) CARCH="x86_64" ;;
- esac
-fi
-
-if [ -z "$CLIBC" ]; then
- case "$CHOST" in
- *-*-*-uclibc*) CLIBC="uclibc" ;;
- *-*-*-musl*) CLIBC="musl" ;;
- *-*-*-gnu*) CLIBC="eglibc" ;;
- *) CLIBC="uclibc" ;;
- esac
-fi
-
[ -z "$CBUILD" ] && CBUILD="$CHOST"
[ -z "$CTARGET" ] && CTARGET="$CHOST"
+[ -z "$CARCH" ] && CARCH="$(hostspec_to_arch $CHOST)"
+[ -z "$CLIBC" ] && CLIBC="$(hostspec_to_libc $CHOST)"
+[ -z "$CTARGET_ARCH" ] && CTARGET_ARCH="$(hostspec_to_arch $CTARGET)"
+[ -z "$CTARGET_LIBC" ] && CTARGET_LIBC="$(hostspec_to_libc $CTARGET)"
# set a default CC
: ${CC:=gcc}