aboutsummaryrefslogtreecommitdiff
path: root/build-scripts/build-android-toolchain
blob: 418be1913ab080677111ff48290cdc39bb6c3788 (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
#!/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
###############################################################################

# 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}"
MANIFEST_REPO="${MANIFEST_REPO-git://http://android.git.kernel.org/platform/manifest.git}"
MANIFEST_BRANCH="${MANIFEST_BRANCH-master}"
MANIFEST_FILENAME="${MANIFEST_FILENAME-default.xml}"

repo init -u "${MANIFEST_REPO}" -b "${MANIFEST_BRANCH}" -m "${MANIFEST_FILENAME}"

time python -c 'import xmlrpclib, sys; print xmlrpclib.ServerProxy(sys.argv[1]).mirror(open(".repo/manifest.xml").read())' "http://${1}:8080" > temp-manifest.xml
echo "Received modified manifest"
cat temp-manifest.xml
echo ----------------------------
mv temp-manifest.xml .repo/manifest.xml
repo sync -j8

wget http://dl.google.com/android/ndk/android-ndk-r5-linux-x86.tar.bz2

tar xvjf android-ndk-r5-linux-x86.tar.bz2
rm -f android-ndk-r5-linux-x86.tar.bz2

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}

# here submit stuff back:
#  + logs
#  + build results