aboutsummaryrefslogtreecommitdiff
path: root/build-scripts/build-android-toolchain
blob: ed09a9ab5f27ed3c49ecaf8ec623921c0cfbf1f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
###############################################################################
# Copyright (c) 2011 Linaro
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
###############################################################################

source "${BUILD_SCRIPT_ROOT}"/helpers

# BINUTILS_URL - set this in env to override default binutils version shipped by a version downloaded from ftp
BINUTILS_VERSION=${BINUTILS_VERSION-2.20.1}
# GCC_URL - set this in env to override default gcc version shipped by a version downloaded from ftp
GCC_VERSION=${GCC_VERSION-4.4.0}

repo-sync-from-mirror "${1}"

calc_make_jobs

if ! test -d objdir; then
	mkdir objdir
fi

if test -n "$BINUTILS_URL"; then
	BINUTILS_FILE=`get_url_basename "$BINUTILS_URL"`
	BINUTILS_VERSION=`get_tarball_version "$BINUTILS_FILE"`
	wget -nv --no-check-certificate "$BINUTILS_URL"
	sh -c "cd binutils/; tar xf ../$BINUTILS_FILE"
fi

if test -n "$GCC_URL"; then
	GCC_FILE=`get_url_basename "$GCC_URL"`
	GCC_VERSION=`get_tarball_version "$GCC_FILE"`
	wget -nv --no-check-certificate "$GCC_URL"
	sh -c "cd gcc/; tar xf ../$GCC_FILE"
fi

WITH_SYSROOT=
if test -n "$SYSROOT_NDK_URL"; then
	wget -nv --no-check-certificate "$SYSROOT_NDK_URL"
	NDK_FILE=`get_url_basename "$SYSROOT_NDK_URL"`
	tar xf $NDK_FILE
	WITH_SYSROOT=--with-sysroot=`echo $PWD/android-ndk-*/platforms/android-9/arch-arm/`
fi

if test -z "$MAKE"; then
	MAKE=make
fi

cd objdir/

TOOLCHAIN_PREFIX=/opt/linaro-android-toolchain-11.05

../build/configure --target=$EABI --prefix=$TOOLCHAIN_PREFIX \
	--with-gcc-version=$GCC_VERSION --with-binutils-version=$BINUTILS_VERSION \
	--with-mpfr-version=2.4.1 --disable-libquadmath \
	--with-ppl=no \
	--disable-libstdc__-v3 \
	$WITH_SYSROOT
#../build/configure --target=$EABI --with-binutils-version=$BINUTILS_VERSION --with-gcc-version=$GCC_VERSION

# note: MAKE_TARGETS is empty by default
time -p $MAKE $MAKE_OPTS -j$MAKE_JOBS $MAKE_TARGETS
mkdir -p ../out/cross/$TOOLCHAIN_PREFIX
$MAKE $MAKE_OPTS install prefix=$PWD/../out/cross/$TOOLCHAIN_PREFIX
tar -cj -C ../out/cross -f ../out/android-toolchain-eabi-$GCC_VERSION-$BUILD_NUMBER-$BUILD_ID-linux-x64.tar.bz2 .

# Add BUILD-INFO.txt support
cp ${BUILD_SCRIPT_ROOT}/BUILD-INFO_toolchain.txt ../out/BUILD-INFO.txt