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