1
- #! /bin/bash
1
+ #! /bin/bash -e
2
+
2
3
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
3
4
# Use of this source code is governed by a BSD-style license that can be
4
5
# found in the LICENSE file.
6
+
5
7
# Script to install everything needed to build chromium on android, including
6
8
# items requiring sudo privileges.
7
- # See https://www.chromium.org/developers/how-tos/android-build-instructions
9
+ # See http://code.google.com/p/chromium/wiki/AndroidBuildInstructions
10
+
8
11
args=" $@ "
12
+ if test " $1 " = " --skip-sdk-packages" ; then
13
+ skip_inst_sdk_packages=1
14
+ args=" ${@: 2} "
15
+ else
16
+ skip_inst_sdk_packages=0
17
+ fi
18
+
9
19
if ! uname -m | egrep -q " i686|x86_64" ; then
10
20
echo " Only x86 architectures are currently supported" >&2
11
21
exit
12
22
fi
13
- # Exit if any commands fail.
14
- set -e
15
- lsb_release=$( lsb_release --codename --short)
23
+
16
24
# Install first the default Linux build deps.
17
25
" $( dirname " ${BASH_SOURCE[0]} " ) /install-build-deps.sh" \
18
- --no-syms --lib32 --no-arm --no-chromeos-fonts --no-nacl --no-prompt " ${args} "
26
+ --no-syms --lib32 --no-arm --no-prompt " ${args} "
27
+
28
+ lsb_release=$( lsb_release --codename --short)
29
+
30
+ # The temporary directory used to store output of update-java-alternatives
31
+ TEMPDIR=$( mktemp -d)
32
+ cleanup () {
33
+ local status=${?}
34
+ trap - EXIT
35
+ rm -rf " ${TEMPDIR} "
36
+ exit ${status}
37
+ }
38
+ trap cleanup EXIT
39
+
19
40
# Fix deps
20
41
sudo apt-get -f install
42
+
43
+ # Install deps
44
+ # This step differs depending on what Ubuntu release we are running
45
+ # on since the package names are different, and Sun's Java must
46
+ # be installed manually on late-model versions.
47
+
21
48
# common
22
- sudo apt-get -y install lib32z1 lighttpd python-pexpect xvfb x11-utils
49
+ sudo apt-get -y install lighttpd python-pexpect xvfb x11-utils
50
+
23
51
# Some binaries in the Android SDK require 32-bit libraries on the host.
24
52
# See https://developer.android.com/sdk/installing/index.html?pkg=tools
25
- sudo apt-get -y install libncurses5:i386 libstdc++6:i386 zlib1g:i386
26
- # Required for apk-patch-size-estimator
27
- sudo apt-get -y install bsdiff
28
- sudo apt-get -y install openjdk-8-jre openjdk-8-jdk
29
- echo " install-build-deps-android.sh complete."
53
+ if [[ $lsb_release == " precise" ]]; then
54
+ sudo apt-get -y install ia32-libs
55
+ else
56
+ sudo apt-get -y install libncurses5:i386 libstdc++6:i386 zlib1g:i386
57
+ fi
58
+
59
+ if [[ $lsb_release == " xenial" || $lsb_release == " rodete" ]]; then
60
+ sudo apt-get -y install openjdk-8-jre openjdk-8-jdk
61
+ sudo update-java-alternatives -s java-1.8.0-openjdk-amd64
62
+ sudo apt-get -y install ant
63
+ else
64
+ sudo apt-get -y install ant
65
+
66
+ # Install openjdk and openjre 7 stuff
67
+ sudo apt-get -y install openjdk-7-jre openjdk-7-jdk
68
+
69
+ # Switch version of Java to openjdk 7.
70
+ # Some Java plugins (e.g. for firefox, mozilla) are not required to build, and
71
+ # thus are treated only as warnings. Any errors in updating java alternatives
72
+ # which are not '*-javaplugin.so' will cause errors and stop the script from
73
+ # completing successfully.
74
+ if ! sudo update-java-alternatives -s java-1.7.0-openjdk-amd64 \
75
+ >& " ${TEMPDIR} " /update-java-alternatives.out
76
+ then
77
+ # Check that there are the expected javaplugin.so errors for the update
78
+ if grep ' javaplugin.so' " ${TEMPDIR} " /update-java-alternatives.out >& \
79
+ /dev/null
80
+ then
81
+ # Print as warnings all the javaplugin.so errors
82
+ echo ' WARNING: java has no alternatives for the following plugins:'
83
+ grep ' javaplugin.so' " ${TEMPDIR} " /update-java-alternatives.out
84
+ fi
85
+ # Check if there are any errors that are not javaplugin.so
86
+ if grep -v ' javaplugin.so' " ${TEMPDIR} " /update-java-alternatives.out \
87
+ >& /dev/null
88
+ then
89
+ # If there are non-javaplugin.so errors, treat as errors and exit
90
+ echo ' ERRORS: Failed to update alternatives for java:'
91
+ grep -v ' javaplugin.so' " ${TEMPDIR} " /update-java-alternatives.out
92
+ exit 1
93
+ fi
94
+ fi
95
+ fi
96
+
97
+ # Install SDK packages for android
98
+ if test " $skip_inst_sdk_packages " ! = 1; then
99
+ " $( dirname " ${BASH_SOURCE[0]} " ) /install-android-sdks.sh"
100
+ fi
101
+
102
+ echo " install-build-deps-android.sh complete."
0 commit comments