[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 | aeae0b7 | 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. | ||||
[email protected] | c4fabbc3 | 2012-03-07 02:22:18 | [diff] [blame] | 9 | # See http://code.google.com/p/chromium/wiki/AndroidBuildInstructions |
[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 | |
17 | # TODO(dgn) remove this this argument from calls (http://crbug.com/541727) | ||||
navabi | 654f395 | 2015-01-20 23:43:07 | [diff] [blame] | 18 | if test "$1" = "--skip-sdk-packages"; then |
navabi | 654f395 | 2015-01-20 23:43:07 | [diff] [blame] | 19 | args="${@:2}" |
navabi | 654f395 | 2015-01-20 23:43:07 | [diff] [blame] | 20 | fi |
21 | |||||
[email protected] | c4fabbc3 | 2012-03-07 02:22:18 | [diff] [blame] | 22 | if ! uname -m | egrep -q "i686|x86_64"; then |
23 | echo "Only x86 architectures are currently supported" >&2 | ||||
24 | exit | ||||
25 | fi | ||||
[email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 26 | |
[email protected] | 9e5f728 | 2014-04-03 21:40:19 | [diff] [blame] | 27 | # Install first the default Linux build deps. |
28 | "$(dirname "${BASH_SOURCE[0]}")/install-build-deps.sh" \ | ||||
navabi | 654f395 | 2015-01-20 23:43:07 | [diff] [blame] | 29 | --no-syms --lib32 --no-arm --no-chromeos-fonts --no-nacl --no-prompt "${args}" |
johnme | 49bb458a | 2014-11-27 15:45:31 | [diff] [blame] | 30 | |
31 | lsb_release=$(lsb_release --codename --short) | ||||
[email protected] | c4fabbc3 | 2012-03-07 02:22:18 | [diff] [blame] | 32 | |
[email protected] | 4ba8681e | 2012-03-14 07:23:30 | [diff] [blame] | 33 | # The temporary directory used to store output of update-java-alternatives |
[email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 34 | TEMPDIR=$(mktemp -d) |
35 | cleanup() { | ||||
36 | local status=${?} | ||||
37 | trap - EXIT | ||||
38 | rm -rf "${TEMPDIR}" | ||||
39 | exit ${status} | ||||
40 | } | ||||
41 | trap cleanup EXIT | ||||
42 | |||||
[email protected] | 4ba8681e | 2012-03-14 07:23:30 | [diff] [blame] | 43 | # Fix deps |
44 | sudo apt-get -f install | ||||
[email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 45 | |
[email protected] | 959a0f5c | 2012-06-22 23:58:58 | [diff] [blame] | 46 | # Install deps |
[email protected] | 457088f2 | 2012-09-26 21:47:07 | [diff] [blame] | 47 | # This step differs depending on what Ubuntu release we are running |
48 | # on since the package names are different, and Sun's Java must | ||||
49 | # be installed manually on late-model versions. | ||||
[email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 50 | |
[email protected] | 758d7708 | 2014-01-08 00:05:19 | [diff] [blame] | 51 | # common |
[email protected] | 5b97a1c | 2014-08-12 23:40:57 | [diff] [blame] | 52 | sudo apt-get -y install lighttpd python-pexpect xvfb x11-utils |
[email protected] | 9f95fb9 | 2011-10-06 18:19:30 | [diff] [blame] | 53 | |
johnme | 49bb458a | 2014-11-27 15:45:31 | [diff] [blame] | 54 | # Some binaries in the Android SDK require 32-bit libraries on the host. |
55 | # See https://developer.android.com/sdk/installing/index.html?pkg=tools | ||||
56 | if [[ $lsb_release == "precise" ]]; then | ||||
57 | sudo apt-get -y install ia32-libs | ||||
58 | else | ||||
59 | sudo apt-get -y install libncurses5:i386 libstdc++6:i386 zlib1g:i386 | ||||
60 | fi | ||||
[email protected] | 36cd20a | 2014-08-19 20:10:06 | [diff] [blame] | 61 | |
[email protected] | be8234b | 2014-05-28 00:20:26 | [diff] [blame] | 62 | sudo apt-get -y install ant |
[email protected] | 457088f2 | 2012-09-26 21:47:07 | [diff] [blame] | 63 | |
[email protected] | 850c009 | 2014-05-23 09:42:37 | [diff] [blame] | 64 | # Install openjdk and openjre 7 stuff |
65 | sudo apt-get -y install openjdk-7-jre openjdk-7-jdk | ||||
[email protected] | 457088f2 | 2012-09-26 21:47:07 | [diff] [blame] | 66 | |
[email protected] | 850c009 | 2014-05-23 09:42:37 | [diff] [blame] | 67 | # Switch version of Java to openjdk 7. |
68 | # Some Java plugins (e.g. for firefox, mozilla) are not required to build, and | ||||
69 | # thus are treated only as warnings. Any errors in updating java alternatives | ||||
70 | # which are not '*-javaplugin.so' will cause errors and stop the script from | ||||
71 | # completing successfully. | ||||
72 | if ! sudo update-java-alternatives -s java-1.7.0-openjdk-amd64 \ | ||||
73 | >& "${TEMPDIR}"/update-java-alternatives.out | ||||
74 | then | ||||
75 | # Check that there are the expected javaplugin.so errors for the update | ||||
76 | if grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out >& \ | ||||
77 | /dev/null | ||||
[email protected] | 4ba8681e | 2012-03-14 07:23:30 | [diff] [blame] | 78 | then |
[email protected] | 850c009 | 2014-05-23 09:42:37 | [diff] [blame] | 79 | # Print as warnings all the javaplugin.so errors |
80 | echo 'WARNING: java-6-sun has no alternatives for the following plugins:' | ||||
81 | grep 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out | ||||
82 | fi | ||||
83 | # Check if there are any errors that are not javaplugin.so | ||||
84 | if grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out \ | ||||
85 | >& /dev/null | ||||
86 | then | ||||
87 | # If there are non-javaplugin.so errors, treat as errors and exit | ||||
88 | echo 'ERRORS: Failed to update alternatives for java-6-sun:' | ||||
89 | grep -v 'javaplugin.so' "${TEMPDIR}"/update-java-alternatives.out | ||||
90 | exit 1 | ||||
[email protected] | 4ba8681e | 2012-03-14 07:23:30 | [diff] [blame] | 91 | fi |
92 | fi | ||||
93 | |||||
[email protected] | c4fabbc3 | 2012-03-07 02:22:18 | [diff] [blame] | 94 | echo "install-build-deps-android.sh complete." |