1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/webrtc/trunk/build/install-build-deps-android.sh Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,101 @@ 1.4 +#!/bin/bash -e 1.5 + 1.6 +# Copyright (c) 2012 The Chromium Authors. All rights reserved. 1.7 +# Use of this source code is governed by a BSD-style license that can be 1.8 +# found in the LICENSE file. 1.9 + 1.10 +# Script to install everything needed to build chromium on android that 1.11 +# requires sudo privileges. 1.12 +# See http://code.google.com/p/chromium/wiki/AndroidBuildInstructions 1.13 + 1.14 +# This script installs the sun-java6 packages (bin, jre and jdk). Sun requires 1.15 +# a license agreement, so upon installation it will prompt the user. To get 1.16 +# past the curses-based dialog press TAB <ret> TAB <ret> to agree. 1.17 + 1.18 +if ! uname -m | egrep -q "i686|x86_64"; then 1.19 + echo "Only x86 architectures are currently supported" >&2 1.20 + exit 1.21 +fi 1.22 + 1.23 +if [ "x$(id -u)" != x0 ]; then 1.24 + echo "Running as non-root user." 1.25 + echo "You might have to enter your password one or more times for 'sudo'." 1.26 + echo 1.27 +fi 1.28 + 1.29 +# The temporary directory used to store output of update-java-alternatives 1.30 +TEMPDIR=$(mktemp -d) 1.31 +cleanup() { 1.32 + local status=${?} 1.33 + trap - EXIT 1.34 + rm -rf "${TEMPDIR}" 1.35 + exit ${status} 1.36 +} 1.37 +trap cleanup EXIT 1.38 + 1.39 +sudo apt-get update 1.40 + 1.41 +# Fix deps 1.42 +sudo apt-get -f install 1.43 + 1.44 +# Install deps 1.45 +# This step differs depending on what Ubuntu release we are running 1.46 +# on since the package names are different, and Sun's Java must 1.47 +# be installed manually on late-model versions. 1.48 + 1.49 +# common 1.50 +sudo apt-get -y install python-pexpect xvfb x11-utils 1.51 + 1.52 +if /usr/bin/lsb_release -r -s | grep -q "12."; then 1.53 + # Ubuntu 12.x 1.54 + sudo apt-get -y install ant 1.55 + 1.56 + # Java can not be installed via ppa on Ubuntu 12.04+ so we'll 1.57 + # simply check to see if it has been setup properly -- if not 1.58 + # let the user know. 1.59 + 1.60 + if ! java -version 2>&1 | grep -q "Java(TM)"; then 1.61 + echo "****************************************************************" 1.62 + echo "You need to install the Oracle Java SDK from http://goo.gl/uPRSq" 1.63 + echo "and configure it as the default command-line Java environment." 1.64 + echo "****************************************************************" 1.65 + exit 1.66 + fi 1.67 + 1.68 +else 1.69 + # Ubuntu 10.x 1.70 + 1.71 + sudo apt-get -y install ant1.8 1.72 + 1.73 + # Install sun-java6 stuff 1.74 + sudo apt-get -y install sun-java6-bin sun-java6-jre sun-java6-jdk 1.75 + 1.76 + # Switch version of Java to java-6-sun 1.77 + # Sun's java is missing certain Java plugins (e.g. for firefox, mozilla). 1.78 + # These are not required to build, and thus are treated only as warnings. 1.79 + # Any errors in updating java alternatives which are not '*-javaplugin.so' 1.80 + # will cause errors and stop the script from completing successfully. 1.81 + if ! sudo update-java-alternatives -s java-6-sun \ 1.82 + >& "${TEMPDIR}"/update-java-alternatives.out 1.83 + then 1.84 + # Check that there are the expected javaplugin.so errors for the update 1.85 + if grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out >& \ 1.86 + /dev/null 1.87 + then 1.88 + # Print as warnings all the javaplugin.so errors 1.89 + echo 'WARNING: java-6-sun has no alternatives for the following plugins:' 1.90 + grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out 1.91 + fi 1.92 + # Check if there are any errors that are not javaplugin.so 1.93 + if grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out \ 1.94 + >& /dev/null 1.95 + then 1.96 + # If there are non-javaplugin.so errors, treat as errors and exit 1.97 + echo 'ERRORS: Failed to update alternatives for java-6-sun:' 1.98 + grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out 1.99 + exit 1 1.100 + fi 1.101 + fi 1.102 +fi 1.103 + 1.104 +echo "install-build-deps-android.sh complete."