3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
7 # Script to install everything needed to build chromium on android that
8 # requires sudo privileges.
9 # See http://code.google.com/p/chromium/wiki/AndroidBuildInstructions
11 # This script installs the sun-java6 packages (bin, jre and jdk). Sun requires
12 # a license agreement, so upon installation it will prompt the user. To get
13 # past the curses-based dialog press TAB <ret> TAB <ret> to agree.
15 if ! uname
-m |
egrep -q "i686|x86_64"; then
16 echo "Only x86 architectures are currently supported" >&2
20 if [ "x$(id -u)" != x0
]; then
21 echo "Running as non-root user."
22 echo "You might have to enter your password one or more times for 'sudo'."
26 # The temporary directory used to store output of update-java-alternatives
39 sudo apt-get
-f install
41 # Install python-pexpect
42 sudo apt-get
install python-pexpect
44 # Install sun-java6 stuff
45 sudo apt-get
install sun-java6-bin sun-java6-jre sun-java6-jdk
47 # Switch version of Java to java-6-sun
48 # Sun's java is missing certain Java plugins (e.g. for firefox, mozilla). These
49 # are not required to build, and thus are treated only as warnings. Any errors
50 # in updating java alternatives which are not '*-javaplugin.so' will cause
51 # errors and stop the script from completing successfully.
52 if ! sudo update-java-alternatives
-s java-6-sun \
53 >& "${TEMPDIR}"/update-java-alternatives.out
55 # Check that there are the expected javaplugin.so errors for the update
56 if grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out
>& /dev
/null
58 # Print as warnings all the javaplugin.so errors
59 echo 'WARNING: java-6-sun has no alternatives for the following plugins:'
60 grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out
62 # Check if there are any errors that are not javaplugin.so
63 if grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out \
66 # If there are non-javaplugin.so errors, treat as errors and exit
67 echo 'ERRORS: Failed to update alternatives for java-6-sun:'
68 grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out
73 # Install ant 1.8 (default is 1.7).
74 sudo apt-get
install ant1.8
76 echo "install-build-deps-android.sh complete."