blob: 5277a3bb76c7d31b636a4803d171f3efe66ddaba [file] [log] [blame]
[email protected]c4fabbc32012-03-07 02:22:181#!/bin/bash -e
[email protected]9f95fb92011-10-06 18:19:302
[email protected]2a89cd92012-02-18 01:58:433# Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]9f95fb92011-10-06 18:19:304# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
[email protected]c4fabbc32012-03-07 02:22:187# 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
[email protected]9f95fb92011-10-06 18:19:3010
[email protected]4ba8681e2012-03-14 07:23:3011# 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.
[email protected]9f95fb92011-10-06 18:19:3014
[email protected]c4fabbc32012-03-07 02:22:1815if ! uname -m | egrep -q "i686|x86_64"; then
16 echo "Only x86 architectures are currently supported" >&2
17 exit
18fi
[email protected]9f95fb92011-10-06 18:19:3019
[email protected]c4fabbc32012-03-07 02:22:1820if [ "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'."
23 echo
24fi
25
[email protected]4ba8681e2012-03-14 07:23:3026# The temporary directory used to store output of update-java-alternatives
[email protected]9f95fb92011-10-06 18:19:3027TEMPDIR=$(mktemp -d)
28cleanup() {
29 local status=${?}
30 trap - EXIT
31 rm -rf "${TEMPDIR}"
32 exit ${status}
33}
34trap cleanup EXIT
35
[email protected]4ba8681e2012-03-14 07:23:3036sudo apt-get update
[email protected]9f95fb92011-10-06 18:19:3037
[email protected]4ba8681e2012-03-14 07:23:3038# Fix deps
39sudo apt-get -f install
[email protected]9f95fb92011-10-06 18:19:3040
[email protected]4ba8681e2012-03-14 07:23:3041# Install python-pexpect
42sudo apt-get install python-pexpect
[email protected]9f95fb92011-10-06 18:19:3043
[email protected]4ba8681e2012-03-14 07:23:3044# Install sun-java6 stuff
45sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk
[email protected]9f95fb92011-10-06 18:19:3046
[email protected]c4fabbc32012-03-07 02:22:1847# Switch version of Java to java-6-sun
[email protected]4ba8681e2012-03-14 07:23:3048# 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.
52if ! sudo update-java-alternatives -s java-6-sun \
53 >& "${TEMPDIR}"/update-java-alternatives.out
54then
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
57 then
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
61 fi
62 # Check if there are any errors that are not javaplugin.so
63 if grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out \
64 >& /dev/null
65 then
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
69 exit 1
70 fi
71fi
72
73# Install ant
74sudo apt-get install ant
[email protected]9f95fb92011-10-06 18:19:3075
[email protected]c4fabbc32012-03-07 02:22:1876echo "install-build-deps-android.sh complete."