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