mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2024-12-23 23:42:35 +00:00
abuild: set CTARGET_ARCH and CTARGET_LIBC
For better crosscompile support
This commit is contained in:
parent
b9305bad3d
commit
9f81a14456
40
abuild.in
40
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}
|
||||
|
Loading…
Reference in New Issue
Block a user