diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2013-09-04 13:55:03 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2013-09-04 14:06:48 +0000 |
commit | 9f81a14456664b7e8968079c553a59005e094b43 (patch) | |
tree | 0fdc87fd991dac1a3db1bcdfdd8546813b636af3 | |
parent | b9305bad3d38173417c6faccd7703836358541e9 (diff) | |
download | abuild-9f81a14456664b7e8968079c553a59005e094b43.tar.gz abuild-9f81a14456664b7e8968079c553a59005e094b43.tar.bz2 abuild-9f81a14456664b7e8968079c553a59005e094b43.tar.xz abuild-9f81a14456664b7e8968079c553a59005e094b43.zip |
abuild: set CTARGET_ARCH and CTARGET_LIBC
For better crosscompile support
-rwxr-xr-x | abuild.in | 40 |
1 files changed, 23 insertions, 17 deletions
@@ -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} |