aboutsummaryrefslogtreecommitdiff
path: root/build-scripts/build-android-toolchain
blob: 25d96e30741fbe7b445b9a80bb08a35b524debd7 (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
#!/bin/bash

###############################################################################
# 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=2.21
# GCC_URL - set this in env to override default gcc version shipped by a version downloaded from ftp
GCC_VERSION=4.6+linaro

EABI="${EABI-arm-eabi}"

repo-sync-from-mirror

cpuc=`cat /proc/cpuinfo  | grep processor | wc -l`
threads=$(($cpuc * 4))

if ! test -d objdir; then
	mkdir objdir
fi

if test -n "$BINUTILS_URL"; then
	BINUTILS_FILE=`echo "$BINUTILS_URL" | sed -e 's/^.*\/\([^/]*\)$/\1/'`
	BINUTILS_VERSION=`echo "$BINUTILS_FILE" | sed -e 's/^.*-//' -e 's/\.tar.*$//'`
	wget $BINUTILS_URL
	sh -c "cd binutils/; tar xf ../$BINUTILS_FILE"
fi

if test -n "$GCC_URL"; then
	GCC_FILE=`echo "$GCC_URL" | sed -e 's/^.*\/\([^/]*\)$/\1/'`
	GCC_VERSION=`echo "$GCC_FILE" | sed -e 's/^.*-//' -e 's/\.tar.*$//'`
	wget $GCC_URL
	sh -c "cd gcc/; tar xf ../$GCC_FILE"
fi

cd objdir/

../build/configure --target=$EABI --prefix=/opt/linaro-toolchain-11.05/ \
	--with-gcc-version=$GCC_VERSION --with-binutils-version=$BINUTILS_VERSION \
	--with-mpfr-version=2.4.1 --disable-libquadmath \
	--with-ppl=no \
	--with-sysroot=`pwd`/../android-ndk-r5/platforms/android-9/arch-arm/

time -p make -j${threads}