| [email protected] | c4fabbc3 | 2012-03-07 02:22:18 | [diff] [blame] | 1 | #!/bin/bash -e |
| [email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 2 | |
| [email protected] | 2a89cd9 | 2012-02-18 01:58:43 | [diff] [blame] | 3 | # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| [email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 4 | # Use of this source code is governed by a BSD-style license that can be |
| 5 | # found in the LICENSE file. | ||||
| 6 | |||||
| lisandrop | aeae0b7c | 2015-02-10 21:39:31 | [diff] [blame] | 7 | # Script to install everything needed to build chromium on android, including |
| 8 | # items requiring sudo privileges. | ||||
| mostynb | df175a8 | 2016-02-08 23:27:20 | [diff] [blame] | 9 | # See https://www.chromium.org/developers/how-tos/android-build-instructions |
| [email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 10 | |
| [email protected] | 4ba8681e | 2012-03-14 07:23:30 | [diff] [blame] | 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. | ||||
| [email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 14 | |
| navabi | 654f395 | 2015-01-20 23:43:07 | [diff] [blame] | 15 | args="$@" |
| dgn | ebe5d99c | 2015-11-06 15:28:51 | [diff] [blame] | 16 | |
| [email protected] | c4fabbc3 | 2012-03-07 02:22:18 | [diff] [blame] | 17 | if ! uname -m | egrep -q "i686|x86_64"; then |
| 18 | echo "Only x86 architectures are currently supported" >&2 | ||||
| 19 | exit | ||||
| 20 | fi | ||||
| [email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 21 | |
| friedman | 3f67f4a | 2016-04-28 00:32:26 | [diff] [blame] | 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 | |||||
| [email protected] | 9e5f728 | 2014-04-03 21:40:19 | [diff] [blame] | 35 | # Install first the default Linux build deps. |
| 36 | "$(dirname "${BASH_SOURCE[0]}")/install-build-deps.sh" \ | ||||
| navabi | 654f395 | 2015-01-20 23:43:07 | [diff] [blame] | 37 | --no-syms --lib32 --no-arm --no-chromeos-fonts --no-nacl --no-prompt "${args}" |
| johnme | 49bb458a | 2014-11-27 15:45:31 | [diff] [blame] | 38 | |
| [email protected] | 4ba8681e | 2012-03-14 07:23:30 | [diff] [blame] | 39 | # The temporary directory used to store output of update-java-alternatives |
| [email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 40 | TEMPDIR=$(mktemp -d) |
| 41 | cleanup() { | ||||
| 42 | local status=${?} | ||||
| 43 | trap - EXIT | ||||
| 44 | rm -rf "${TEMPDIR}" | ||||
| 45 | exit ${status} | ||||
| 46 | } | ||||
| 47 | trap cleanup EXIT | ||||
| 48 | |||||
| [email protected] | 4ba8681e | 2012-03-14 07:23:30 | [diff] [blame] | 49 | # Fix deps |
| 50 | sudo apt-get -f install | ||||
| [email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 51 | |
| [email protected] | 959a0f5c | 2012-06-22 23:58:58 | [diff] [blame] | 52 | # Install deps |
| [email protected] | 457088f2 | 2012-09-26 21:47:07 | [diff] [blame] | 53 | # This step differs depending on what Ubuntu release we are running |
| 54 | # on since the package names are different, and Sun's Java must | ||||
| 55 | # be installed manually on late-model versions. | ||||
| [email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 56 | |
| [email protected] | 758d7708 | 2014-01-08 00:05:19 | [diff] [blame] | 57 | # common |
| thomasanderson | 98888af | 2016-12-08 06:58:50 | [diff] [blame^] | 58 | sudo apt-get -y install lib32z1 lighttpd python-pexpect xvfb x11-utils |
| [email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 59 | |
| johnme | 49bb458a | 2014-11-27 15:45:31 | [diff] [blame] | 60 | # Some binaries in the Android SDK require 32-bit libraries on the host. |
| 61 | # See https://developer.android.com/sdk/installing/index.html?pkg=tools | ||||
| 62 | if [[ $lsb_release == "precise" ]]; then | ||||
| 63 | sudo apt-get -y install ia32-libs | ||||
| 64 | else | ||||
| 65 | sudo apt-get -y install libncurses5:i386 libstdc++6:i386 zlib1g:i386 | ||||
| 66 | fi | ||||
| [email protected] | 36cd20a | 2014-08-19 20:10:06 | [diff] [blame] | 67 | |
| [email protected] | be8234b | 2014-05-28 00:20:26 | [diff] [blame] | 68 | sudo apt-get -y install ant |
| [email protected] | 457088f2 | 2012-09-26 21:47:07 | [diff] [blame] | 69 | |
| friedman | 3f67f4a | 2016-04-28 00:32:26 | [diff] [blame] | 70 | # Install openjdk and openjre stuff |
| 71 | sudo apt-get -y install $java_pkgs | ||||
| [email protected] | 457088f2 | 2012-09-26 21:47:07 | [diff] [blame] | 72 | |
| [email protected] | 850c0091 | 2014-05-23 09:42:37 | [diff] [blame] | 73 | # Switch version of Java to openjdk 7. |
| 74 | # Some Java plugins (e.g. for firefox, mozilla) are not required to build, and | ||||
| 75 | # thus are treated only as warnings. Any errors in updating java alternatives | ||||
| 76 | # which are not '*-javaplugin.so' will cause errors and stop the script from | ||||
| 77 | # completing successfully. | ||||
| friedman | 3f67f4a | 2016-04-28 00:32:26 | [diff] [blame] | 78 | if ! sudo update-java-alternatives -s $java_alternative \ |
| [email protected] | 850c0091 | 2014-05-23 09:42:37 | [diff] [blame] | 79 | >& "${TEMPDIR}"/update-java-alternatives.out |
| 80 | then | ||||
| 81 | # Check that there are the expected javaplugin.so errors for the update | ||||
| 82 | if grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out >& \ | ||||
| 83 | /dev/null | ||||
| [email protected] | 4ba8681e | 2012-03-14 07:23:30 | [diff] [blame] | 84 | then |
| [email protected] | 850c0091 | 2014-05-23 09:42:37 | [diff] [blame] | 85 | # Print as warnings all the javaplugin.so errors |
| 86 | echo 'WARNING: java-6-sun has no alternatives for the following plugins:' | ||||
| 87 | grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out | ||||
| 88 | fi | ||||
| 89 | # Check if there are any errors that are not javaplugin.so | ||||
| 90 | if grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out \ | ||||
| 91 | >& /dev/null | ||||
| 92 | then | ||||
| 93 | # If there are non-javaplugin.so errors, treat as errors and exit | ||||
| 94 | echo 'ERRORS: Failed to update alternatives for java-6-sun:' | ||||
| 95 | grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out | ||||
| 96 | exit 1 | ||||
| [email protected] | 4ba8681e | 2012-03-14 07:23:30 | [diff] [blame] | 97 | fi |
| 98 | fi | ||||
| 99 | |||||
| [email protected] | c4fabbc3 | 2012-03-07 02:22:18 | [diff] [blame] | 100 | echo "install-build-deps-android.sh complete." |