Commit 9f81a144 authored by Natanael Copa's avatar Natanael Copa

abuild: set CTARGET_ARCH and CTARGET_LIBC

For better crosscompile support
parent b9305bad
......@@ -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}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment