aboutsummaryrefslogtreecommitdiff
path: root/node/setup-build-android
blob: 98e73568fb409de8b2aced2d238e3041541ed813 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/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
###############################################################################

set -xe

# Stubborn apt-get, retrying on errors
apt-get-retry () {
    local fatal="yes";
    if [ "$1" == "--non-fatal" ]; then
        fatal=""
        shift
    fi
    local delay=1;
    while [ $delay -lt 100 ]; do
        if apt-get "$@"; then
            return
        fi
        echo "apt-get failed, sleeping ${delay}s before retrying"
        sleep $delay
        delay=$((delay * 2))
    done
    if [ -n "$fatal" ]; then
        echo "apt-get failed after several attempts, aborting"
        exit 1
    fi
}


# get latest repo script and install it in PATH
#wget http://android.git.kernel.org/repo
# Use our mirror of repo
wget -nv --no-check-certificate 'http://android.git.linaro.org/gitweb?p=tools/repo.git;a=blob_plain;f=repo;hb=refs/heads/stable' -O repo
mv repo /usr/local/bin/repo
chmod a+x /usr/local/bin/repo

sed -i.bk 's,^\(.*://[^.]*.ec2.archive.ubuntu.com\)/,\1.s3.amazonaws.com/,' /etc/apt/sources.list
apt-get-retry --non-fatal update

# We do update as part of early node init (to get this script actually)
#apt-get update

# add feature to allow add-apt-repository
apt-get-retry install -y python-software-properties unixodbc java-common

# enable partner repo for sun-java6
##add-apt-repository "deb http://archive.canonical.com/ubuntu maverick partner"
##apt-get update

wget -nv --no-check-certificate http://android-build.linaro.org/seed/sun-java6-bin_6.26-2natty1_amd64.deb \
     http://android-build.linaro.org/seed/sun-java6-jdk_6.26-2natty1_amd64.deb \
     http://android-build.linaro.org/seed/sun-java6-jre_6.26-2natty1_all.deb

export DEBIAN_FRONTEND=noninteractive
##apt-get install -y sun-java6-jdk || (debconf 'echo SET shared/accepted-sun-dlj-v1-1 true' || true; apt-get install -f -y; apt-get install -y sun-java6-jdk)
dpkg -i sun-java6-* || (debconf 'echo SET shared/accepted-sun-dlj-v1-1 true' || true; apt-get install -f -y; dpkg -i sun-java6-*)

# set java-6-sun as default
update-java-alternatives -s java-6-sun || true

# Install basic development packages
# Do not install toolchains and other variable stuff here
apt-get-retry install -y \
    zip \
    curl \
    texinfo \
    flex \
    bison \
    build-essential \
    autoconf \
    automake \
    libtool \
    git-core

# install base stuff for android
apt-get-retry install -y \
	gnupg \
	gperf \
	zlib1g-dev \
	libx11-dev \
	x11proto-core-dev \
	gcc-multilib \
	g++-multilib \
	libc6-dev-i386 \
	lib32ncurses5-dev \
	ia32-libs \
	lib32readline-gplv2-dev \
	lib32z-dev \
	gcc-4.5 \
	g++-4.5 \
	cpp-4.5 \
	gcc-4.5-multilib \
	g++-4.5-multilib \
	gcc-4.4 \
	g++-4.4 \
	cpp-4.4 \
	gcc-4.4-multilib \
	g++-4.4-multilib \
	gcc-arm-linux-gnueabi \
	gcc-4.5-arm-linux-gnueabi \
	uboot-mkimage \
	uuid-dev \
	lzop \
	libxml2-utils \
	subversion \
	libmpfr-dev

# uuid-dev, acpica-tools are UEFI bootloader requirement

# Retired
#	lib32readline5-dev \
#	gitg \
#	qt3-dev-tools \
#	libqt3-mt-dev \
#	eclipse \
#	valgrind \
#	libx11-dev \
#	x11proto-core-dev \

adduser --system jenkins-build

# Install linaro-image-tools so builds can create complete FS images.
sudo add-apt-repository ppa:linaro-maintainers/tools
sudo apt-get update
sudo apt-get install -y linaro-image-tools

# Install recent version of iasl/acpica-tools from linaro-maintainers ppa.
sudo apt-get install -y acpica-tools

# Allow 'jenkins-build' user to run linaro-android-media-create via sudo
echo "jenkins-build   ALL = NOPASSWD: /usr/bin/linaro-android-media-create" >>/etc/sudoers