blob: c171d788266739c680a3416aee1875de0d548241 (
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
|
#!/bin/bash -e
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Script to install everything needed to build chromium on android, including
# items requiring sudo privileges.
# See http://code.google.com/p/chromium/wiki/AndroidBuildInstructions
# This script installs the sun-java6 packages (bin, jre and jdk). Sun requires
# a license agreement, so upon installation it will prompt the user. To get
# past the curses-based dialog press TAB <ret> TAB <ret> to agree.
args="$@"
if test "$1" = "--skip-sdk-packages"; then
skip_inst_sdk_packages=1
args="${@:2}"
else
skip_inst_sdk_packages=0
fi
if ! uname -m | egrep -q "i686|x86_64"; then
echo "Only x86 architectures are currently supported" >&2
exit
fi
# Install first the default Linux build deps.
"$(dirname "${BASH_SOURCE[0]}")/install-build-deps.sh" \
--no-syms --lib32 --no-arm --no-chromeos-fonts --no-nacl --no-prompt "${args}"
lsb_release=$(lsb_release --codename --short)
# The temporary directory used to store output of update-java-alternatives
TEMPDIR=$(mktemp -d)
cleanup() {
local status=${?}
trap - EXIT
rm -rf "${TEMPDIR}"
exit ${status}
}
trap cleanup EXIT
# Fix deps
sudo apt-get -f install
# Install deps
# This step differs depending on what Ubuntu release we are running
# on since the package names are different, and Sun's Java must
# be installed manually on late-model versions.
# common
sudo apt-get -y install lighttpd python-pexpect xvfb x11-utils
# Some binaries in the Android SDK require 32-bit libraries on the host.
# See https://developer.android.com/sdk/installing/index.html?pkg=tools
if [[ $lsb_release == "precise" ]]; then
sudo apt-get -y install ia32-libs
else
sudo apt-get -y install libncurses5:i386 libstdc++6:i386 zlib1g:i386
fi
sudo apt-get -y install ant
# Install openjdk and openjre 7 stuff
sudo apt-get -y install openjdk-7-jre openjdk-7-jdk
# Switch version of Java to openjdk 7.
# Some Java plugins (e.g. for firefox, mozilla) are not required to build, and
# thus are treated only as warnings. Any errors in updating java alternatives
# which are not '*-javaplugin.so' will cause errors and stop the script from
# completing successfully.
if ! sudo update-java-alternatives -s java-1.7.0-openjdk-amd64 \
>& "${TEMPDIR}"/update-java-alternatives.out
then
# Check that there are the expected javaplugin.so errors for the update
if grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out >& \
/dev/null
then
# Print as warnings all the javaplugin.so errors
echo 'WARNING: java-6-sun has no alternatives for the following plugins:'
grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out
fi
# Check if there are any errors that are not javaplugin.so
if grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out \
>& /dev/null
then
# If there are non-javaplugin.so errors, treat as errors and exit
echo 'ERRORS: Failed to update alternatives for java-6-sun:'
grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out
exit 1
fi
fi
# Install SDK packages for android
if test "$skip_inst_sdk_packages" != 1; then
"$(dirname "${BASH_SOURCE[0]}")/install-android-sdks.sh"
fi
DownloadFromBucket() {
bin=$1
path=$2
gs_url=$3
known_hash=$4
tmpfile=${bin}_$(/bin/date +%s)
if [ ! -x ${path}/${bin} ]; then
/b/build/scripts/slave/gsutil cp ${gs_url} ${tmpfile}
md5=$(md5sum ${tmpfile} | cut -d' ' -f 1)
if [[ $known_hash == $md5 ]]; then
/usr/bin/sudo /bin/mv ${tmpfile} ${path}/${bin}
/usr/bin/sudo /bin/chmod a+x ${path}/${bin}
/usr/bin/sudo /bin/chown root:root ${path}/${bin}
else
echo 'ERROR: Bad md5sum. Not installing' ${bin}
exit 1
fi
fi
}
DownloadFromBucket apktool /usr/local/bin \
'gs://chromium-apktool-bucket/apktool_1_5_2/apktool' \
89d099df9f8b12c043dc74f6f1368f36
DownloadFromBucket apktool.jar /usr/local/bin \
'gs://chromium-apktool-bucket/apktool_1_5_2/apktool.jar' \
2d616934a8eaa37c4501868f05c62871
echo "install-build-deps-android.sh complete."
|