Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | #!/bin/bash -e |
michael@0 | 2 | |
michael@0 | 3 | # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
michael@0 | 4 | # Use of this source code is governed by a BSD-style license that can be |
michael@0 | 5 | # found in the LICENSE file. |
michael@0 | 6 | |
michael@0 | 7 | # Script to install everything needed to build chromium on android that |
michael@0 | 8 | # requires sudo privileges. |
michael@0 | 9 | # See http://code.google.com/p/chromium/wiki/AndroidBuildInstructions |
michael@0 | 10 | |
michael@0 | 11 | # This script installs the sun-java6 packages (bin, jre and jdk). Sun requires |
michael@0 | 12 | # a license agreement, so upon installation it will prompt the user. To get |
michael@0 | 13 | # past the curses-based dialog press TAB <ret> TAB <ret> to agree. |
michael@0 | 14 | |
michael@0 | 15 | if ! uname -m | egrep -q "i686|x86_64"; then |
michael@0 | 16 | echo "Only x86 architectures are currently supported" >&2 |
michael@0 | 17 | exit |
michael@0 | 18 | fi |
michael@0 | 19 | |
michael@0 | 20 | if [ "x$(id -u)" != x0 ]; then |
michael@0 | 21 | echo "Running as non-root user." |
michael@0 | 22 | echo "You might have to enter your password one or more times for 'sudo'." |
michael@0 | 23 | echo |
michael@0 | 24 | fi |
michael@0 | 25 | |
michael@0 | 26 | # The temporary directory used to store output of update-java-alternatives |
michael@0 | 27 | TEMPDIR=$(mktemp -d) |
michael@0 | 28 | cleanup() { |
michael@0 | 29 | local status=${?} |
michael@0 | 30 | trap - EXIT |
michael@0 | 31 | rm -rf "${TEMPDIR}" |
michael@0 | 32 | exit ${status} |
michael@0 | 33 | } |
michael@0 | 34 | trap cleanup EXIT |
michael@0 | 35 | |
michael@0 | 36 | sudo apt-get update |
michael@0 | 37 | |
michael@0 | 38 | # Fix deps |
michael@0 | 39 | sudo apt-get -f install |
michael@0 | 40 | |
michael@0 | 41 | # Install deps |
michael@0 | 42 | # This step differs depending on what Ubuntu release we are running |
michael@0 | 43 | # on since the package names are different, and Sun's Java must |
michael@0 | 44 | # be installed manually on late-model versions. |
michael@0 | 45 | |
michael@0 | 46 | # common |
michael@0 | 47 | sudo apt-get -y install python-pexpect xvfb x11-utils |
michael@0 | 48 | |
michael@0 | 49 | if /usr/bin/lsb_release -r -s | grep -q "12."; then |
michael@0 | 50 | # Ubuntu 12.x |
michael@0 | 51 | sudo apt-get -y install ant |
michael@0 | 52 | |
michael@0 | 53 | # Java can not be installed via ppa on Ubuntu 12.04+ so we'll |
michael@0 | 54 | # simply check to see if it has been setup properly -- if not |
michael@0 | 55 | # let the user know. |
michael@0 | 56 | |
michael@0 | 57 | if ! java -version 2>&1 | grep -q "Java(TM)"; then |
michael@0 | 58 | echo "****************************************************************" |
michael@0 | 59 | echo "You need to install the Oracle Java SDK from http://goo.gl/uPRSq" |
michael@0 | 60 | echo "and configure it as the default command-line Java environment." |
michael@0 | 61 | echo "****************************************************************" |
michael@0 | 62 | exit |
michael@0 | 63 | fi |
michael@0 | 64 | |
michael@0 | 65 | else |
michael@0 | 66 | # Ubuntu 10.x |
michael@0 | 67 | |
michael@0 | 68 | sudo apt-get -y install ant1.8 |
michael@0 | 69 | |
michael@0 | 70 | # Install sun-java6 stuff |
michael@0 | 71 | sudo apt-get -y install sun-java6-bin sun-java6-jre sun-java6-jdk |
michael@0 | 72 | |
michael@0 | 73 | # Switch version of Java to java-6-sun |
michael@0 | 74 | # Sun's java is missing certain Java plugins (e.g. for firefox, mozilla). |
michael@0 | 75 | # These are not required to build, and thus are treated only as warnings. |
michael@0 | 76 | # Any errors in updating java alternatives which are not '*-javaplugin.so' |
michael@0 | 77 | # will cause errors and stop the script from completing successfully. |
michael@0 | 78 | if ! sudo update-java-alternatives -s java-6-sun \ |
michael@0 | 79 | >& "${TEMPDIR}"/update-java-alternatives.out |
michael@0 | 80 | then |
michael@0 | 81 | # Check that there are the expected javaplugin.so errors for the update |
michael@0 | 82 | if grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out >& \ |
michael@0 | 83 | /dev/null |
michael@0 | 84 | then |
michael@0 | 85 | # Print as warnings all the javaplugin.so errors |
michael@0 | 86 | echo 'WARNING: java-6-sun has no alternatives for the following plugins:' |
michael@0 | 87 | grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out |
michael@0 | 88 | fi |
michael@0 | 89 | # Check if there are any errors that are not javaplugin.so |
michael@0 | 90 | if grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out \ |
michael@0 | 91 | >& /dev/null |
michael@0 | 92 | then |
michael@0 | 93 | # If there are non-javaplugin.so errors, treat as errors and exit |
michael@0 | 94 | echo 'ERRORS: Failed to update alternatives for java-6-sun:' |
michael@0 | 95 | grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out |
michael@0 | 96 | exit 1 |
michael@0 | 97 | fi |
michael@0 | 98 | fi |
michael@0 | 99 | fi |
michael@0 | 100 | |
michael@0 | 101 | echo "install-build-deps-android.sh complete." |